#C8710. Team Formation

    ID: 52723 Type: Default 1000ms 256MiB

Team Formation

Team Formation

You are given a list of participant names and a positive integer \( k \) representing the team size. Your task is to form teams by grouping the participants into consecutive groups of size \( k \). The last team may have fewer than \( k \) participants if the total number of participants is not divisible by \( k \).

Note: The teams should be formed in the order in which the participants are given.

inputFormat

The input is given via STDIN in the following format:

n
name1
name2
... 
namen
k

Where:

  • \( n \) is an integer representing the number of participants.
  • The next \( n \) lines each contain a participant's name.
  • \( k \) is an integer representing the team size.

outputFormat

The output should be printed to STDOUT as teams. Each team is printed on a separate line with participant names separated by a space.

## sample
6
Alice
Bob
Charlie
David
Eve
Frank
3
Alice Bob Charlie

David Eve Frank

</p>