's English teacher is giving him a tough time! He can handle all of the essays and the projects given to him, but he can't do poetry. Unfortunately, his teacher assigned him a massive poetry assignment – and it's worth 10% of his English mark!
's English teacher wants him to write a cyclic poem. Cyclic poems have special properties:
- Cyclic poems are constructed using only space separated words.
- They do not have to rhyme.
- They do not have to make sense.
- They do not need to contain English words.
- Words can only consist of uppercase and lowercase characters of the English alphabet.
- Each line of the poem has a character limit. The number of characters in a line, including spaces, cannot exceed its limit.
- The character limits of lines are cyclic. For example, if the cycle is :
- The 1st line's limit is 10 characters
- The 2nd line's limit is 20
- The 3rd line's limit is 30
- The 4th line's limit is 10
- The 5th line's limit is 20
- The 6th line's limit is 30, and so on.
- If a word cannot fit in a line and it does not start at the beginning of that line, it must be moved to the next line.
- If a word cannot fit in a line and it starts at the beginning of that line, it must be split into two words and the second word must be moved to the next line.
with limits . Can you help keep his English mark above 90%?
has found some poems on the Internet, but they are not formatted correctly! His teacher is very strict and requires that his cyclic poem has a cycle with a length ofInput Specification
The first line will contain , the length of the cycle.
lines of input follow. The line will contain .
The last line will consist of space-separated words that are to be used in the cyclic poem. The total number of characters, not including spaces, will not exceed .
Output Specification
The correctly formatted cyclic poem.
Sample Input
3
7
2
6
To be or not to be that is the question
Sample Output
To be
or
not to
be that
is
the
questio
n
Comments