Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.

Each club's full name consist of two words: the team's name and the hometown's name, for example, "DINAMO BYTECITY". Innokenty doesn't want to assign strange short names, so he wants to choose such short names for each club that:   the short name is the same as three first letters of the team's name, for example, for the mentioned club it is "DIN",  or, the first two letters of the short name should be the same as the first two letters of the team's name, while the third letter is the same as the first letter in the hometown's name. For the mentioned club it is "DIB". 

Apart from this, there is a rule that if for some club x the second option of short name is chosen, then there should be no club, for which the first option is chosen which is the same as the first option for the club x. For example, if the above mentioned club has short name "DIB", then no club for which the first option is chosen can have short name equal to "DIN". However, it is possible that some club have short name "DIN", where "DI" are the first two letters of the team's name, and "N" is the first letter of hometown's name. Of course, no two teams can have the same short name.

Help Innokenty to choose a short name for each of the teams. If this is impossible, report that. If there are multiple answer, any of them will suit Innokenty. If for some team the two options of short name are equal, then Innokenty will formally think that only one of these options is chosen. 


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of clubs in the league.

Each of the next n lines contains two words — the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20.


-----Output-----

It it is not possible to choose short names and satisfy all constraints, print a single line "NO".

Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input.

If there are multiple answers, print any of them.


-----Examples-----
Input
2
DINAMO BYTECITY
FOOTBALL MOSCOW

Output
YES
DIN
FOO

Input
2
DINAMO BYTECITY
DINAMO BITECITY

Output
NO

Input
3
PLAYFOOTBALL MOSCOW
PLAYVOLLEYBALL SPB
GOGO TECHNOCUP

Output
YES
PLM
PLS
GOG

Input
3
ABC DEF
ABC EFG
ABD OOO

Output
YES
ABD
ABE
ABO



-----Note-----

In the first sample Innokenty can choose first option for both clubs.

In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.

In the third example Innokenty can choose the second options for the first two clubs, and the first option for the third club.

In the fourth example note that it is possible that the chosen short name for some club x is the same as the first option of another club y if the first options of x and y are different.

Difficulty: MEDIUM

Starter code:

Solutions:
n = int(input())
ans = 0
o = []
p = []
for i in range(n):
	(s, g) = [str(j) for j in input().split()]
	ss = s[0:3]
	gg = s[0:2] + g[0]
	flag = True
	if ss in o:
		flag = False
	o.append(ss)
	if gg in p and ss not in p and flag:
		p.append(ss)
	elif gg not in p:
		p.append(gg)
	else:
		ans = -1
if ans < 0:
	print('NO')
else:
	print('YES')
	for i in p:
		print(i)


n = int(input())
d = dict()
ans = []
arr = []
d2 = dict()
for i in range(n):
	(a, b) = input().split()
	(a1, a2) = (a[:3], a[0] + a[1] + b[0])
	if a1 in d:
		d[a1].append(a2)
	else:
		d[a1] = [a2]
	if a2 in d2:
		d2[a2].append((a1, i))
	else:
		d2[a2] = [(a1, i)]
	ans.append(a2)
	arr.append(a1)
for i in d:
	if len(set(d[i])) != len(d[i]):
		print('NO')
		exit()
for i in d2:
	if len(d2[i]) == 1:
		continue
	new_d = dict()
	for j in d2[i]:
		if j[0] in new_d:
			new_d[j[0]].append(j[1])
		else:
			new_d[j[0]] = [j[1]]
	for j in new_d:
		if len(new_d[j]) > 1:
			print('NO')
			exit()
	change = []
	for j in new_d:
		if len(d[j]) == 1:
			change.append(new_d[j][0])
	if len(change) < len(d2[i]) - 1:
		print('NO')
		exit()
	for j in change:
		ans[j] = arr[j][:]
if len(set(ans)) != len(ans):
	print('NO')
	exit()
print('YES')
print(*ans, sep='\n')


def sol():
	n = int(input())
	club = [''] * n
	city = [''] * n
	mp = {}
	for i in range(n):
		s = input().split()
		club[i] = s[0][:3]
		city[i] = s[1][:1]
		if club[i] in mp:
			mp[club[i]].add(i)
		else:
			mp[club[i]] = set()
			mp[club[i]].add(i)

	def rename(abc, i):
		if abc in name:
			return False
		name[abc] = i
		if abc in mp and len(mp[abc]) == 1:
			for j in mp[abc]:
				if club[j][:2] + city[j] in name:
					return False
				mp[abc].clear()
				return rename(club[j][:2] + city[j], j)
		return True
	for clubname in mp:
		if len(mp[clubname]) > 1:
			for i in mp[clubname]:
				abc = club[i][:2] + city[i]
				if abc in name:
					return False
				if not rename(abc, i):
					return False
	for clubname in mp:
		if len(mp[clubname]) == 1:
			for i in mp[clubname]:
				name[clubname] = i
	return True
name = {}
if sol():
	print('YES')
	l = [''] * len(name)
	for s in name:
		l[name[s]] = s
	for i in range(len(l)):
		print(l[i])
else:
	print('NO')


t = int(input())
(sth, st, s) = ([], [], [])
flag = True
for _ in range(t):
	f = True
	(t, h) = map(str, input().split())
	if t[0:3] in st:
		f = False
	st.append(t[0:3])
	if ~f and t[0:2] + h[0] not in s:
		s.append(t[0:2] + h[0])
	elif f and t[0:2] + h[0] in s and (st[_] not in s):
		s.append(st[_])
	else:
		flag = False
if flag:
	print('YES')
	for _ in s:
		print(_)
else:
	print('NO')


from collections import defaultdict
names = int(input())
inp = [input().split() for x in range(names)]
choice = []
res = defaultdict(lambda : [])
for (x, word) in enumerate(inp):
	choice.append(False)
	res[word[0][:3]].append(x)
while True:
	changes = []
	for key in res.keys():
		if len(res[key]) > 1:
			remove = []
			for (i, index) in enumerate(res[key]):
				if choice[index]:
					continue
				remove.append(i)
				choice[index] = True
				changes.append((inp[index][0][:2] + inp[index][1][0], index))
			for i in remove[::-1]:
				del res[key][i]
	if len(changes) == 0:
		break
	for (word, i) in changes:
		res[word].append(i)
bad = False
for key in res.keys():
	if len(res[key]) > 1:
		bad = True
if bad:
	print('NO')
else:
	print('YES')
	for i in range(names):
		if choice[i]:
			print(inp[i][0][:2] + inp[i][1][0])
		else:
			print(inp[i][0][:3])


from sys import stdin
n = int(stdin.readline().strip())
(T, A) = ([], [])
(N, M) = ({}, {})
for _ in range(n):
	(t, h) = stdin.readline().split()
	(n1, n2) = (t[:3], t[:2] + h[0])
	N[n1] = N.get(n1, 0) + 1
	T.append((n1, n2))
	A.append(n1)

def solve():
	for i in range(n):
		(n1, n2) = T[i]
		if n1 not in M and N[n1] == 1:
			M[n1] = i
			continue
		while n2 in M:
			j = M[n2]
			if n2 == T[j][1]:
				return False
			(M[n2], A[i]) = (i, n2)
			(i, n2) = (j, T[j][1])
		else:
			(M[n2], A[i]) = (i, n2)
	return True
if solve():
	print('YES')
	print('\n'.join(A))
else:
	print('NO')


n = int(input())
first = {}
second = set()
s1 = [0] * n
ans = [0] * n
for i in range(n):
	(a, b) = input().split()
	a = a[:3]
	b = b[0]
	s1[i] = b
	if a in first.keys():
		first[a].append(i)
	else:
		first[a] = [i]
		ans[i] = a
F = True
for name in first.keys():
	if not F:
		break
	if len(first[name]) > 1:
		for i in first[name]:
			c = name[:2] + s1[i]
			if c in second:
				F = False
				break
			else:
				second.add(c)
				ans[i] = c
		first[name] = 0

def process(name):
	global F
	if F == False:
		return
	if first[name] != 0 and name in second:
		t = first[name][0]
		c = name[:2] + s1[t]
		if c in second:
			F = False
			return
		else:
			second.add(c)
			ans[t] = c
			first[name] = 0
			if c in first.keys() and first[c] != 0:
				process(c)
for name in first.keys():
	process(name)
if F:
	print('YES')
	for i in range(n):
		print(ans[i])
else:
	print('NO')