题库练习 Chat Order
← 上一题 下一题 →

A10346 | Chat Order

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

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.

输入格式

The first line contains integer $n$ ( $1<=n<=200000$ ) — 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$ .

输出格式

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

输入输出样例

输入 #1
4
alex
ivan
roman
ivan
输出 #1
ivan
roman
alex
输入 #2
8
alina
maria
ekaterina
darya
darya
ekaterina
maria
alina
输出 #2
alina
maria
ekaterina
darya
C++ 编辑器
输入
输出