According to your description, we could use CSS selector :nth-child() Selector to achieve your requirement, if you want to hide the first div for the next line, I suggest you could try below CSS:
More details, you could refer to this article.
/*Used for the next line start */
.flex-item:nth-child(5n+1){
visibility:hidden;
}
/*Used for the first column */
.flex-item:nth-child(1){
visibility:visible;
}