Олимпиадный тренинг

Задача 30711. Synonym dictionary


Задача

Темы: Словари
You are given a dictionary consisting of pairs of words. Each word is a synonym for its paired word. All words in the dictionary are different. For one given word, define its synonym.
 
Input
The program receives N number of pairs of synonyms as input. N lines follow, each line contains exactly two synonym words. This is followed by one word.
 
Output
The program should display a synonym for the given word.
 
Example
# Input Output
1
3
Hello Hi
Bye Goodbye
ListArray
Goodbye
Bye