Submit solution
Points:
1
Time limit:
1.0s
Memory limit:
128M
Author:
Problem type
Allowed languages
Python
Description
Speeding Air-Line (SAL) has multiple air-routes available, each is a one-way flight from city to .
Now SAL launched a new offer, selling tickets in one, leaving from , travel through multiple cities, and finally stay at .
Given the of these air-routes, find which city is the end of the trip ()
Limits
- number of air-routes:
- leaving and staying:
- take-off and landing:
- city visits count: \(Visit(\space C_a \space) = Visit(\space C_b \space) = 1\)
Input
First line contains a positive interger , following by the of these air-routes.
Each air-routes is given by 2 lines of input:
- the first line is , representing take-off city.
- the second line is , representing landing city.
Sample IO
Example 1
Input
3
London
New York
New York
Lima
Lima
Sao Paulo
Output
Sao Paulo
Example 2
Input
11
Berlin
Rio de Janeiro
Sydney
Rome
New York
Tokyo
Beijing
Berlin
Moscow
Los Angeles
Tokyo
Paris
Rome
Beijing
Paris
London
Cairo
Moscow
London
Sydney
Rio de Janeiro
Cairo
Output
Los Angeles
Comments