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: EASY

Solutions:
def print_in_order(stack):
	names_appeared = set()
	while stack:
		name = stack.pop()
		if not name in names_appeared:
			print(name)
			names_appeared.add(name)
n = int(input())
stack = []
for _ in range(n):
	stack.append(input())
print_in_order(stack)


from collections import OrderedDict
ordered = {}
sms_numbers = int(input())
for i in range(0, sms_numbers):
	ordered[input()] = sms_numbers - i
OrderedDict(sorted(ordered.items(), key=lambda t: t[1]))
print('\n'.join((item for item in OrderedDict(sorted(ordered.items(), key=lambda t: t[1])).keys())))


d = {}
for i in range(int(input())):
	s = input()
	d[s] = i
d = sorted(d.items(), key=lambda x: x[1], reverse=True)
for i in d:
	print(i[0])


import math
n = int(input())
names = {}
for i in range(0, n):
	x = input()
	names[x] = i
names = sorted(names.items(), key=lambda x: x[1])
ans = []
for key in names:
	ans.append(key[0])
for i in range(len(ans) - 1, -1, -1):
	print(ans[i])


counter = int(input())
names = {}
for i in range(counter):
	line = input()
	names[line] = i

def main(names, counter):
	names = list(names.items())
	names.sort(key=lambda x: x[1], reverse=True)
	lines = [print(line[0]) for line in names]
main(names, counter)


n = int(input())
l = []
for _ in range(n):
	l.append(input())
answer = []
s = set()
for i in range(n - 1, -1, -1):
	if l[i] not in s:
		s.add(l[i])
		answer.append(l[i])
for _ in answer:
	print(_)


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))


n = int(input())
l = [input() for i in range(n)]
d = dict()
for i in range(n - 1, -1, -1):
	if l[i] not in d:
		d[l[i]] = 1
		print(l[i])


import sys

def solve():
	n = int(input())
	S = set()
	chat_list = []
	history = sys.stdin.read().split()
	for name in reversed(history):
		if not name in S:
			chat_list.append(name)
			S.add(name)
	for name in chat_list:
		sys.stdout.write(name + '\n')
solve()


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())
from time import time
k = time()
names = {}
res = []
for i in range(n):
	s = input()
	if s in names:
		res[names[s]] = False
	names[s] = i
	res.append(s)
for i in range(n - 1, -1, -1):
	if res[i] != False:
		print(res[i])


from collections import OrderedDict
totalMessages = int(input())
authors = list([(input(), True) for message in range(totalMessages)])
authors = authors[::-1]
for author in OrderedDict(authors).keys():
	print(author)


n = int(input())
m = [input() for i in range(n)][::-1]
k = {}
for i in m:
	if i in k:
		continue
	else:
		k[i] = -1
		print(i)


from operator import itemgetter
msgs = {}
for i in range(int(input())):
	msgs[input()] = i
for (k, v) in sorted(msgs.items(), key=itemgetter(1))[::-1]:
	print(k)


__author__ = 'Alexandret'
chats_amount = int(input())
chats_last_message = dict()
for i in range(chats_amount):
	uid = input()
	chats_last_message[uid] = i
l = lambda x: x[1]
tmp = sorted(chats_last_message.items(), key=l, reverse=True)
for i in tmp:
	print(i[0])


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


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())
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 = i - 1


import operator
n = int(input())
friends = {}
for i in range(n):
	word = input()
	friends[word] = i
sortedfriends = {k: v for (k, v) in sorted(friends.items(), key=lambda item: item[1])}
res = list(sortedfriends.keys())
res.reverse()
for i in res:
	print(i)


n = int(input())
friend_list = dict()
for i in range(n):
	friend_list[input()] = i
friends = list(friend_list.keys())
friends.sort(reverse=True, key=lambda x: friend_list[x])
for friend in friends:
	print(friend)


def main():
	n = int(input())
	a = [input() for i in range(n)]
	s = set()
	ans = []
	for i in a[::-1]:
		if i not in s:
			ans.append(i)
			s.add(i)
	print(*ans, sep='\n')
main()


n = int(input())
last_pos = 0
chatlist = {}
for i in range(n):
	name = input()
	chatlist[name] = last_pos
	last_pos -= 1
name_pos_pairs = []
for name in chatlist:
	name_pos_pairs.append((name, chatlist[name]))
name_pos_pairs.sort(key=lambda x: x[1])
for pair in name_pos_pairs:
	print(pair[0])


from collections import OrderedDict as D
d = D()
for n in range(int(input())):
	x = input()
	d[x] = d.pop(x, None)
print('\n'.join(list(d.keys())[::-1]))


n = int(input())
inp = []
a = []
s = set()
for i in range(0, n):
	b = input()
	inp.append(b)
inp = inp[::-1]
for i in inp:
	if i not in s:
		a.append(i)
		s |= set([i])
for i in a:
	print(i)


n = int(input())
l = []
for i in range(n):
	l.append(input())
l = list(dict.fromkeys(reversed(l)))
for i in l:
	print(i)


num = input()
printed = {}
names = []
for i in range(int(num)):
	names.append(input())
for name in reversed(names):
	if name not in printed:
		print(name)
		printed[name] = True


n = int(input())
u = {}
for x in [input() for _ in range(n)][::-1]:
	if x not in u:
		u[x] = 1
		print(x)


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()


p = []
dic = {}
n = int(input())
for _ in range(n):
	s = input()
	p.append(s)
	dic[s] = 1
for i in range(len(p) - 1, -1, -1):
	if dic[p[i]] == 0:
		continue
	else:
		dic[p[i]] = 0
		print(p[i])


z = [input() for i in range(int(input()))]
z.reverse()
lst = set(z)
for i in z:
	if i in lst:
		print(i)
		lst.remove(i)


def solve(chat_history):
	chat_list = []
	used = dict()
	for chat in reversed(chat_history):
		if chat in used:
			continue
		chat_list.append(chat)
		used[chat] = True
	return chat_list

def main():
	n = int(input())
	chat_history = [None] * n
	for i in range(n):
		chat_history[i] = input()
	chat_list = solve(chat_history)
	for chat in chat_list:
		print(chat)
main()


n = int(input())
names = {}
for i in range(n):
	name = input()
	names[name] = i
for (name, key) in sorted(zip(names.values(), names.keys()), reverse=True):
	print(key)


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	a = [''] * n
	mp = {}
	cur = n - 1
	for i in range(n):
		s = input()
		mp[s] = cur
		cur -= 1
	for (name, ind) in mp.items():
		a[ind] = name
	for v in a:
		if v:
			print(v)


n = int(input())
s = set()
a = []
for x in [input() for i in range(n)][::-1]:
	if not x in s:
		a += [x]
		s |= {x}
print('\n'.join(a))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
from math import log, sqrt, factorial, cos, tan, sin, radians, ceil, floor
import bisect
from decimal import *
getcontext().prec = 25
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def main():
	n = ii()
	d = {}
	l = []
	c = 0
	for i in range(n):
		s = si()
		l.append(s)
		if s not in d:
			d[s] = 1
			c += 1
	ans = []
	for i in range(n - 1, -1, -1):
		if d[l[i]]:
			print(l[i])
			d[l[i]] = 0
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
d = {}
for x in [input() for i in range(n)][::-1]:
	if not x in d:
		d[x] = 1
		print(x)


n = int(input())
order = []
messages = []
d = set()
for i in range(n):
	name = input()
	messages.append(name)
for i in range(n - 1, -1, -1):
	if messages[i] not in d:
		order.append(messages[i])
		d.add(messages[i])
for i in order:
	print(i)


from collections import OrderedDict
n = int(input())
names = OrderedDict()
for i in range(n):
	x = input()
	if x in names:
		names.move_to_end(x)
	else:
		names[x] = 0
for i in reversed(list(names)):
	print(i)


__author__ = 'Utena'
import operator
chat = dict()
top = 0
n = int(input())
for i in range(n):
	s = input()
	chat[s] = top + 1
	top = top + 1
chat = sorted(chat.items(), key=lambda x: x[1], reverse=1)
for i in range(len(chat)):
	print(chat[i][0])


(d, l) = ({}, [input() for i in range(int(input()))])
for i in l:
	if i in d.keys():
		d[i] += 1
	else:
		d[i] = 1
for i in l[::-1]:
	if d[i] > 0:
		print(i)
		d[i] = 0


(a, d) = ([input() for i in range(int(input()))], {})
for i in reversed(a):
	if i not in d.keys():
		print(i)
	d[i] = 1


n = int(input())
lis = []
for i in range(0, n):
	lis.append(input())
lis.reverse()
dic = {}
j = 1
for i in lis:
	if i not in dic:
		dic[i] = j
		j += 1
lis = list(dic.items())
lis.sort(key=lambda kv: (kv[1], kv[0]))
for i in lis:
	print(i[0])


from collections import defaultdict
n = int(input())
names = list()
names_map = defaultdict(lambda : 0)
result = list()
for _ in range(n):
	names.append(input())
for i in range(n - 1, -1, -1):
	if names_map[names[i]] == 0:
		result.append(names[i])
	names_map[names[i]] = 1
print('\n'.join(result))


n = int(input())
deja_rentre = dict()
for i in range(n):
	name = input()
	deja_rentre[name] = n - i
for (name, _) in sorted(list(deja_rentre.items()), key=lambda c: c[1]):
	print(name)


n = int(input())
l = [input() for i in range(n)]
m = {}
for i in range(n - 1, -1, -1):
	if not l[i] in m:
		m[l[i]] = True
		print(l[i])


def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)
n = it()
dict = {}
L = [ip() for _ in range(n)][::-1]
for x in L:
	if not x in dict:
		dict[x] = 1
		print(x)


n = int(input())
messages = [input() for x in range(n)]
users = {x: 0 for x in messages}
counter = 0
for x in messages:
	users[x] = counter
	counter += 1
for x in sorted(users.items(), key=lambda x: x[1], reverse=True):
	print(x[0])


users = [input() for _ in range(int(input()))]
duplicated = {}
for user in users[::-1]:
	if user not in duplicated:
		print(user)
		duplicated[user] = 1


def solve(messages):
	visited = set()
	order = []
	for i in range(len(messages) - 1, -1, -1):
		if messages[i] not in visited:
			order.append(messages[i])
			visited.add(messages[i])
	return order
messages_count = int(input())
messages = []
for i in range(messages_count):
	messages.append(input())
order = solve(messages)
print('\n'.join(order))


d = dict()
n = int(input())
l = [None] * n
for i in range(n):
	m = input()
	d[m] = False
	l[i] = m
for i in l[::-1]:
	if not d[i]:
		print(i)
		d[i] = True


n = int(input())
names = {}
for i in range(n):
	s = str(input())
	names[s] = i
names = sorted(names, key=lambda x: names[x], reverse=True)
for i in range(len(names)):
	print(names[i])


t = int(input())
q = list()
for i in range(t):
	n = input()
	q.append(n)
s = set(q)
while len(s) > 0:
	for j in q[::-1]:
		if j in s:
			print(j)
			s.remove(j)
	else:
		break


check = set()
answer = []
number = []
n = int(input())
count = 0
for i in range(0, n, 1):
	s = str(input())
	number.append(s)
for i in range(n - 1, -1, -1):
	check.add(number[i])
	a = len(check)
	if a > count:
		count += 1
		answer.append(number[i])
pp = len(answer)
for i in range(0, pp, 1):
	print(answer[i])


n = int(input())
chat = {}
for i in range(n):
	chat[input()] = i
c = {}
for i in chat.keys():
	c[chat[i]] = i
m = []
for i in sorted(list(c.keys()), reverse=True):
	m.append(c[i])
print(*m, sep='\n')


n = int(input())
friends = []
chat = set()
final = []
for i in range(n):
	friends.append(input())
for i in range(len(friends) - 1, -1, -1):
	if friends[i] not in chat:
		final.append(friends[i])
		chat.add(friends[i])
for i in range(len(final)):
	print(final[i])


dct = dict()
for i in range(int(input())):
	dct[input()] = i
lst = []
for key in dct:
	lst.append([dct[key], key])
lst.sort(reverse=True)
for i in lst:
	print(i[1])


n = int(input())
D = dict()
A = []
for i in range(n):
	s = input()
	if s not in D:
		D[s] = i
		A.append(s)
	else:
		A.append(0)
		(A[D[s]], A[-1]) = (A[-1], A[D[s]])
		D[s] = i
for i in range(len(A) - 1, -1, -1):
	if A[i] != 0:
		print(A[i])


n = int(input())
m = {}
for i in range(n):
	s = input()
	m[s] = (-i, s)
m = [t[1] for t in sorted(m.values())]
print('\n'.join(m))


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)


n = int(input())
d = dict()
for i in range(0, n):
	s = input()
	d[s] = i
l = sorted(d.items(), key=lambda x: x[1], reverse=True)
for k in l:
	print(k[0])


n = int(input())
l = [input() for i in range(n)]
l.reverse()
b = {}
for i in l:
	if i not in b:
		b[i] = 1
		print(i)


t = []
f = {}
n = int(input())
for i in range(n):
	a = input()
	t.append(a)
for j in range(n - 1, -1, -1):
	if t[j] not in f:
		print(t[j])
		f[t[j]] = 1


from collections import defaultdict
from sys import stdin
res = []
used = set()
input = stdin.readlines()
input.pop(0)
for name in reversed(input):
	if name not in used:
		print(name, end='')
		used.add(name)


from collections import defaultdict
d = defaultdict(lambda : 0)
K = int(input())
n = ''
for k in range(K):
	d[input()] = k
di = [x for x in d.items()]
for x in sorted(di, key=lambda x: x[1], reverse=True):
	print(x[0])


n = int(input())
s = [input() for i in range(n)]
chat = {}
for x in s[::-1]:
	if x not in chat:
		chat[x] = 1
		print(x)


def solution(l):
	unique_persons = set()
	while len(l) > 0:
		if l[-1] in unique_persons:
			l.pop()
		else:
			print(l[-1])
			unique_persons.add(l[-1])
			l.pop()
n = int(input())
l = []
for i in range(n):
	s = input()
	l.append(s)
solution(l)


import sys
import collections
_ = sys.stdin.readline()
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())
recipients = [input() for _ in range(0, n)]
alreadydone = set()
for i in range(0, n):
	c = recipients[n - i - 1]
	if c not in alreadydone:
		print(c)
		alreadydone.add(c)


n = int(input())
doth = {}
for i in range(n):
	doth.update({input(): i})
dcont = {}.fromkeys(range(n))
for t2 in doth.items():
	dcont[t2[1]] = t2[0]
for i in range(n - 1, -1, -1):
	if dcont[i] != None:
		print(dcont[i])


n = int(input())
chat = []
position = {}
for i in range(n):
	s = str(input())
	try:
		chat[position[s]] = 'N'
	except:
		pass
	chat.append(s)
	position[s] = i
for j in range(n - 1, -1, -1):
	if chat[j] != 'N':
		print(chat[j])


from collections import defaultdict as dq
n = int(input())
z = []
d = dq(int)
for _ in range(n):
	z.append(input())
for x in range(n - 1, -1, -1):
	if d[z[x]] == 0:
		print(z[x])
		d[z[x]] = 1


from sys import stdin
input()
d = {s: i for (i, s) in enumerate(stdin.read().splitlines())}
print('\n'.join(sorted(d.keys(), key=d.get, reverse=True)))


from collections import Counter
T = int(input())
name = []
for t in range(T):
	n = input()
	name.append(n)
name.reverse()
ctr = list(Counter(name).keys())
print('\n'.join(ctr))


n = int(input())
data = [input() for i in range(n)]
res = set()
for v in reversed(data):
	if not v in res:
		print(v)
		res.add(v)


(I, d) = (input, {})
for i in [I() for i in range(int(I()))][::-1]:
	if i not in d:
		print(i)
	d[i] = 1


n = int(input())
rank = {}
for i in range(n):
	rank[input()] = i
print('\n'.join(sorted(rank, key=lambda x: rank[x], reverse=True)))


a = set()
nxt = {}
pre = {}
top = ''
for i in range(int(input())):
	s = input()
	if s not in a:
		nxt[s] = top
		pre[top] = s
		top = s
		a.add(s)
	elif s != top:
		(pre[nxt[s]], nxt[pre[s]]) = (pre[s], nxt[s])
		nxt[s] = top
		pre[top] = s
		top = s
ans = []
while top != '':
	ans.append(top)
	top = nxt[top]
print('\n'.join(ans))


from collections import deque
n = int(input())
fritem = list()
friend = deque(fritem)
out = dict()
for i in range(n):
	name = input()
	out[name] = 1
	friend.appendleft(name)
for i in range(n):
	tem = friend.popleft()
	if out[tem] != 0:
		print(tem)
	out[tem] = 0


from sys import stdin
all_in = stdin.readlines()
n = int(all_in[0])
adr = list(map(lambda x: x.rstrip('\n'), all_in[1:]))
was = set()
ans = list()
for el in adr[::-1]:
	if el not in was:
		ans.append(el)
		was.add(el)
print('\n'.join(ans))


n = int(input())
ls = []
mass = dict()
for i in range(n):
	massage = input()
	ls.append(massage)
for i in range(n - 1, -1, -1):
	try:
		if not mass[ls[i]]:
			print(ls[i])
	except:
		a = ls[i]
		mass[str(a)] = 1
		print(ls[i])


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


import datetime
n = int(input())
arr = []
for i in range(n):
	arr.append(input())
new = set()
arr.reverse()
for i in arr:
	if i not in new:
		print(i)
		new.add(i)


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])


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())
wee = {}
for i in range(n):
	temp = input()
	wee[temp] = i
result = sorted(wee.items(), key=lambda t: t[1], reverse=True)
for i in result:
	print(i[0])


n = int(input())
a = []
for i in range(n):
	a.append(input().rstrip('\n'))
done = set([])
for i in range(n - 1, -1, -1):
	if a[i] not in done:
		print(a[i])
		done.add(a[i])


n = int(input())
chat = {}
for i in range(n):
	chat[input()] = i
c = {}
for i in chat.keys():
	c[chat[i]] = i
t = list(c.keys())
t.sort(reverse=True)
for i in t:
	print(c[i])


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	n = ii()
	a = []
	for i in range(n):
		a.append(si())
	m = {}
	a.reverse()
	for i in a:
		if i in m:
			continue
		print(i)
		m[i] = 1
solve()


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)


d = {}
st = []
n = int(input())
for i in range(n):
	st.append(input())
for i in range(n - 1, -1, -1):
	d[st[i]] = d.get(st[i], 0) + 1
	if d[st[i]] == 1:
		print(st[i])


n = int(input())
s = [''] * (n + 100)
for i in range(n):
	s[i] = input()
used = set()
for j in range(n - 1, -1, -1):
	if not s[j] in used:
		used.add(s[j])
		print(s[j])


import sys
n = int(input())
a = []
for i in range(0, n):
	a.append(input())
se = {''}
i = n - 1
while i >= 0:
	size1 = len(se)
	se.add(a[i])
	if size1 != len(se):
		print(a[i])
	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())
l = []
while n:
	l.append(input())
	n -= 1
a = set()
for i in reversed(l):
	if not i in a:
		a.add(i)
		print(i)


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


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


n = int(input())
chats = {}
for i in range(n):
	name = input()
	chats[name] = i
chats = sorted(chats.items(), key=lambda d: d[1], reverse=True)
for x in chats:
	print(x[0])


def val(x):
	return x[1]
n = int(input())
chatQ = {}
c = 0
for i in range(1, n + 1):
	name = str(input())
	if name not in chatQ:
		chatQ[name] = i
	else:
		chatQ[name] = c
	c = chatQ.get(name) + 1
x = list(chatQ.keys())
y = list(chatQ.values())
z = []
for i in range(len(x)):
	z.append([x[i], y[i]])
z.sort(key=val, reverse=True)
for i in z:
	print(i[0])


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))


n = input('')
n = int(n)
d = {}
for i in range(n):
	name = input('')
	d[name] = i
l = list(d.items())
from operator import itemgetter
l.sort(key=itemgetter(1), reverse=True)
for i in range(len(l)):
	print(l[i][0])


data = int(input())
dict = {}
for i in range(data):
	line = input()
	dict[i] = line
nonre = {}
ans = []
for i in range(len(dict))[::-1]:
	if dict[i] not in nonre:
		nonre[dict[i]] = 1
		ans.append(dict[i])
		print(dict[i])


n = int(input())
a = [input() for _ in range(n)]
s = set()
for i in reversed(a):
	if i not in s:
		s.add(i)
		print(i)


n = int(input())
d = dict()
for i in range(n):
	s = input()
	b = (n - i) % 200
	a = (n - i) // 200
	d[s] = a * 'È' + chr(b)
d1 = sorted(d.items(), key=lambda d: d[1])
l = len(d1)
for i in range(l):
	print(d1[i][0])


from sys import stdin
input()
arr = stdin.read().splitlines()
st = set()
for i in arr[::-1]:
	if not i in st:
		print(i)
		st.add(i)


def main():
	mylist = []
	n = int(input())
	for i in range(n):
		name = input()
		mylist.append(name)
	d = {}
	for i in mylist[::-1]:
		if not d.get(i):
			print(i)
			d[i] = 1
main()


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	a = []
	for i in range(n):
		a.append(input().strip())
	s = set([])
	i = 1
	while i <= n:
		if a[-i] not in s:
			print(a[-i])
			s.add(a[-i])
		i += 1
for _ in range(1):
	case()


ls = []
for _ in range(int(input())):
	s = input()
	ls.append(s)
s = {}
for i in range(len(ls) - 1, -1, -1):
	if ls[i] not in s:
		print(ls[i])
	s[ls[i]] = 1


from sys import stdin, stdout
num_mensagens = int(stdin.readline().strip())
nomes = []
for idx in range(0, num_mensagens):
	nomes.append(stdin.readline().strip())
nomes.reverse()
nomes = list(dict.fromkeys(nomes))
for nome in nomes:
	stdout.writelines(nome + '\n')


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


import collections
dp = {}
for i in range(int(input())):
	dp[input()] = i
x = sorted(dp.items(), key=lambda x: x[1], reverse=True)
for (i, a) in x:
	print(i)


(n, l) = (int(input()), [])
for i in range(n):
	l.append(input())
(q, l) = ({}, l[::-1])
for i in l:
	q[i] = 0
print(*q, sep='\n')


n = int(input())
seen = {}
data = []
for i in range(n):
	st = input().strip()
	data.append(st)
while data:
	st = data.pop()
	if st not in seen:
		seen[st] = True
		print(st)


n = int(input())
d = dict()
for i in range(n):
	name = input()
	d[name] = i
a = [(name, d[name]) for name in d]
a = sorted(a, key=lambda x: x[1], reverse=True)
for p in a:
	print(p[0])


from sys import stdin, stdout
import bisect as bs
from collections import defaultdict
for _ in range(1):
	n = int(stdin.readline())
	p = 1
	ans = float('inf')
	a = [''] * n
	mp = {}
	cur = n - 1
	for i in range(n):
		s = input()
		mp[s] = cur
		cur -= 1
	for (name, ind) in mp.items():
		a[ind] = name
	for v in a:
		if v:
			print(v)


chat = [input() for i in range(int(input()))]
l = {}
while chat:
	t = chat.pop()
	if t not in l:
		l[t] = 0
		print(t)


n = int(input())
names = []
for i in range(n):
	names.append(input())
s = set()
for name in reversed(names):
	if name not in s:
		s.add(name)
		print(name)


ts = {}
n = int(input())
for i in range(n):
	u = input()
	ts[u] = i
ts = sorted(map(lambda x: (-x[1], x[0]), ts.items()))
print('\n'.join(map(lambda x: x[1], ts)))


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())
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())
names = [input() for _ in range(n)][::-1]
seen = set()
ans = list()
for name in names:
	if name not in seen:
		seen.add(name)
		ans.append(name)
print('\n'.join(ans))


n = int(input())
d = {}
for i in range(n):
	d[input()] = i
a = [(i[1], i[0]) for i in d.items()]
a.sort(reverse=True)
print(*[i[1] for i in a], sep='\n')


n = int(input())
D = {}
l = []
ll = []
for i in range(0, n):
	l.append(input())
for i in range(0, n):
	if l[n - i - 1] in D:
		m = 0
	else:
		D[l[n - i - 1]] = 1
		ll.append(l[n - 1 - i])
for i in range(0, len(ll)):
	print(ll[i])


n = int(input())
s = [input() for _ in range(n)]
l = set()
for x in reversed(s):
	if x not in l:
		print(x)
		l.add(x)


uniq = {}
n = int(input())
s = [0] * n
for i in range(n):
	s[i] = input()
for i in s[::-1]:
	if i not in uniq:
		print(i)
		uniq[i] = 1


n = int(input())
rank = n
li = [0] * (n + 1)
for i in range(n, 0, -1):
	s = input()
	li[i] = s
dp = dict()
for i in range(1, n + 1):
	if dp.get(li[i], 0) == 0:
		dp[li[i]] = 1
		print(li[i])


n = int(input())
arr = []
for i in range(n):
	s = input()
	arr.append(s)
st = {''}
for i in range(n):
	s = arr.pop()
	if s not in st:
		st.add(s)
		print(s)


n = int(input())
l = [input() for i in range(n)]
m = set()
for i in range(n - 1, -1, -1):
	if l[i] not in m:
		print(l[i])
		m.add(l[i])


n = int(input())
p = [0] * n
for i in range(n):
	p[i] = input()
last_occurance = {}
for i in range(n):
	last_occurance[p[i]] = i
r = len(last_occurance)
l1 = list(last_occurance.keys())
l1.sort(key=lambda x: last_occurance[x])
for i in range(r):
	print(l1[r - 1 - i])


from sys import stdin
input()
arr = stdin.read().splitlines()
st = set()
ans = []
for i in arr[::-1]:
	if not i in st:
		ans.append(i)
		st.add(i)
print('\n'.join(ans))


def main():
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	used = set()
	ans = []
	for i in range(n - 1, -1, -1):
		if a[i] not in used:
			ans.append(a[i])
			used.add(a[i])
	for person in ans:
		print(person)
main()


nomes = [input() for i in range(int(input()))]
nomes.reverse()
lista = set(nomes)
for i in nomes:
	if i in lista:
		print(i)
		lista.remove(i)


import collections
dq = collections.deque()
n = int(input())
for i in range(n):
	x = input()
	dq.appendleft(x)
mp = dict()
for i in range(n):
	if dq[i] not in mp.keys():
		print(dq[i])
		mp[dq[i]] = 1


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	from collections import OrderedDict
	d = OrderedDict()
	n = int(input())
	arr = [0] * n
	for i in range(n):
		arr[i] = input().strip()
	for i in reversed(arr):
		if i not in d:
			d[i] = 1
	print(*d, sep='\n')
main()


n = int(input())
a = []
b = {}
c = {}
for i in range(n):
	a.append(input())
a.reverse()
b = {}
for i in a:
	b[i] = 0
for i in range(n):
	if b[a[i]] == 0:
		print(a[i])
		b[a[i]] = 1


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())
d = {}
for i in range(n):
	s = input()
	if s not in d:
		d[s] = 0
	else:
		del d[s]
		d[s] = 0
ans = list(d.keys())[::-1]
for j in ans:
	print(j)


def main():
	d = {input(): i for i in range(int(input()))}
	print('\n'.join(sorted(d.keys(), key=d.get, reverse=True)))
main()


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


import operator
N = int(input())
D = {input(): -i for i in range(N)}
for (key, value) in sorted(D.items(), key=operator.itemgetter(1)):
	print(key)


n = int(input())
x = []
for _ in range(n):
	x.append(input())
x = x[::-1]
ans = set()
l = len(set(x))
for i in x:
	if len(ans) < l:
		if i not in ans:
			ans.add(i)
			print(i)
	else:
		break


n = int(input())
dic = {}
li = []
for x in range(n):
	temp = input()
	dic[temp] = 0
	li.append(temp)
li.reverse()
for x in li:
	if dic[x] == 0:
		print(x)
		dic[x] = -1


def get_chats(names):
	chats = {}
	for name in reversed(names):
		if name not in chats:
			print(name)
			chats[name] = True
len = int(input())
names = []
for i in range(len):
	names.append(input())
get_chats(names)


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]


from sys import stdin
inp = stdin.readline
n = int(inp())
uniq = set()
chat_list = []
for _ in range(n):
	name = inp().strip()
	uniq.add(name)
	chat_list.append(name)
uniq_len = len(uniq)
uniq.clear()
cur_len = 0
n -= 1
ans = []
while cur_len != uniq_len:
	if chat_list[n] not in uniq:
		ans.append(chat_list[n])
		uniq.add(chat_list[n])
		cur_len += 1
	n -= 1
print('\n'.join(ans))


n = int(input())
a = {}
for i in range(n):
	a[input()] = i
for (name, _) in sorted(a.items(), key=lambda x: -x[1]):
	print(name)