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.


-----Examples-----
Input
4
alex
ivan
roman
ivan

Output
ivan
roman
alex

Input
8
alina
maria
ekaterina
darya
darya
ekaterina
maria
alina

Output
alina
maria
ekaterina
darya



-----Note-----

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

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

Polycarpus writes the third message to friend by name "roman" and the list looks as follows:  roman  ivan  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:  ivan  roman  alex

Difficulty: interview

Starter code:

Solutions:
n = int(input())
d = dict()
for i in range(n):
    d[input()] = i

lst = list(d.items())

lst.sort(key=lambda x:-x[1])

for i in lst:
    print(i[0])

n = int(input())
a = set()
res = []
names_arr = []
for i in range(n):
    name = input()
    names_arr.append(name)
for i in range(1, len(names_arr) + 1):
    cur_name = names_arr[-i]
    if cur_name not in a:
        a.add(cur_name)
        res.append(cur_name)
for i in range(len(res)):
    print(res[i])

n = int(input())
strings = []
s = set()
for i in range(n):
    strings.append(input())
    
for f in strings[::-1]:
    if f not in s:
        s.add(f)
        print(f)

nexts = {}
prevs = {}
n = int(input())
cur = input()
prevs[cur] = -1
nexts[cur] = -1
for i in range(1,n):
    x = input()
    if x in list(nexts.keys()):
        if cur!=x:
            nexts[prevs[x]]=nexts[x]
            prevs[nexts[x]]=prevs[x]
            prevs[x]=cur
            nexts[cur]=x
            nexts[x]=-1
            cur=x
    else:
        nexts[cur]=x
        prevs[x]=cur
        cur=x
        nexts[x]=-1
while prevs[cur]!=-1:
    print(cur)
    cur = prevs[cur]
print(cur)





n = int(input())
has = {}

def comp(e1):
    return e1[1]

for i in range(n):
    s = input()
    has[s]=i
ar = []
for k,v in has.items():
    ar.append([k,v])
ar.sort(key=comp, reverse=True)
for x in ar:
    print(x[0])

A = []
for i in range(int(input())):
    A.append(input().strip())

names = set()
for i in range(len(A) - 1, -1, -1):
    if not A[i] in names:
        names.add(A[i])
        print(A[i])

message_count = int(input())
names = {}
last = 1 
for i in range(message_count):
    name = input()
    names[name] = -i
sorted_names = sorted(names.keys(), key = lambda name: names[name])
[print(name) for name in sorted_names]

n = int(input())
chat_list = []
names = set()
for i in range(n):
    name = input()
    if name not in names:
        names.add(name)
    chat_list.append(name)
x = len(names)
for i in chat_list[::-1]:
    if i in names:
        print(i)
        names.remove(i)
        x -= 1
        if x == 0:
            break


n = int(input())
a = []
d = {}
l = 0
k = n
while l<n:
    a.append(input())
    d[a[l]] = False
    l+=1

k = k-1
while k>=0:
    if not d[a[k]]:
        print(a[k])
        d[a[k]] = True
    k-=1


def unique(lst):
    seen = set()
    result = []
    for x in lst:
        if x in seen:
            continue
        seen.add(x)
        result.append(x)
    return result

a=int(input())
c=[]
for i in range(a):
    c+=[input()]

print(*unique(reversed(c)),sep='\n')


n = int(input())
a = [input() for i in range(n)]
was = set()
for name in a[::-1]:
    if name not in was:
        was.add(name)
        print(name)


order = []
users_set = set()

count = int(input())
messages = []
for _ in range(count):
    messages.append(input())

for user in reversed(messages):
    if user not in users_set:
        order.append(user)
        users_set.add(user)

print('\n'.join(order))


n = int(input())
name = input()
dname = dict()
dname[name] = 1
lname = name
for i in range(1,n):
    name = input()
    dname[name] = i + dname[lname]
    lname = name

l = lambda x: x[1]
sd = sorted(list(dname.items()), key=l, reverse=True)
for i in range(len(sd)):
    print(sd[i][0])


n = int(input())
k = list()
m = set()
for i in range(n):
    a = input()
    k.append(a)
    m.add(a)
for i in range(n-1, -1, -1):
    if k[i] in m:
        print(k[i], end = '\n')
        m.discard(k[i])

n=int(input())
St=[]
Set=set()
for i in range(n):
	s=input()
	St.append(s)
	Set.add(s)
i=n
while i>0:
	P=St.pop()
	if P in Set:
		Set.remove(P)
		print(P)
	i-=1 

n=int(input())
arr=[]
for i in range(n):
    arr.append(input())
q={1}
for i in range(n-1, -1, -1):
    if arr[i] not in q:
        q|={arr[i]}
        print(arr[i])


n = int(input())
a = [input() for i in range(n)]
sa = set(a)

ts = set()
res = []

for name in reversed(a):
  if len(sa) == len(ts): break
  if not name in ts:
    res.append(name)
    ts.add(name)

print("\n".join(res))


import sys
import collections

_ = sys.stdin.readline()  # read count, not needed for us

names = collections.OrderedDict()

while True:
    name = sys.stdin.readline()
    name = name.strip()

    if not name:
        break

    if name not in names:
        names[name] = None

    names.move_to_end(name)

sys.stdout.write('\n'.join(reversed(names)))


n = int(input())
name = {}
for i in range(n):
    s = input()
    name[s] = i

a = list(name)
a.sort(key=lambda x: -name[x])

for i in range(len(a)):
    print(a[i])

def main():
    n = int(input())
    our = [input() for i in range(n)]
    made = set()
    while our:
        c = our[-1]
        if c not in made:
            made.add(c)
            print(c)
        our.pop()
    
main()

n = int(input())
d = {}
for i in range(n):
    d[input()] = i
answer = []
k = list(d.keys())
for i in range(len(k)):
    answer += [(d[k[i]], k[i])]
answer.sort(reverse = True)
for i in range(len(answer)):
    print(answer[i][1])


    
    
    


n = int(input())
A = [0] * n
for i in range(n):
    A[i] = input()
mass = set()
per = 0
for i in range(n-1, -1,-1):
    mass.add(A[i])
    t = len(mass)
    if t > per:
        per = t
        print(A[i])


n = int(input())
arr = []
for i in range(n):
    line = input()
    arr.append(line)
res = []
d = {}
for i in arr[::-1]:
    if i not in d:
        res.append(i)
        d[i] = True
print('\n'.join(res))


# -*- coding: utf-8 -*-
"""
Created on Sun Mar 13 19:40:03 2016

@author: Kostya S.
"""

n = int(input())
d = {}
p = 1
for _ in range(n):
    s = input()
    d[s] = p
    p += 1
t = []
for k,v in d.items():
#    print(k,v)
    t.append((v,k))
t = sorted(t,reverse = True)

for e in t:
    print(e[1])