You are planning a big programming conference and have received many proposals which have passed the initial screen process but you're having trouble fitting them into the time constraints of the day -- there are so many possibilities! So you write a program to do it for you.
· The conference has multiple tracks each of which has a morning and afternoon session.
· Each session contains multiple talks.
· Morning sessions begin at 9am and must finish by 12 noon, for lunch.
· Afternoon sessions begin at 1pm and must finish by 5 pm for snacks.
· No talk title has numbers in it.
· All talk lengths are either in minutes (not hours) or lightning (5 minutes).
· Presenters will be very punctual; there needs to be no gap between sessions.
Note that depending on how you choose to complete this problem, your solution may give a different ordering or combination of talks into tracks. This is acceptable; you don’t need to exactly duplicate the sample output given here.
Input Format:
The first line will contain an integer N. N lines follow each will contain a string.
Output Format:
For each query output the solution to the problem. Refer to the sample output for further clarification.
Constraints:
1 <= N <= 20
Every string will contain a text initially (which may contain space) followed by time of completion in minutes at the end. Refer to sample input for further clarification.