Visitors want to come and watch a movie at the museum. When the theather is not in session and the theater is empty, visitors rush in and grab a seat, until all seats are filled, and any visitors still in the theather exit politely(yield) and leave the theather. Once everything settles, the movie watchers get to see the movie, and when it ends, form groups of fixed sizes (except for one group if possibly uneven). Once grouped up, the speaker will distribute tickets to each group, and then wait until the end of the NEXT movie session. Once everyone has their tickets, visitors can leave (anytime) AS LONG as all visitors with smaller ids have left already, and once done, they head home. Once the theater clears out, visitors who haven't watched the movie may rush in again.
By default, only 4 movies shown in the day, and the museum closes at the end of the 4th movie. If visitors haven't gotten the chance to watch, they leave as the museum and head home.
javac Main.java && java Main <integer value for number of visitors>