Problem

3 /4


What happened later?

Problem

Given N dates for events after 1930: Name, year, month number, and day. Write a program that organizes the input of information into the structure and compares any two events in time. You need to display the name of the event that happened later.

Input
The first line contains the number N - the number of events (\(1<=N<=100\)). Followed by N entries in the format (space separated):
<Event> <day of event> <month> <year>.
Next comes a line indicating the names of the two events to be compared:
<event1> <event2>.

Event - one word, day of the event - number from 1 to 31, month  - number from 1 to 12,  year - a number from 1937 to 2016.

Imprint
Print the name of the event that happened later and its date in the following format:
<event> <day of event> <Month> <Year>.
If two events happened on the same day, print their names separated by a space (without specifying the date):
<event1> <event2>. 
 
Note
The name of the events can be repeated, in which case it is necessary to take the event that occurred later in the source data.