VK Cup 2016 - Qualification Round 1
B
Chat Order
Codeforces
1200
原题
← AC →
翻译中…

Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the other chats doesn't change. If there was no chat with this friend before, then a new chat is simply inserted to the top of the list.

翻译中…

Assuming that the chat list is initially empty, given the sequence of Polycaprus' messages make a list of chats after all of his messages are processed. Assume that no friend wrote any message to Polycarpus.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 200 000$) — the number of Polycarpus' messages. Next $*n*$ lines enlist the message recipients in the order in which the messages were sent. The name of each participant is a non-empty sequence of lowercase English letters of length at most $10$.

翻译中…

Output

翻译中…

Print all the recipients to who Polycarp talked to in the order of chats with them, from top to bottom.

翻译中…

Note

翻译中…

In the first test case Polycarpus first writes to friend by name "alex", and the list looks as follows:

翻译中…
  1. alex
翻译中…

Then Polycarpus writes to friend by name "ivan" and the list looks as follows:

翻译中…
  1. ivan
  2. alex
翻译中…

Polycarpus writes the third message to friend by name "roman" and the list looks as follows:

翻译中…
  1. roman
  2. ivan
  3. alex
翻译中…

Polycarpus writes the fourth message to friend by name "ivan", to who he has already sent a message, so the list of chats changes as follows:

翻译中…
  1. ivan
  2. roman
  3. alex
翻译中…

样例

Input #1
4
alex
ivan
roman
ivan
Output #1
ivan
roman
alex
InputCopy OutputCopy
Input #2
8
alina
maria
ekaterina
darya
darya
ekaterina
maria
alina
Output #2
alina
maria
ekaterina
darya
InputCopy OutputCopy
题目信息
题号
637B
时间限制
3 s
内存限制
256 MB
标签
*special
二分
构造
数据结构
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。