Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card.

Before the game Petya will choose an integer and after that Vasya will choose another integer (different from the number that Petya chose). During the game each player takes all the cards with number he chose. For example, if Petya chose number 5 before the game he will take all cards on which 5 is written and if Vasya chose number 10 before the game he will take all cards on which 10 is written.

The game is considered fair if Petya and Vasya can take all n cards, and the number of cards each player gets is the same.

Determine whether Petya and Vasya can choose integer numbers before the game so that the game is fair. 


-----Input-----

The first line contains a single integer n (2 ≤ n ≤ 100) — number of cards. It is guaranteed that n is an even number.

The following n lines contain a sequence of integers a_1, a_2, ..., a_{n} (one integer per line, 1 ≤ a_{i} ≤ 100) — numbers written on the n cards.


-----Output-----

If it is impossible for Petya and Vasya to choose numbers in such a way that the game will be fair, print "NO" (without quotes) in the first line. In this case you should not print anything more.

In the other case print "YES" (without quotes) in the first line. In the second line print two distinct integers — number that Petya should choose and the number that Vasya should choose to make the game fair. If there are several solutions, print any of them.


-----Examples-----
Input
4
11
27
27
11

Output
YES
11 27

Input
2
6
6

Output
NO

Input
6
10
20
30
20
10
20

Output
NO

Input
6
1
1
2
2
3
3

Output
NO



-----Note-----

In the first example the game will be fair if, for example, Petya chooses number 11, and Vasya chooses number 27. Then the will take all cards — Petya will take cards 1 and 4, and Vasya will take cards 2 and 3. Thus, each of them will take exactly two cards.

In the second example fair game is impossible because the numbers written on the cards are equal, but the numbers that Petya and Vasya should choose should be distinct.

In the third example it is impossible to take all cards. Petya and Vasya can take at most five cards — for example, Petya can choose number 10 and Vasya can choose number 20. But for the game to be fair it is necessary to take 6 cards.

Difficulty: EASY
Tags: Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
n = int(input())
a = [int(input()) for _ in range(n)]
cnt = {}
for ai in a:
	if ai in cnt:
		cnt[ai] += 1
	else:
		cnt[ai] = 1
ans = []
for (k, v) in cnt.items():
	if v * 2 == n:
		ans.append(k)
if len(cnt) != 2:
	ans = []
if len(ans) == 2:
	print('YES')
	print(' '.join(map(str, ans)))
else:
	print('NO')


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

def prog():
	for i in range(n):
		a = int(input())
		if a in nums:
			nums[a] += 1
		else:
			nums[a] = 1
		if len(nums) > 2:
			print('NO')
			return
	if len(nums) != 2:
		print('NO')
	elif list(nums.values())[0] == n // 2:
		print('YES')
		print(*nums.keys())
	else:
		print('NO')
prog()


n = int(input())
a = []
for i in range(n):
	a += [int(input())]
l = list(set(a))
if len(l) == 1 or len(l) >= 3:
	print('NO')
elif a.count(l[0]) == a.count(l[1]):
	print('YES')
	print(l[0], l[1])
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
p = []
for i in range(n):
	if a[i] not in p:
		p.append(a[i])
if len(p) == 2 and a.count(p[0]) == a.count(p[1]):
	print('YES')
	print(p[0], p[1])
else:
	print('NO')


ss = int(input())
a = [int(input()) for i in range(ss)]
s = set(list(a))
if len(set(a)) != 2:
	print('NO')
elif a.count(a[0]) != ss / 2:
	print('NO')
else:
	print('YES')
	print(*s)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

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

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

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = [2]
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(3, limit + 1, 2):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	l = [inp() for i in range(n)]
	s = set(l)
	if len(s) == 2:
		x = list(s)
		if l.count(x[0]) == l.count(x[1]):
			print('YES')
			print(*x)
		else:
			print('NO')
	else:
		print('NO')
for _ in range(1):
	solve()


a = int(input())
b = []
k = []
for i in range(a):
	c = input()
	if c not in b:
		b.append(c)
	k.append(c)
if len(b) == 2 and k.count(b[0]) == k.count(b[1]):
	print('YES')
	print(str(b[0]) + ' ' + str(b[1]))
else:
	print('NO')


n = int(input())
S = list()
for i in range(n):
	S.append(int(input()))
if len(set(S)) == 2:
	if S.count(list(set(S))[0]) == S.count(list(set(S))[1]):
		print('YES')
		print(*sorted(set(S)))
		exit()
print('NO')


n = int(input())
l = []
for _ in range(n):
	l.append(input())
if len(set(l)) != 2:
	print('NO')
else:
	t = list(set(l))
	if l.count(t[0]) == l.count(t[1]):
		print('YES')
		print(t[0], t[1])
	else:
		print('NO')


nt = int(input())
a = []
for i in range(nt):
	a.append(int(input()))
c = set(a)
c = list(c)
l = len(c)
x = 0
y = 0
if l == 2:
	for i in range(nt):
		if a[i] == c[0]:
			x = x + 1
		elif a[i] == c[1]:
			y = y + 1
	if x == nt // 2 and y == nt // 2:
		print('YES')
		for j in c:
			print(j, end=' ')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
d = dict()
for i in range(n):
	a = int(input())
	d[a] = d.get(a, 0) + 1
ar = list(d.values())
if len(ar) == 2 and ar[0] == ar[1]:
	print('YES')
	print(*list(d.keys()))
else:
	print('NO')


num = int(input())
d = {}
a = []
for _ in range(num):
	card = int(input())
	if card not in d:
		d[card] = 1
		a.append(card)
	else:
		d[card] = d[card] + 1
if len(d) == 2 and d[a[0]] == d[a[1]]:
	print('YES')
	print(a[0], a[1])
else:
	print('NO')


def bubble(list_1):
	for i in range(len(list_1) - 1):
		for j in range(len(list_1) - 1 - i):
			if list_1[j] > list_1[j + 1]:
				(list_1[j], list_1[j + 1]) = (list_1[j + 1], list_1[j])
	return list_1
n = int(input())
p = []
for i in range(n):
	p.append(int(input()))
p = bubble(p)
p1 = p[0]
p2 = p[-1]
if p1 != p2 and p.count(p1) == p.count(p2) and (p.count(p1) + p.count(p2) == n):
	print('YES')
	print(p1, p2)
else:
	print('NO')


n = int(input())
m = []
for i in range(n):
	m.append(input())
c = set(m)
if len(c) == 2 and m.count(m[0]) * 2 == len(m):
	print('YES')
	print(' '.join(c))
else:
	print('NO')


from collections import Counter
n = int(input())
cnt = Counter()
for _ in range(n):
	cnt[int(input())] += 1
if len(cnt) != 2:
	print('NO')
	exit(0)
numbers = []
counts = []
for (k, v) in cnt.items():
	numbers.append(k)
	counts.append(v)
if counts[0] != counts[1]:
	print('NO')
	exit(0)
print('YES')
print(*sorted(numbers))


A = []
n = int(input())
for i in range(n):
	A.append(int(input()))
if len(set(A)) == 2 and A.count(min(A)) == A.count(max(A)):
	print('YES')
	print(min(A), max(A))
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
x = a[0]
y = 0
b = 0
for i in range(n):
	if i != 0:
		if a[i] != x and y == 0:
			y = a[i]
		elif a[i] != x and a[i] != y:
			b = 1
			break
if b == 1 or y == 0:
	print('NO')
elif a.count(x) == a.count(y):
	print('YES')
	print(x, y)
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for x in a:
	for y in a:
		if x != y:
			x_count = a.count(x)
			y_count = a.count(y)
			if x_count == y_count and x_count + y_count == n:
				print('YES\n%d %d' % (x, y))
				exit()
print('NO')


arr = []
for qq in range(int(input())):
	n = int(input())
	arr.append(n)
n = len(arr)
arr1 = set(arr)
arr1 = list(arr1)
if len(arr1) == 2 and arr.count(arr1[0]) == n // 2 and (arr.count(arr1[1]) == n // 2):
	print('YES')
	print(arr1[0], arr1[1])
else:
	print('NO')


a = []
n = int(input())
for i in range(n):
	a.append(int(input()))
b = 0
c = a[0]
if a.count(c) == n:
	print('NO')
	quit()
if len(set(a)) == 2:
	for i in range(1, n):
		if a[i] != c:
			b = a[i]
if a.count(c) + a.count(b) == n and a.count(c) == a.count(b):
	print('YES')
	print(c)
	print(b)
else:
	print('NO')


n = int(input())
d = list()
for _ in range(n):
	d.append(int(input()))
d.sort()
if len(set(d)) == 2 and len(d) % 2 == 0:
	if d.count(d[0]) == len(d) // 2:
		print('YES')
		print(d[0], d[len(d) // 2])
		exit(0)
print('NO')


t = []
for i in range(int(input())):
	t.append(int(input()))
s = list(set(t))
s.sort()
if len(s) == 2:
	if t.count(s[0]) == len(t) // 2 and t.count(s[1]) == len(t) // 2:
		print('YES')
		print(*s)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
lis = []
for i in range(n):
	x = int(input())
	lis.append(x)
yo = list(set(lis))
if len(yo) == 2 and lis.count(yo[0]) == lis.count(yo[1]):
	print('YES')
	print(yo[0], yo[1])
else:
	print('NO')


n = int(input())
import collections
c = collections.Counter()
for i in range(n):
	c[int(input())] += 1
a = list(c.keys())
if len(a) == 2 and c[a[0]] == c[a[1]]:
	print('YES')
	print(a[0], a[1])
else:
	print('NO')


n = int(input())
l = n * [0]
for i in range(n):
	l[i] = int(input())
if len(set(l)) == 2:
	if l.count(list(set(l))[0]) == l.count(list(set(l))[1]):
		print('YES')
		print(list(set(l))[0], list(set(l))[1])
	else:
		print('NO')
else:
	print('NO')


from collections import defaultdict
n = int(input())
arr = []
nums = set()
f = defaultdict(int)
for _ in range(n):
	arr.append(int(input()))
if n % 2 == 1:
	print('NO')
	exit()
for num in arr:
	nums.add(num)
	f[num] += 1
	if len(nums) > 2:
		print('NO')
		exit()
nums = list(nums)
if len(nums) == 2:
	if f[nums[0]] == f[nums[1]]:
		print('YES')
		print(nums[0], nums[1])
		exit()
print('NO')


n = int(input())
l = []
l1 = [0, 0]
for i in range(n):
	d = input()
	if d not in l:
		l.append(d)
		if len(l) > 2:
			print('NO')
			exit()
	else:
		l1[l.index(d)] += 1
if len(l) % 2 == 0 and l1[0] == l1[1]:
	print('YES')
	print(*l)
else:
	print('NO')


t = sorted((input() for i in range(int(input()))))
print(['NO', 'YES\n' + t[0] + ' ' + t[-1]][len(t) // 2 == t.count(t[0]) == t.count(t[-1])])


n = int(input())
a = [int(input()) for i in range(n)]
a_dict = {}
for x in a:
	if x in a_dict:
		a_dict[x] += 1
	else:
		a_dict[x] = 1
if len(a_dict) == 2 and max(a_dict.values()) == min(a_dict.values()):
	print('YES')
	print(*a_dict.keys())
else:
	print('NO')


map = {}
n = int(input())
for i in range(n):
	tmp = int(input())
	if tmp in map:
		map[tmp] += 1
	else:
		map.setdefault(tmp, 1)
if len(map) != 2:
	print('NO')
else:
	keys = list(map.keys())
	if map[keys[0]] == map[keys[1]]:
		print('YES')
		print(keys[0], keys[1])
	else:
		print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
if a.count(a[0]) == a.count(a[n - 1]) == n / 2:
	print('YES')
	print(a[0], a[n - 1])
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	z = int(input())
	a.append(str(z))
p = list(set(a))
if len(p) != 2:
	print('NO')
elif a.count(p[0]) != a.count(p[1]):
	print('NO')
else:
	print('YES')
	print(' '.join(p))


a = sorted((int(input()) for i in range(int(input()))))
print('NO' if len(set(a)) - 2 or a.count(a[0]) - a.count(a[-1]) else 'YES\n%d %d' % (a[0], a[-1]))


n = int(input())
a = [int(input()) for _ in range(n)]
s = set(a)
if len(s) == 2:
	s = list(s)
	if a.count(s[0]) == a.count(s[1]):
		print('YES')
		print(' '.join(map(str, s)))
	else:
		print('NO')
else:
	print('NO')


def main():
	n = int(input())
	dic = {}
	bol = False
	for i in range(n):
		inp = int(input())
		if inp in dic:
			dic[inp] += 1
		else:
			dic[inp] = 1
	for i in dic:
		for j in dic:
			if dic[i] == dic[j] and i != j and (dic[i] + dic[j] == n):
				print('YES')
				print(i, j)
				bol = True
				break
		if bol:
			break
	if bol == False:
		print('NO')
main()


i = int(input())
c = [0] * 101
for x in range(i):
	c[int(input())] += 1
l = len(set(c))
if l == 2 and len([x for x in c if x != 0]) == 2:
	print('YES')
	for x in set(c):
		if c.count(x) > 1 and x:
			red = [i for (i, _) in enumerate(c) if _ == x]
			print(red[0], red[1])
			break
else:
	print('NO')


n = int(input())
x = []
for i in range(n):
	x.append(int(input()))
x.sort()
y = list(set(x))
z = []
for i in range(len(y)):
	z.append(x.count(y[i]))
if len(y) != 2 or z[0] != z[1]:
	print('NO')
else:
	print('YES')
	print(*y)


def fair(cards):
	distinct = list(set(cards))
	if len(distinct) != 2:
		return 'NO'
	first = len(list(filter(lambda x: x == distinct[0], cards)))
	if first == len(cards) // 2:
		return 'YES\n{} {}'.format(distinct[0], distinct[1])
	return 'NO'
n = int(input())
mycards = []
for i in range(n):
	mycards.append(int(input()))
print(fair(mycards))


n = int(input())
l = []
for i in range(n):
	x = int(input())
	l.append(x)
a = set(l)
if len(a) != 2:
	print('NO')
else:
	a = list(a)
	if l.count(a[0]) == l.count(a[1]):
		print('YES')
		for i in a:
			print(i, end=' ')
	else:
		print('NO')


from collections import Counter
n = int(input())
c = list()
for i in range(n):
	c.append(int(input()))
c = Counter(c)
d = dict()
for k in c:
	v = c[k]
	if d.get(v, -1) != -1:
		d[v].append(k)
	else:
		d[v] = [k]
fl = False
for k in d:
	v = d[k]
	if len(v) > 1 and len(d) == 1 and (len(v) == 2):
		fl = True
		print('YES')
		print(*v)
		break
if not fl:
	print('NO')


n = int(input())
a = []
for i in range(n):
	t = int(input())
	a.append(t)
a.sort()
i = 0
if a.count(a[0]) == len(a) or n % 2 != 0:
	print('NO')
else:
	k = a.count(a[i])
	l = a.count(a[i + k])
	if k != l or k + l != n:
		print('NO')
	else:
		print('YES')
		print(a[0], end=' ')
		print(a[i + k])


def fair_game():
	total = int(input())
	cards = []
	for i in range(total):
		cards.append(int(input()))
	dic = {}
	for i in range(len(cards)):
		if cards[i] not in dic:
			if len(dic) == 0:
				first = cards[i]
			if cards[i] != first:
				second = cards[i]
			dic[cards[i]] = 1
			if len(dic) >= 3:
				print('NO')
				return
		else:
			dic[cards[i]] += 1
	if len(dic) == 1:
		print('NO')
	elif dic[first] == dic[second]:
		print('YES')
		print(first, second)
	else:
		print('NO')
check = fair_game()
20
20
30
30
20
20
20
30
30
20
20
30
30
30
30
20
30
30
30
30
20
20
30
30
30
20
30
20
30
20
30
20
20
20
30
20
20
20
30
30


import math

def ria():
	return [int(i) for i in input().split()]
n = ria()[0]
mp = {}
for i in range(n):
	a = ria()[0]
	if a not in mp:
		mp[a] = 0
	mp[a] += 1
for i in mp:
	for j in mp:
		if i != j and mp[i] == mp[j] and (len(mp) == 2):
			print('YES\n%s %s' % (i, j))
			exit(0)
print('NO')


n = int(input().strip())
n_array = {}
fair = True
for x in range(n):
	val = input().strip()
	if val in n_array:
		n_array[val] += 1
	else:
		n_array[val] = 1
if len(n_array) != 2:
	fair = False
val_array = []
for key in n_array:
	val_array.append(key)
	if n_array[key] != n_array[val]:
		fair = False
if fair:
	print('YES')
	print(val_array[0] + ' ' + val_array[1])
else:
	print('NO')


Input = lambda : map(int, input().split())
Tmp = dict()
for i in range(int(input())):
	a = int(input())
	if Tmp.get(a, -1) == -1:
		Tmp[a] = 1
	else:
		Tmp[a] += 1
if len(Tmp) == 2:
	(a, b) = Tmp.values()
	if a == b:
		print('YES')
		print(*Tmp.keys())
	else:
		print('NO')
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
f = True
for i in range(n):
	if l.count(l[i]) != n // 2:
		f = False
		break
if f:
	print('YES')
	s = str(l[0]) + ' '
	for i in range(1, n):
		if l[i] != l[0]:
			s += str(l[i])
			break
	print(s)
else:
	print('NO')


def isTrusty(arr):
	if len(arr) % 2 == 1:
		print('NO')
		return
	for a in arr:
		if listing.get(a) == None:
			listing.update({a: 1})
		else:
			listing[a] += 1
	if len(listing) != 2:
		print('NO')
		return
	else:
		dictKeys = []
		for i in listing.keys():
			dictKeys.append(i)
		if listing[dictKeys[0]] == listing[dictKeys[1]]:
			print('YES')
			print(dictKeys[0] + ' ' + dictKeys[1])
		else:
			print('NO')
n = int(input())
nums = []
listing = {}
i = 0
while i < n:
	nums.append(input())
	i += 1
isTrusty(nums)


n = int(input())
b = [0] * 101
for i in range(n):
	a = int(input())
	b[a] += 1
l = 0
r = 0
if b.count(0) != 99:
	print('NO')
else:
	for i in range(len(b)):
		if b[i] > 0:
			if l != 0:
				r = i
			else:
				l = i
	if b[l] == b[r]:
		print('YES')
		print(l, r)
	else:
		print('NO')


import math
import collections
import bisect
import heapq
import time
import random
N = int(input())
nums = []
for i in range(N):
	nums.append(input())
snums = set(nums)
if len(snums) > 2:
	print('NO')
else:
	lsnums = list(snums)
	if nums.count(lsnums[0]) == len(nums) // 2:
		print('YES')
		print(lsnums[0], lsnums[1])
	else:
		print('NO')


from collections import Counter
n = int(input())
cards = [int(input()) for _ in range(n)]
cnt = Counter(cards)
keys = list(cnt.keys())
if len(keys) == 2 and cnt[keys[0]] == cnt[keys[1]]:
	print('YES')
	print(*keys)
else:
	print('NO')


SIZE = 100
cnt = [0] * SIZE
num = []
for i in range(SIZE):
	num.append(i)
for i in range(int(input())):
	cnt[int(input()) - 1] += 1
res = list(zip(cnt, num))
res.sort(reverse=True)
if res[0][0] != res[1][0] or res[2][0] != 0:
	print('NO')
else:
	print('YES')
	print(res[0][1] + 1, ' ', res[1][1] + 1)


n = int(input())
cards = []
for i in range(n):
	cards.append(int(input()))
card_set = set(cards)
if len(card_set) == 2:
	(a, b) = card_set
	if cards.count(a) == cards.count(b):
		print('YES')
		for item in card_set:
			print(item, end=' ')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = []
d = []
j = 0
for i in range(n):
	k = int(input())
	a.append(k)
	if k not in d:
		d.append(k)
		j = j + 1
q = 0
w = 0
if j != 2:
	print('NO')
else:
	z = d[0]
	x = d[1]
	for i in range(n):
		if a[i] == z:
			q = q + 1
		if a[i] == x:
			w = w + 1
	if w != q:
		print('NO')
	else:
		print('YES')
		print(d[0], d[1])


n = int(input())
storage = [0 for _ in range(0, 101)]
cnt = 0
for a in range(0, n):
	card = int(input())
	storage[card] += 1
	if storage[card] == 1:
		cnt += 1
if cnt != 2:
	print('NO')
else:
	flag = 0
	for a in range(0, 101):
		if storage[a] != 0:
			if storage[a] != n // 2:
				print('NO')
				break
			elif storage[a] == n // 2:
				if flag == 0:
					print('YES')
					print(a, end=' ')
					flag = 1
				else:
					print(a)
					break


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a.sort()
vasya = a[0]
i = 1
k = n // 2
petya = a[k]
k += 1
cnt = 1
cnt1 = 1
for i in range(1, n // 2):
	if a[i] == vasya:
		cnt += 1
	if a[k] == petya:
		cnt1 += 1
	k += 1
if cnt == cnt1 and vasya != petya and (cnt + cnt1 == n):
	print('YES')
	print(vasya, petya, end=' ')
else:
	print('NO')


n = int(input())
c = []
for k in range(n):
	x = int(input())
	c.append(x)
lista = list(set(c))
a = []
for k in range(len(lista)):
	veces = c.count(lista[k])
	a.append(veces)
y = 0
for k in range(len(a)):
	for j in range(k + 1, len(a)):
		if a[k] == a[j] and a[k] + a[j] == n:
			y = 1
			b = lista[k]
			m = lista[j]
			break
if y == 1:
	print('YES')
	print(str(b) + ' ' + str(m))
else:
	print('NO')


num_cards = input()
number_list = []
number = 0
while number < int(num_cards):
	numbers = input()
	number_list.append(numbers)
	number += 1
distinct_elements = 1
first_elem = sorted(number_list)[0]
second_elem = first_elem
count = 0
count2 = 0
for i in number_list:
	if distinct_elements > 2:
		count2 = -1
		break
	elif first_elem == i:
		count = count + 1
	elif second_elem == i:
		count2 = count2 + 1
	else:
		second_elem = i
		count2 = count2 + 1
		distinct_elements += 1
if count == count2:
	print('YES')
	print(first_elem + ' ' + second_elem)
else:
	print('NO')


dic = dict()
for i in range(int(input())):
	tst = input()
	dic[tst] = dic.get(tst, 0) + 1
l = list(dic.values())
if len(dic) == 2 and l[0] == l[1]:
	print('Yes')
	print(*dic.keys())
else:
	print('No')


n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
b = [ai for ai in a if ai == a[0]]
c = [ai for ai in a if ai != a[0]]
if len(b) == len(c) and c[0] == c[-1]:
	print('YES')
	print(b[0], c[0])
else:
	print('NO')


n = int(input())
arr = []
ans = True
s = set()
for i in range(n):
	a = int(input())
	arr.append(a)
	s.add(a)
if len(s) != 2:
	print('NO')
else:
	p = []
	for i in s:
		p.append(arr.count(i))
	if p[0] == p[1]:
		print('YES')
		print(' '.join(list(map(str, s))))
	else:
		print('NO')


r = int(input())
b = []
for i in range(r):
	b.append(input())
c = list(set(b))
if int(len(c)) == 2:
	if int(b.count(c[0])) == int(b.count(c[-1])):
		print('YES')
		print(int(c[0]), int(c[-1]))
	else:
		print('NO')
else:
	print('NO')


n = int(input())
first = second = -1
firstc = secondc = 0
for _ in range(n):
	x = int(input())
	if x == first:
		firstc += 1
	elif x == second:
		secondc += 1
	elif first == -1:
		first = x
		firstc = 1
	elif second == -1:
		second = x
		secondc = 1
if firstc == secondc and firstc + secondc == n:
	print('YES')
	print(first, second)
else:
	print('NO')


n = int(input())
u = []
for i in range(n):
	u += [input()]
S = set(u)
S = list(S)
if len(S) == 2 and u.count(S[0]) == u.count(S[1]):
	print('YES')
	print(*S)
else:
	print('NO')


n = int(input())
l = [0] * n
for i in range(n):
	l[i] = int(input())
k = sorted(set(l))
if len(k) == 2:
	(a, b) = (k[0], k[1])
	if l.count(a) == l.count(b):
		print('YES')
		print(a, b)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
array_1 = []
array_2 = []
for i in range(0, n):
	a = input()
	if (a in array_1) == False:
		array_1.append(a)
		array_2.append(1)
	else:
		array_2[array_1.index(a)] += 1
if len(array_1) == 2 and array_2[0] == array_2[1]:
	print('YES')
	print(str(array_1[0]) + ' ' + str(array_1[1]))
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
s = set(a)
if len(s) != 2:
	print('NO')
	return
b = list(s)
if a.count(b[0]) == a.count(b[1]):
	print('YES')
	print(b[0], b[1])
else:
	print('NO')


n = int(input())
h = dict()
for i in range(n):
	x = int(input())
	if x in h:
		h[x] += 1
	else:
		h.update({x: 1})
if len(h) == 2:
	res = list()
	for (k, v) in h.items():
		if 2 * v == n:
			res.append(k)
	if len(res) == 2:
		print('YES')
		print(' '.join(map(str, res)))
		exit(0)
print('NO')


n = int(input())
l = []
for i in range(n):
	x = int(input())
	l.append(x)
l.sort()
if len(set(l)) != 2:
	print('NO')
elif len(set(l)) == 2:
	if l[int(n / 2) - 1] == l[int(n / 2)]:
		print('NO')
	else:
		print('YES')
		print(l[0], l[len(l) - 1])


n = int(input())
l = []
for i in range(n):
	a = int(input())
	l.append(a)
s = list(set(l))
s.sort()
if len(set(l)) != 2:
	print('NO')
else:
	a = l.count(s[0])
	b = l.count(s[1])
	if a == b:
		print('YES')
		print(s[0], s[1])
	else:
		print('NO')


from sys import stdin, stderr, maxsize
mod = int(1000000000.0) + 7

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
from collections import Counter, defaultdict
from itertools import permutations
import re

def bark():
	n = I()
	d = Counter([I() for i in range(n)])
	if len(d.values()) == 2 and len(set(d.values())) == 1 and (len(d.keys()) == 2):
		print('YES')
		print(*d.keys())
	else:
		print('NO')
bark()


n = int(input())
a = []
for x in range(n):
	a.append(int(input()))
if len(set(a)) == 2 and a.count(a[0]) == n // 2:
	print('YES')
	print(*set(a))
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	c = collections.Counter([I() for _ in range(n)])
	if len(c) != 2 or list(c.values())[0] != n // 2:
		return 'NO'
	return 'YES\n{}'.format(' '.join(map(str, c.keys())))
print(main())


from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(n):
	tmp = int(input())
	d[tmp] += 1
if len(d) != 2:
	print('NO')
	exit()
l = list(d.items())
if l[0][1] != l[1][1]:
	print('NO')
else:
	print('YES')
	print(l[0][0], l[1][0])


n = int(input())
h = {}
for i in range(n):
	a = int(input())
	if a not in h:
		h[a] = 0
	h[a] += 1
if len(h) != 2:
	print('NO')
elif h[a] != n // 2:
	print('NO')
else:
	print('YES')
	ans = []
	for k in h:
		ans.append(k)
	print(' '.join([str(i) for i in ans]))


n = int(input())
one = None
one_count = 0
two = None
two_count = 0
for _ in range(n):
	x = int(input())
	if one == None:
		one = x
	elif two == None and x != one:
		two = x
	if x == one:
		one_count += 1
	elif x == two:
		two_count += 1
	else:
		print('NO')
		exit()
print('YES\n%d %d' % (one, two) if one_count == two_count else 'NO')


n = int(input())
num1 = 0
num2 = 0
num1Count = 0
num2Count = 0
done = False
lst = []
for i in range(0, n):
	lst.append(int(input()))
num1 = lst[0]
for i in lst:
	if i != num1:
		num2 = i
		break
if not done:
	for i in lst:
		if i == num1:
			num1Count += 1
		elif i == num2:
			num2Count += 1
		else:
			print('NO')
			done = True
			break
if not done:
	if num1Count == num2Count:
		print('YES')
		print(num1, num2)
	else:
		print('NO')


def main(n):
	mat = [0] * 101
	for i in range(n):
		s = input()
		mat[int(s)] += 1
	sat = [i for i in range(101) if mat[i] == n // 2]
	if len(sat) > 1:
		return 'YES\n' + str(sat[0]) + ' ' + str(sat[1])
	else:
		return 'NO'
print(main(int(input())))


import sys
count = int(sys.stdin.readline())
counts = {}
for i in range(count):
	number = int(sys.stdin.readline())
	counts[number] = counts.get(number, 0) + 1
if len(counts) == 2:
	numbers = list(counts.keys())
	if counts[numbers[0]] == counts[numbers[1]]:
		print('YES')
		print(numbers[0], numbers[1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
ma = []
dic = {}
for i in range(n):
	temp = int(input())
	if temp not in ma:
		ma.append(temp)
		dic[temp] = 1
	else:
		dic[temp] += 1
if len(ma) != 2:
	print('NO')
elif dic[ma[0]] != dic[ma[1]]:
	print('NO')
else:
	print('YES')
	print(ma[0], ma[1])


kolvo = int(input())
a = []
for i in range(kolvo):
	a.append(int(input()))
if len(set(a)) == 2:
	b = {}
	for i in set(a):
		b[i] = 0
	for key in b.keys():
		for i in a:
			if i == key:
				b[key] += 1
	c = []
	for value in b.values():
		c.append(value)
	if len(set(c)) == 1:
		print('YES')
		d = []
		for key in b.keys():
			d.append(key)
		print('{0} {1}'.format(d[0], d[1]))
	else:
		print('NO')
else:
	print('NO')


a = [int(x) for x in input().split()]
lines = []
while a[0]:
	a[0] = a[0] - 1
	line = int(input())
	if line:
		lines.append(line)
	else:
		break
s = set(lines)
l = list(s)
i1 = i2 = 0
for i in range(len(lines)):
	if lines[i] == l[0]:
		i1 = i1 + 1
	else:
		i2 = i2 + 1
if i1 == i2 and len(s) == 2:
	print('Yes')
	print(l[0], l[1])
else:
	print('No')


import sys
import os
import math
import re
n = int(input())
dist = 0
cards = []
firstCard = 0
secondCard = 0
for _ in range(n):
	a = int(input())
	if firstCard == 0:
		firstCard = a
	elif secondCard == 0 and firstCard != 0 and (firstCard != a):
		secondCard = a
	if not a in cards:
		dist += 1
	cards.append(a)
if dist > 2:
	print('NO')
	exit(0)
if firstCard == 0 or secondCard == 0 or firstCard == secondCard:
	print('NO')
	exit(0)
if cards.count(firstCard) == cards.count(secondCard):
	print('YES')
	print(firstCard)
	print(secondCard)
else:
	print('NO')


n = int(input())
s = set()
arr = []
for _ in range(n):
	arr.append(int(input()))
	s.add(arr[-1])
if len(s) != 2:
	print('NO')
else:
	(x, y) = s
	if arr.count(x) == arr.count(y):
		print('YES')
		print(y, x)
	else:
		print('NO')


n = int(input())
l = [int(input()) for i in range(n)]
distinct = set(l)
if len(distinct) == 2:
	distinct_list = list(distinct)
	if l.count(distinct_list[0]) == l.count(distinct_list[1]):
		print('YES')
		for d in distinct:
			print(str(d) + ' ', end='')
		print()
	else:
		print('NO')
else:
	print('NO')


n = int(input())
d = {}
lis = []
for i in range(n):
	a = int(input())
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
		lis.append(a)
if len(d) == 2:
	if d[lis[0]] == d[lis[1]]:
		print('YES')
		for i in d:
			print(i, end=' ')
		exit()
print('NO')


n = int(input())
a = [int(input()) for _ in range(n)]
a1 = list(set(a))
if len(a1) == 2 and a.count(a1[0]) == a.count(a1[1]):
	print('YES')
	print(*a1)
else:
	print('NO')


from collections import Counter
n = int(input())
a = Counter()
for _ in range(n):
	a[int(input())] += 1
try:
	(x, y) = (a.popitem(), a.popitem())
except KeyError:
	print('NO')
	return
if not a and x[1] == y[1]:
	print('YES')
	print(x[0], y[0])
else:
	print('NO')


from collections import defaultdict
n = int(input())
freq = defaultdict(int)
for i in range(n):
	a = int(input())
	freq[a] += 1
if len(freq) != 2 or len(set(freq.values())) != 1:
	print('NO')
else:
	print('YES')
	tmp = list(freq.keys())
	print(tmp[0], tmp[1])


n = int(input())
l = []
for i in range(n):
	s = int(input())
	l.append(s)
l.sort()
need = True
if l[0] != l[(n - 1) // 2]:
	print('NO')
	need = False
elif l[(n - 1) // 2 + 1] != l[n - 1]:
	print('NO')
	need = False
elif l[0] == l[n - 1]:
	print('NO')
	need = False
else:
	print('YES')
	print(l[0], end=' ')
	print(l[n - 1])


def solve():
	n = int(input())
	cards = {}
	for _ in range(n):
		c = int(input())
		if c not in cards and len(cards) == 2:
			print('NO')
			return
		elif c not in cards:
			cards[c] = 0
		cards[c] += 1
	for c in cards:
		for d in cards:
			if c != d and cards[c] == cards[d]:
				print('YES')
				print(c, d)
				return
	print('NO')
solve()


cardnum = int(input())
card = []
card_dict = {}
for i in range(cardnum):
	cardPoint = int(input())
	card_dict[cardPoint] = card_dict.get(cardPoint, 0) + 1
if len(card_dict) > 2:
	print('NO')
else:
	point_dict = {}
	for (k, v) in card_dict.items():
		if point_dict.get(v, 0) > 0:
			print('YES')
			print(point_dict[v], k)
			break
		point_dict[v] = k
	else:
		print('NO')


n = int(input())
count = [0] * 101
kinds = set()
for _ in range(n):
	i = int(input())
	count[i] += 1
	kinds.add(i)
if len(kinds) == 2:
	l = list(kinds)
	if count[l[0]] == count[l[1]]:
		print('YES')
		print(l[0], l[1])
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
n = int(input())
c = Counter()
for _ in range(n):
	c[int(input())] += 1
if len(c) != 2 or list(c.values())[0] != list(c.values())[1]:
	print('NO')
else:
	print('YES')
	print(*c.keys())


cnt = int(input())
main_list = []
second_list = []
main_dict = {}
x = 0
y = 0
z = 0
for i in range(cnt):
	x = int(input())
	main_list.append(x)
main_set = set(main_list)
if len(main_set) == 1 or len(main_set) >= 3:
	print('NO')
else:
	for i in main_set:
		main_dict[i] = main_list.count(i)
	for i in main_set:
		second_list.append(i)
	for keys in main_dict:
		if keys == second_list[0]:
			y = main_dict.get(keys)
		else:
			z = main_dict.get(keys)
	if y != z:
		print('NO')
	else:
		print('YES')
		print(second_list[0], second_list[1])


n = int(input())
A = []
for i in range(n):
	x = int(input())
	A += [x]
A.sort()
if not A:
	print('YES')
elif len(set(A)) != 2:
	print('NO')
elif A[n // 2] == A[n // 2 - 1]:
	print('NO')
else:
	print('YES')
	print(str(A[0]) + ' ' + str(A[-1]))


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
if len(set(l)) != 2:
	print('NO')
elif l.count(max(l)) == l.count(min(l)):
	print('YES')
	print(str(max(l)) + ' ' + str(min(l)))
else:
	print('NO')


n = int(input())
a = set()
cnt = 0
cur = 0
for i in range(n):
	if i == 0:
		cur = int(input())
		cnt += 1
		a.add(cur)
	else:
		t = int(input())
		if t == cur:
			cnt += 1
		a.add(t)
if 2 * cnt == n and len(a) == 2:
	print('YES')
	for i in a:
		print(i, end=' ')
else:
	print('NO')


x = int(input())
j = []
for i in range(x):
	j += [int(input())]
a = j[0]
for i in range(1, x):
	if j[0] != j[i]:
		b = j[i]
		break
if len(set(j)) == 2 and j.count(a) == x // 2 and (j.count(b) == x // 2):
	print('YES')
	print(a, b)
else:
	print('NO')


n = int(input())

def find(n):
	seen = {}
	lst = []
	for i in range(n):
		j = int(input())
		lst.append(j)
	newlst = []
	for i in lst:
		if i not in seen:
			newlst.append(i)
			seen[i] = True
	if len(newlst) != 2:
		print('NO')
		return
	count1 = 0
	count2 = 0
	for i in newlst:
		for j in lst:
			if i == j and i == newlst[0]:
				count1 += 1
			elif i == j:
				count2 += 1
	if count1 != count2:
		print('NO')
		return
	print('YES')
	for i in newlst:
		print(i, end=' ')
	return
find(n)


n = int(input())
li = []
for _ in range(n):
	li.append(int(input()))
li.sort()
if li[0] == li[n // 2 - 1] and li[n // 2] == li[n - 1] and (li[0] != li[n - 1]):
	print('YES')
	print('{} {}'.format(li[0], li[n - 1]))
else:
	print('NO')


x = []
for i in range(int(input())):
	x.append(int(input()))
y = list(set(x))
if len(y) == 2 and x.count(y[0]) == x.count(y[1]):
	print('YES')
	print(*y)
else:
	print('NO')


def same(d):
	s = set()
	for i in d.keys():
		s.add(d[i])
	if len(s) == 1:
		return True
	else:
		return False
n = int(input())
d = {}
for i in range(n):
	t = int(input())
	if t in d.keys():
		d[t] += 1
	else:
		d[t] = 1
if len(d) == 2 and same(d):
	print('YES')
	for i in d.keys():
		print(i, end=' ')
else:
	print('NO')


n = int(input().strip())
a = []
for i in range(n):
	a.append(int(input().strip()))
b = set(a)
b = list(b)
if len(b) == 2:
	p1 = 0
	p2 = 0
	for i in a:
		if i == b[0]:
			p1 += 1
		elif i == b[1]:
			p2 += 1
	if p1 == p2:
		print('YES')
		print(b[0], b[1])
	else:
		print('NO')
else:
	print('NO')


def main():
	n = int(input())
	o1 = int(input())
	o2 = int(input())
	k = 0
	if o1 == o2:
		o2 = -1
		k = 2
	for i in range(n - 2):
		x = int(input())
		if x == o1:
			k += 1
		elif o2 == -1:
			o2 = x
			k -= 1
		elif o2 == x:
			k -= 1
		else:
			print('NO')
			return
	if o2 == -1:
		print('NO')
		return
	if k != 0:
		print('NO')
		return
	print('YES')
	print(o1, o2)
main()


arr = []
for _ in range(int(input().strip())):
	arr.append(int(input().strip()))
arr.sort()
for i in range(1, len(arr)):
	if arr[i] != arr[i - 1]:
		if i != len(arr) // 2:
			print('NO')
			quit()
		for j in range(i + 1, len(arr)):
			if arr[j] != arr[j - 1]:
				print('NO')
				quit()
		print('YES')
		print(arr[0], arr[-1])
		quit()
print('NO')


n = int(input())
q = []
s = set()
flag = 0
for i in range(n):
	x = int(input())
	q.append(x)
	s.add(x)
if len(s) == 2:
	c = []
	for x in s:
		c.append(q.count(x))
	if c[0] == c[1]:
		flag = 1
if flag:
	print('YES')
	print(' '.join(map(str, s)))
else:
	print('NO')


n = int(input())
c = []
(p, v) = (0, 0)
for i in range(n):
	c.append(int(input()))
	p = c[0]
	if c[i] != p:
		if v == 0 or c[i] == v:
			v = c[i]
if c.count(p) == n:
	print('No')
elif c.count(p) + c.count(v) < n:
	print('No')
elif c.count(p) != c.count(v):
	print('No')
elif c.count(p) == c.count(v):
	print('Yes')
	print(p, v)


import sys

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

def Strs():
	return map(str, sys.stdin.readline().strip().split())

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

def Str():
	return sys.stdin.readline().strip()

def Int():
	return int(sys.stdin.readline().strip())

def MOD():
	return 1000000007

def power(base, power):
	MOD = 1000000007
	result = 1
	while power > 0:
		if power % 2 == 1:
			result = result * base % MOD
		power = power // 2
		base = base * base % MOD
	return result
n = Int()
maps = {}
for i in range(n):
	a = Int()
	maps[a] = maps.get(a, 0) + 1
if len(maps) % 2 or len(maps) > 2:
	print('NO')
else:
	one = two = 0
	flag = 0
	maps = sorted(maps.items(), key=lambda x: x[0])
	for i in maps:
		if not flag:
			one += i[1]
		else:
			two += i[1]
		flag ^= 1
	if one == two:
		print('YES')
		for i in maps:
			print(i[0], end=' ')
	else:
		print('NO')


n = int(input())
d = {}
for i in range(n):
	val = int(input())
	if val in d.keys():
		d[val] += 1
	else:
		d[val] = 1
for i in d.keys():
	for j in d.keys():
		if i == j:
			continue
		if d[i] == d[j]:
			if d[i] + d[j] == n:
				print('YES')
				print(i, j)
				quit()
print('NO')


N = int(input())
L = []
for i in range(0, N):
	L1 = int(input())
	L.append(L1)
D = []
C1 = []
for i in range(0, N):
	if L[i] not in D:
		D.append(L[i])
		C = L.count(L[i])
		C1.append(C)
if len(D) >= 2:
	j = 0
	for i in range(0, len(C1) - 1):
		S = C1[i] + C1[i + 1]
		if S == N and C1[i] == C1[i + 1]:
			j = 1
			a = D[i]
			b = D[i + 1]
			break
	if j == 0:
		print('NO')
	else:
		print('YES')
		print(a, b)
else:
	print('NO')


d = {}
f = False
for _ in range(int(input())):
	n = int(input())
	try:
		d[n] += 1
	except:
		d[n] = 1
if len(d) == 2:
	l = []
	a = []
	for i in d.keys():
		l.append(d[i])
		a.append(i)
	if l[0] == l[1]:
		f = True
if f == True:
	print('YES')
	print(*a)
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
l.sort()
b = 0
a = l[0]
c1 = 1
c2 = 0
f = 0
for i in range(1, n):
	if l[i] == a:
		c1 += 1
	elif b == 0:
		b = l[i]
		c2 += 1
	elif l[i] == b:
		c2 += 1
	else:
		f = 1
		break
if f:
	print('NO')
elif c1 == c2:
	print('YES')
	print(a, b)
else:
	print('NO')


p = list(sorted([int(input()) for _ in range(int(input()))]))
print('YES\n{} {}'.format(p[0], p[-1]) if len(set(p)) == 2 and p.count(p[0]) == p.count(p[-1]) else 'NO')


from collections import Counter
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
x = Counter(a)
if len(x) == 2:
	if len(set(x.values())) == 1:
		print('YES')
		for i in x.keys():
			print(i, end=' ')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
ta = []
for x in range(n):
	p = int(input())
	ta.append(p)
if len(set(ta)) == 2:
	lk = list(set(ta))
	if ta.count(lk[0]) == ta.count(lk[-1]):
		print('YES')
		print(lk[0], lk[1])
	else:
		print('NO')
else:
	print('NO')


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	A = []
	for i in range(n):
		A.append(int(input()))
	d = dict()
	for a in A:
		if a not in d:
			d[a] = 0
		d[a] += 1
	ans = []
	if len(d) == 2:
		(a, b) = list(d.keys())
		if d[a] == d[b]:
			ans = [a, b]
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		print('%d %d' % (ans[0], ans[1]))
main()


from collections import Counter

def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	cnt = Counter(A)
	if len(cnt) != 2:
		print('NO')
		return
	ps = list(cnt.items())
	if ps[0][1] != ps[1][1]:
		print('NO')
		return
	print('YES')
	print(ps[0][0], ps[1][0])

def __starting_point():
	main()
__starting_point()


import sys
n = int(input())
a = {}
for i in range(n):
	temp = int(input())
	if temp not in a.keys():
		a[temp] = 1
	else:
		a[temp] += 1
if len(a.keys()) > 2 or len(a.keys()) < 2:
	print('NO')
	sys.exit()
l = list(a.keys())
if a[l[0]] != a[l[1]]:
	print('NO')
	sys.exit()
print('YES')
print('{} {}'.format(l[0], l[1]))


k = int(input())
st = {}
st = set()
p = []
for i in range(k):
	j = int(input())
	p.append(j)
	st.add(j)
if len(st) == 2:
	a = []
	for k in st:
		a.append(k)
	if p.count(a[0]) == p.count(a[1]):
		print('YES')
		print(a[0], a[1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
so = dict()
for i in range(n):
	nhap = int(input())
	if nhap in so:
		so[nhap] += 1
	else:
		so[nhap] = 1
a = list(so.values())
b = list(so)
if len(a) == 2 and a[0] == a[1]:
	print('YES')
	print(b[0], b[1])
else:
	print('NO')


n = int(input())
l = []
for _ in range(n):
	l.append(int(input()))
l1 = list(set(l))
if len(l1) != 2:
	print('NO')
elif l.count(l1[0]) == l.count(l1[-1]):
	print('YES')
	l1.sort()
	print(l1[0], l1[1])
else:
	print('NO')


def solve():
	n = int(input())
	cards = []
	cards_dict = {}
	for _ in range(n):
		cards.append(int(input()))
	for card in cards:
		if card not in cards_dict:
			cards_dict[card] = 1
		else:
			cards_dict[card] += 1
	cards = list(set(cards))
	if len(cards_dict) == 2 and cards_dict[cards[0]] == cards_dict[cards[1]]:
		print('Yes')
		print(cards[0], cards[1])
	else:
		print('No')
solve()


n = int(input())
a = [int(input()) for _ in range(n)]
c = a[0]
d = None
if len(set(a)) != 2:
	print('NO')
else:
	for x in a:
		if x != c:
			d = x
			break
	if d != None and a.count(c) == n // 2:
		print('YES')
		print(c, d)
	else:
		print('NO')


n = int(input())
l = []
l1 = []
for i in range(n):
	x = int(input())
	l1.append(x)
	if x not in l:
		l.append(x)
length = len(l)
if length != 2:
	print('NO')
else:
	a = l[0]
	b = l[1]
	c1 = 0
	c2 = 0
	for i in range(n):
		if l1[i] == a:
			c1 += 1
		if l1[i] == b:
			c2 += 1
	if c1 == c2:
		print('YES', end='\n')
		print(a, b)
	else:
		print('NO')


def solve():
	n = int(input())
	d = {}
	l = []
	ans = 'YES'
	for _ in range(0, n):
		num = int(input())
		if num not in d:
			d[num] = 1
			l.append(num)
		else:
			d[num] += 1
		if len(d) > 2:
			print('NO')
			return
	if len(d) != 2:
		print('NO')
		return
	if d[l[0]] != d[l[1]]:
		print('NO')
		return
	print('YES')
	for num in d:
		print(num, end=' ')
solve()


t = int(input())
d = {}
sum1 = 0
for i in range(t):
	l = int(input())
	if l in d:
		d[l] = d[l] + 1
	else:
		d[l] = 1
if len(d) % 2 == 1 or len(d) > 2:
	print('NO')
else:
	k1 = 0
	sum1 = 0
	for i in d:
		sum1 = sum1 + d[i]
		if sum1 == t // 2:
			k1 = 0
			break
		if sum1 > t // 2:
			k1 = 1
			print('NO')
			break
	if k1 == 0:
		print('YES')
		for i in d:
			print(i, end=' ')


from collections import defaultdict
n = int(input())
rec = defaultdict(int)
for i in range(n):
	a = int(input())
	rec[a] += 1
	q = a
if len(rec) != 2:
	print('NO')
else:
	flag = True
	for v1 in rec.values():
		if v1 != rec[q]:
			flag = False
	if flag:
		print('YES')
		print(' '.join(map(str, rec.keys())))
	else:
		print('NO')


l = []
for i in range(int(input())):
	l.append(int(input()))
d = {}
for x in set(l):
	c = l.count(x)
	if c in d:
		if 2 * c == len(l):
			print('YES')
			print(d[c], x)
		else:
			print('NO')
		break
	else:
		d[c] = x
else:
	print('NO')


n = int(input())
A = []
D = {}
k = []
for i in range(n):
	x = int(input())
	A.append(x)
	if x not in D:
		D[x] = 0
		k.append(x)
	D[x] += 1
if len(D) != 2:
	print('NO')
elif D[k[0]] == D[k[1]]:
	print('YES')
	print(k[0], k[1])
else:
	print('NO')


from collections import defaultdict
n = int(input())
m = defaultdict(int)
for _ in range(n):
	v = int(input())
	m[v] += 1
if len(m.keys()) == 2:
	m_list = list(m.keys())
	if m[m_list[0]] == m[m_list[1]]:
		print('YES')
		print('{} {}'.format(m_list[0], m_list[1]))
		exit(0)
print('NO')


import collections
c = collections.Counter()
n = int(input())
nums = []
for _ in range(n):
	c[int(input().strip())] += 1
if len(c) != 2:
	print('NO')
else:
	(a, b) = [c[d] for d in c]
	if a == b:
		print('YES')
		for d in c:
			print(d, end=' ')
	else:
		print('NO')


from sys import stdin, stdout
from collections import defaultdict as dd
n = int(stdin.readline())
d = dd(int)
count = 0
nn = n
while n > 0:
	num = int(stdin.readline().strip())
	if d[num] == 0:
		count += 1
		d[num] += 1
	else:
		d[num] += 1
	n -= 1
if count == 2:
	ans = True
	a = []
	for (i, j) in d.items():
		a.append(i)
		if j != nn // 2:
			ans = False
			break
	if ans:
		print('YES')
		for i in a:
			print(i, end=' ')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
fl = True
trig = True
a = int(input())
l = a
m = -1
lsum = 1
msum = 0
for i in range(1, n):
	a = int(input())
	if a == l:
		lsum += 1
	if a == m:
		msum += 1
	if a != l and trig:
		m = a
		trig = False
		msum += 1
	if a != l and a != m:
		fl = False
		break
if fl and trig == False and (lsum == msum):
	print('YES')
	print(l, m)
else:
	print('NO')


n = int(input())
s = set()
l = []
for i in range(n):
	a = int(input())
	s.add(a)
	l.append(a)
if len(s) == 2:
	d = {}
	for i in l:
		try:
			d[i] += 1
		except:
			d.update({i: 0})
			d[i] += 1
	f = list(d.keys())
	f.sort()
	if d[f[0]] == d[f[1]]:
		print('YES')
		print(f[0], f[1])
	else:
		print('NO')
else:
	print('NO')


import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
a = []
n = int(input())
for i in range(n):
	q = int(input())
	a.append(q)
a.sort()
f1 = a[0] == a[n // 2 - 1]
f2 = a[n // 2] == a[n - 1]
f3 = a[0] != a[n - 1]
if f1 and f2 and f3:
	print('YES')
	print(a[0], a[n - 1])
	exit()
print('NO')


n = int(input())
if n % 2 == 1:
	print('NO')
else:
	A = []
	for i in range(n):
		A.append(int(input()))
	B = list(set(A))
	if len(B) == 2 and A.count(B[0]) == A.count(B[1]):
		print('YES')
		print(B[0], B[1])
	else:
		print('NO')


x = int(input())
s = []
z = []
for n in range(x):
	k = int(input())
	z.append(k)
	if k not in s:
		s.append(k)
if len(s) != 2:
	print('NO')
elif z.count(s[0]) == z.count(s[1]):
	print('YES')
	print('{} {}'.format(s[0], s[1]))
else:
	print('NO')


from collections import Counter
n = int(input())
s = []
for i in range(n):
	s.append(int(input()))
x = Counter(s)
l = list(x.values())
if len(x) == 2 and l[0] == l[1]:
	print('YES')
	print(*list(x.keys()))
else:
	print('NO')


t = int(input())
li = []
for i in range(t):
	li.append(int(input()))
k = list(set(li))
if len(k) != 2:
	print('NO')
elif li.count(k[0]) == li.count(k[1]):
	print('YES')
	print(*k)
else:
	print('NO')


list1 = []
c = 0
s = -1
x = int(input())
for i in range(0, x):
	y = int(input())
	list1.append(y)
	if i == 0:
		f = y
	if i != 0 and y != f and (c == 0):
		s = y
		c = 1
p = 0
q = 0
for i in range(0, x):
	if f == list1[i]:
		p = p + 1
	if s == list1[i]:
		q = q + 1
if p == q and p + q == x:
	print('YES')
	print(f, s)
else:
	print('NO')


n = int(input())
s = set()
l = []
a = 0
b = 0
for i in range(n):
	new_number = int(input())
	l.append(new_number)
	s.add(new_number)
if len(s) == 2:
	k = 0
	for i in s:
		if k == 0:
			a = l.count(i)
			k = 1
		else:
			b = l.count(i)
	if a == b:
		print('YES')
		print(' '.join(map(str, s)))
		exit()
print('NO')


n = int(input())
cards = []
for i in range(n):
	x = int(input())
	cards.append(x)
cards.sort()
if len(set(cards)) == 2 and cards.count(cards[0]) == cards.count(cards[-1]):
	print('YES')
	print(*set(cards))
else:
	print('NO')


l = []
k = []
for _ in range(int(input())):
	a = int(input())
	if a not in l:
		l.append(a)
	k.append(a)
if len(l) == 2:
	if k.count(l[0]) == k.count(l[1]):
		print('YES')
		print(*l)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
c = [0 for i in range(101)]
k = 0
for i in range(n):
	val = int(input())
	c[val] += 1
	if c[val] == 1:
		k += 1
a1 = 0
a2 = 0
if k == 2:
	flag = 0
	for i in range(101):
		if c[i] and (not flag):
			a1 = i
			flag = 1
		elif c[i] and flag:
			a2 = i
	if c[a1] == c[a2]:
		print('YES')
		print(a1, a2)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
s = set(a)
s = list(s)
if len(s) == 2:
	x = a.count(s[0])
	y = n - x
	if x == y:
		print('YES')
		print(*s)
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
x = Counter(a)
if len(x) != 2:
	print('NO')
else:
	value = list(x.values())
	key = list(x.keys())
	if value[0] == value[1]:
		print('YES')
		print(key[0], key[1])
	else:
		print('NO')


t = int(input())
l = []
for i in range(t):
	l.append(int(input()))
a = set(l)
a = list(a)
if len(a) == 2 and l.count(a[0]) == l.count(a[1]):
	print('YES')
	print(a[0], a[1])
else:
	print('NO')


n = int(input())
A = [0] * 101
for i in range(n):
	a = int(input())
	for i in range(101):
		if i == a:
			A[i] += 1
B = []
count = 0
index1 = index2 = 0
for i in range(101):
	if A[i] > 0:
		B.append(A[i])
		index2 = index1
		index1 = i
		count += 1
if count == 2 and B[0] == B[1]:
	print('YES\n', index1, index2)
else:
	print('NO')


n = int(input())
d = {}
for i in range(n):
	x = int(input())
	d[x] = d.get(x, 0) + 1
if len(d) == 2:
	first = None
	for key in d:
		if first == None:
			first = d[key]
			firstkey = key
		else:
			second = d[key]
			secondkey = key
if len(d) != 2 or first != second:
	print('NO')
else:
	print('YES')
	print(str(firstkey) + ' ' + str(secondkey))


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
num = a.count(a[0])
a = list(set(a))
if len(a) == 2 and num * 2 == n:
	print('YES')
	print(a[0], a[1])
else:
	print('NO')


n = int(input())
arr = sorted((int(input()) for _ in range(n)))
print('YES\n{} {}'.format(arr[0], arr[-1]) if arr[0] == arr[n // 2 - 1] and arr[n // 2] == arr[n - 1] and (arr[0] < arr[-1]) else 'NO')


n = int(input())
lst = []
for i in range(n):
	lst.append(int(input()))
s = set(lst)
if len(s) == 2:
	(a, b) = list(s)
	if lst.count(a) == lst.count(b):
		print('YES')
		print(s.pop(), s.pop())
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = []
c = 0
for i in range(n):
	num = int(input())
	if num not in a:
		a.append(num)
	if num == a[0]:
		c += 1
	elif num == a[1]:
		c -= 1
if len(a) > 2 or len(a) == 1 or c != 0:
	print('NO')
else:
	print('YES')
	print(a[0], a[1])


import sys
n = int(input())
s = []
l = []
for i in range(n):
	k = int(input())
	if k not in s:
		s.append(k)
	l.append(k)
if len(s) > 2:
	print('NO')
	sys.exit()
l = sorted(l)
p = 0
u = 0
y = 0
t = 0
r = 0
t = l[0]
if l[p] == l[p + 1]:
	u = 1
	p = 1
while p + 1 < len(l) and l[p] == l[p + 1]:
	u += 1
	p += 1
p += 1
while p + 1 < len(l) and l[p] == l[p + 1]:
	p += 1
	y += 1
r = l[len(l) - 1]
if u == y:
	print('YES')
	print(str(t) + ' ' + str(r))
else:
	print('NO')


cardNum = int(input())
cards = [input() for i in range(cardNum)]
values = {}
if len(set(cards)) > 2:
	print('NO')
else:
	for card in set(cards):
		value = cards.count(card)
		if value in values:
			print('YES')
			print(card, values[value])
			break
		values[value] = card
	else:
		print('NO')


n = int(input())
a = []
s = 0
b = []
for i in range(n):
	a.append(int(input()))
a.sort()
for i in range(1, n):
	if a[i] != a[i - 1]:
		curr = [a[i - 1], s + 1]
		b.append(curr)
		s = 0
	else:
		s += 1
curr = [a[n - 1], s + 1]
b.append(curr)
if len(b) == 2:
	if b[0][1] == b[1][1]:
		print('YES')
		print(b[0][0], b[1][0])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = dict()
for i in range(n):
	s = int(input())
	if s not in a:
		a[s] = 1
	else:
		a[s] += 1
k = list(a.keys())
if len(a) != 2:
	print('NO')
elif a[k[0]] != a[k[1]]:
	print('NO')
else:
	print('YES')
	print(k[0], ' ', k[1])


a = int(input())
count = 0
f = []
for i in range(a):
	f.append(int(input()))
f.sort()
new = []
for k in f:
	if k not in new:
		new.append(k)
if len(new) != 2:
	print('NO')
else:
	m = f.count(new[0])
	o = f.count(new[1])
	if m == o:
		print('YES')
		for l in new:
			print(l, end=' ')
	else:
		print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
b = {}
cnt = 0
num = 0
for i in a:
	if i not in b:
		b[i] = 1
		cnt += 1
	else:
		b[i] += 1
flag = 1
num = list(b.values())[0]
for i in b.values():
	if i != num or cnt != 2:
		print('NO')
		flag = 0
		break
if flag:
	print('YES')
	for i in b.keys():
		print(i, end=' ')


def main():
	n = int(input())
	numbers = []
	for i in range(n):
		number = int(input())
		numbers.append(number)
	from collections import Counter
	counts = Counter(numbers)
	for num in counts:
		for other_num in counts:
			if num != other_num:
				draw_game = counts[num] == counts[other_num]
				cards_lasts = n - (counts[num] + counts[other_num])
				good_game = cards_lasts == 0 and draw_game
				if good_game:
					print('YES')
					print(num, other_num)
					return
	print('NO')
	return
main()


n = int(input())
p = int(input())
v = 0
kp = 1
kv = 0
for i in range(n - 1):
	q = int(input())
	if v:
		if q == p:
			kp += 1
		elif q == v:
			kv += 1
		else:
			print('NO')
			exit()
	elif q == p:
		kp += 1
	else:
		v = q
		kv += 1
if kp == kv:
	print('YES')
	print(p, v)
else:
	print('NO')


(s, n) = ({}, int(input()))
for i in range(n):
	q = input()
	if q in s:
		s[q] -= 1
	elif len(s) < 2:
		s[q] = n // 2 - 1
	else:
		break
print(['YES\n' + ' '.join(s), 'NO'][any(s.values())])


n = int(input())
A = [input() for _ in range(n)]
numbers = set(A)
if len(numbers) == 2 and A.count(A[0]) == n // 2:
	print('YES')
	print(*numbers)
else:
	print('NO')


n = int(input())
counta = 0
countb = 0
a = int(input())
counta += 1
mark = True
for i in range(n - 1):
	tmp = int(input())
	if tmp != a and mark:
		b = tmp
		countb += 1
		mark = False
	elif tmp == a:
		counta += 1
	elif tmp == b:
		countb += 1
if counta == countb and counta + countb == n:
	print('YES')
	print(a, b)
else:
	print('NO')


N = int(input())
A = sorted([int(input()) for _ in range(N)])
if N % 2 == 0 and A.count(A[0]) == A.count(A[-1]) == N // 2:
	print('YES')
	print(A[0], A[-1])
else:
	print('NO')


n = int(input())
cards = []
arr = []
for _ in range(n):
	x = int(input())
	arr.append(x)
	if x not in cards:
		cards.append(x)
if len(cards) != 2:
	print('NO')
elif arr.count(cards[0]) == arr.count(cards[1]):
	print('YES')
	print(cards[0], cards[1])
else:
	print('NO')


from collections import defaultdict
MyDict = defaultdict(int)
n = int(input())
for i in range(n):
	X = int(input())
	MyDict[X] += 1
if len(MyDict) != 2 or list(MyDict.values())[0] != list(MyDict.values())[1]:
	print('NO')
	exit()
print('YES')
print(*list(MyDict.keys()))


n = int(input())
m = {}
for i in range(n):
	ai = int(input())
	if not ai in m:
		m[ai] = 1
	else:
		m[ai] += 1
if list(m.values()) == [n // 2, n // 2]:
	print('YES')
	print(' '.join(map(str, m.keys())))
else:
	print('NO')


from collections import *
x = int(input())
z = []
for i in range(x):
	z.append(int(input()))
y = Counter(z)
if len(y) != 2:
	print('NO')
else:
	val = list(y.values())
	ke = list(y.keys())
	if val[0] == val[1]:
		print('YES')
		print(ke[0], ke[1])
	else:
		print('NO')


n = int(input())
l = []
ll = []
for i in range(n):
	a = int(input())
	if not a in l:
		l.append(a)
		ll.append(1)
	else:
		ll[l.index(a)] += 1
if len(l) != 2:
	print('NO')
elif ll[0] != ll[1]:
	print('NO')
else:
	print('YES')
	print(l[0], l[1])


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
s = set(arr)
new_set = list(s)
if len(s) == 2 and (arr.count(new_set[0]) == n / 2 and arr.count(new_set[1]) == n / 2):
	print('YES')
	print(new_set[0], new_set[1])
else:
	print('NO')


def solve():
	n = int(input())
	nums = [int(input()) for i in range(n)]
	numdict = {}
	for num in nums:
		if num in numdict:
			numdict[num] += 1
		else:
			numdict[num] = 1
	if len(numdict) != 2:
		print('NO')
	else:
		nums = list(numdict.keys())
		if numdict[nums[0]] == numdict[nums[1]]:
			print('YES')
			print(nums[0], nums[1])
		else:
			print('NO')
	return
solve()


n = int(input())
L = []
d = {}
for i in range(n):
	L.append(int(input()))
	if L[i] in d:
		d[L[i]] += 1
	else:
		d[L[i]] = 1
if len(d) != 2:
	print('NO')
elif list(d.values())[0] == list(d.values())[1]:
	print('YES')
	print(list(d.keys())[0], list(d.keys())[1])
else:
	print('NO')


n = int(input())
result = {}
arr = []
for i in range(n):
	arr.append(int(input()))
for i in arr:
	if i in result:
		result[i] = result[i] + 1
	else:
		result[i] = 1
if len(result) != 2:
	print('NO')
else:
	tmp = list(result.keys())
	if result[tmp[0]] != result[tmp[1]]:
		print('NO')
	else:
		print('YES')
		print(str(tmp[0]) + ' ' + str(tmp[1]))


n = int(input())
mas = []
m = set()
for i in range(n):
	a = int(input())
	mas.append(a)
	m.add(a)
if len(m) > 2:
	print('NO')
else:
	mas.sort()
	if mas[n // 2] == mas[n // 2 - 1]:
		print('NO')
	else:
		print('YES')
		print(mas[n // 2], mas[n // 2 - 1])


a = int(input())
s = []
p = []
v = []
for i in range(a):
	s.append(int(input()))
h = s[0]
for i in range(len(s)):
	if s[i] == h:
		p.append(s[i])
		s[i] = 0
while 0 in s:
	s.remove(0)
if len(s) > 0:
	h = s[0]
	for i in range(len(s)):
		if s[i] == h:
			v.append(s[i])
			s[i] = 0
	while 0 in s:
		s.remove(0)
	if len(s) == 0 and len(v) == len(p):
		print('YES')
		print(p[0], v[0])
	else:
		print('NO')
else:
	print('NO')


k = [int(input()) for i in range(int(input()))]
if k.count(k[0]) == len(k) // 2 and len(set(k)) == 2:
	print('YES')
	print(*set(k))
else:
	print('NO')


n = int(input())
l = [0] * n
for i in range(n):
	l[i] = int(input())
l.sort()
if l.count(l[0]) == l.count(l[n - 1]) == n / 2:
	print('YES')
	print(l[0], l[n - 1])
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
b = []
for i in range(n):
	if a[i] not in b:
		b.append(a[i])
if len(b) != 2:
	print('NO')
elif a.count(b[0]) == a.count(b[1]):
	print('YES')
	print(b[0], b[1])
else:
	print('NO')


n = int(input())
d = {}
s = set()
if n % 2 != 0:
	print('NO')
else:
	for i in range(n):
		x = int(input())
		s.add(x)
		if x in d:
			f = d[x]
			f = f + 1
			d[x] = f
		else:
			d[x] = 1
	cnt = 0
	o = list(s)
	if len(o) != 2:
		print('NO')
		exit()
	one = o[0]
	two = o[1]
	if d[one] == d[two]:
		print('YES')
		for h in o:
			print(h, end=' ')
		print('')
	else:
		print('NO')


n = int(input())
arr1 = [int(input()) for _ in range(n)]
arr2 = list(set(arr1))
if len(arr2) == 2 and arr1.count(arr2[0]) == arr1.count(arr2[1]):
	print('YES')
	print(*arr2)
else:
	print('NO')


n = int(input())
L = [0] * 105
for i in range(n):
	tmp = int(input())
	L[tmp] += 1
t = 0
s = set()
for i in range(105):
	if L[i] > 0:
		t += 1
		s.add(L[i])
if t != 2 or len(s) > 1:
	print('NO')
	exit()
else:
	print('YES')
	for i in range(105):
		if L[i] > 0:
			print(i, end=' ')


n = int(input())
s = []
for i in range(n):
	s.append(int(input()))
s = sorted(s)
if len(set(s)) > 2 or len(s) % 2 != 0 or s[len(s) // 2 - 1] == s[len(s) // 2]:
	print('NO')
else:
	print('YES')
	s = sorted(set(s))
	print(s[0], s[1])


n = int(input())
a = []
for i in range(n):
	k = input() + '\n'
	a.append(k)
if len(set(a)) != 2:
	print('NO')
else:
	a = sorted(a)
	x = 0
	y = 0
	for i in range(len(a)):
		if a[i] == a[0]:
			x += 1
		else:
			y += 1
	if x == y:
		print('YES')
		s = str(a[0]) + ' ' + str(a[len(a) - 1])
		print(s)
	else:
		print('NO')


n = int(input())
cards = []
for i in range(n):
	cards.append(int(input()))
e = set(cards)
e = list(e)
if len(e) != 2:
	print('NO')
elif cards.count(e[1]) == cards.count(e[0]):
	print('YES')
	print(*e)
else:
	print('NO')


n = int(input())
l = [int(input()) for i in range(n)]
ans = []
for i in range(n):
	for j in range(n):
		if l[i] != l[j]:
			if l.count(l[i]) + l.count(l[j]) == n and l.count(l[i]) == l.count(l[j]):
				ans = [i, j]
if ans != []:
	print('YES')
	print(l[ans[0]], l[ans[1]])
else:
	print('NO')


l = []
for i in range(int(input())):
	q = int(input())
	l.append(q)
r = list(set(map(int, l)))
count = []
for i in r:
	count.append(l.count(i))
if len(count) != 2:
	print('NO')
else:
	o = 'NO'
	u = []
	for i in range(len(count) - 1):
		for j in range(i + 1, len(count)):
			if count[i] == count[j]:
				o = 'YES'
				u.append(r[i])
				u.append(r[j])
			break
		break
	if o == 'YES':
		print(o)
		print(*u)
	else:
		print(o)


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
a.sort()
c0 = a.count(a[0])
c1 = a.count(a[n - 1])
if c0 == c1 and c0 + c1 == n:
	print('YES')
	print(' '.join(map(str, [a[0], a[n - 1]])))
else:
	print('NO')


from collections import Counter
cards_nr = int(input())
number_counter = Counter()
for _ in range(cards_nr):
	curr_number = int(input())
	number_counter[curr_number] += 1
if len(number_counter) != 2:
	print('NO')
else:
	(num1, num2) = list(number_counter)
	if number_counter[num1] != number_counter[num2]:
		print('NO')
	else:
		print('YES')
		print(num1, num2)


d = dict()
n = int(input())
for i in range(n):
	k = int(input())
	if k in d.keys():
		d[k] += 1
	else:
		d[k] = 0
kys = list(d.keys())
if len(kys) == 2:
	if d[kys[0]] == d[kys[1]]:
		print('YES')
		print(kys[0], kys[1])
		exit()
print('NO')


n = int(input())
i = 0
s = []
one = []
two = []
while i < n:
	s.append(input())
	i = i + 1
tmp = s[0]
for i in s:
	if i != tmp:
		tmp1 = i
		break
i = 0
while i < len(s):
	if s[i] == tmp:
		one.append(s[i])
		s.pop(i)
	elif s[i] == tmp1:
		two.append(s[i])
		s.pop(i)
	else:
		i = i + 1
if len(s) == 0 and len(one) == len(two):
	print('YES')
	print(tmp, tmp1)
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a.sort()
if len(set(a)) == 2 and a[n // 2 - 1] != a[n // 2]:
	print('YES')
	print(a[n // 2 - 1], a[n // 2])
else:
	print('NO')


def ins(s):
	for i in range(1, len(s)):
		val = s[i]
		j = i - 1
		while s[j] > val and j >= 0:
			s[j + 1] = s[j]
			j = j - 1
		s[j + 1] = val
	return s
n = int(input())
b = []
for i in range(n):
	b.append(int(input()))
b = ins(b)
b1 = []
b2 = []
for i in range(n):
	if i < n / 2:
		b1.append(b[i])
	else:
		b2.append(b[i])
if b1.count(b1[0]) == len(b1) and b2.count(b2[0]) == len(b2) and (b.count(b[0]) != len(b)):
	print('YES')
	print(b1[0], b2[0])
else:
	print('NO')


dic = []
first = int(input())
a = 0
b = 0
for i in range(first):
	n = int(input())
	if n in dic and n == dic[0]:
		a += 1
		continue
	elif n in dic and n == dic[1]:
		b += 1
		continue
	else:
		dic.append(n)
if len(dic) == 2 and a == b:
	print('YES')
	print(f'{dic[0]} {dic[1]}')
else:
	print('NO')


n = int(input())
map = {}
vals = []
for _ in range(n):
	vals.append(int(input()))
for val in vals:
	if val not in map.keys():
		map[val] = 1
	else:
		map[val] += 1
ok = True
values = list(map.values())
keys = list(map.keys())
if len(map) != 2 or values[0] != n // 2 or values[1] != n // 2:
	ok = False
if not ok:
	print('NO')
else:
	print('YES')
	print(keys[0], keys[1])


n = int(input())
a = []
for i in range(n):
	b = int(input())
	a.append(b)
v = 0
p = 0
vc = a[0]
vp = -1
for i in range(n):
	if a[i] == vc:
		v += 1
	else:
		vp = a[i]
for i in range(n):
	if a[i] == vp:
		p += 1
if v == p and v + p == n:
	print('YES')
	print(vc, vp)
else:
	print('NO')


list = []
for i in range(int(input())):
	list.append(int(input()))
set1 = set(list)
if len(set1) != 2:
	print('NO')
elif list.count(set1.pop()) != list.count(set1.pop()):
	print('NO')
else:
	print('YES')
	Set = set(list)
	print(Set.pop(), Set.pop())


n = int(input())
L = [0] * 101
for i in range(n):
	L[int(input())] += 1
S = set()
for i in range(len(L)):
	if L[i]:
		S.add(i)
if len(S) == 2:
	M = list(S)
	if L[M[0]] == L[M[1]]:
		print('YES')
		print(M[0], M[1])
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
ar = []
for t in range(int(input())):
	i = int(input())
	ar.append(i)
c = Counter(ar)
ar = c.most_common(len(c))
if len(ar) > 2 or len(ar) == 1:
	print('NO')
elif ar[0][1] == ar[1][1]:
	print('YES')
	for i in ar:
		print(i[0])
else:
	print('NO')


n = int(input())
d = []
for i in range(n):
	sem = int(input())
	d.append(sem)
d.sort()
if d[0] == d[n // 2 - 1] and d[n // 2] == d[n - 1] and (d[0] != d[n - 1]):
	print('YES')
	print(d[0], d[n - 1])
else:
	print('NO')


import math as mt
import sys, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
from collections import defaultdict
n = I()
d = defaultdict(int)
for i in range(n):
	x = I()
	d[x] += 1
if len(d.keys()) == 2:
	s = set([])
	for i in d.keys():
		s.add(d[i])
	if len(s) == 1:
		print('YES')
		print(*list(d.keys()))
	else:
		print('NO')
else:
	print('NO')


def distinct(x):
	distinct = 0
	temp = []
	for i in x:
		if i not in temp:
			distinct += 1
			temp.append(i)
	return distinct
n = int(input(''))
lst = []
for i in range(0, n):
	temp = int(input(''))
	lst.append(temp)
if distinct(lst) != 2:
	print('NO')
else:
	n1 = 0
	n2 = 0
	first_num = lst[0]
	for i in range(0, len(lst)):
		if lst[i] == first_num:
			n1 += 1
		else:
			n2 += 1
			second_num = lst[i]
	if n1 != n2:
		print('NO')
	else:
		print('YES')
		print(first_num, second_num)


n = int(input())
a = []
s = set()
for i in range(n):
	b = int(input())
	s.add(b)
	a.append(b)
if len(s) != 2:
	print('NO')
	exit()
m = s.pop()
n = s.pop()
p = a.count(m)
q = a.count(n)
if p == q:
	print('YES')
	print(m, n)
else:
	print('NO')


import collections
n = int(input())
a = [int(input()) for i in range(n)]
x = set(a)
if len(x) != 2:
	print('NO')
	exit()
b = collections.Counter(a)
y = set()
yy = set()
for (i, j) in b.items():
	y.add(j)
	yy.add(i)
if len(y) != 1:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, list(yy))))


n = int(input())
a = [0] * 101
for i in range(n):
	m = int(input())
	a[m] += 1
x = -1
xc = 0
y = -1
yc = 0
for i in range(1, 101):
	if a[i]:
		if x == -1:
			x = i
			xc = a[i]
		elif y == -1:
			y = i
			yc = a[i]
		else:
			print('NO')
			exit(0)
if x != -1 and y != -1 and (xc == yc):
	print('YES')
	print(x, y)
else:
	print('NO')


a = int(input())
b = []
c = []
d = []
for i in range(a):
	b.append(int(input()))
b.sort()
g = b[0]
f = b.count(b[0])
while g in b:
	b.remove(g)
if len(b) > 0:
	g1 = b[0]
	f1 = b.count(b[0])
	while g1 in b:
		b.remove(g1)
	if len(b) == 0 and f1 == f:
		print('YES')
		print(g, g1)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
x = dict()
for _ in range(n):
	l = int(input())
	if l in x.keys():
		x[l] += 1
	else:
		x[l] = 1
if len(x.keys()) == 2:
	li = list(x.keys())
	if x[li[0]] == x[li[1]]:
		print('YES')
		print(*li)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
b = []
for i in range(n):
	m = int(input())
	b.append(m)
v = sorted(list(set(b)))
if len(v) != 2 or b.count(v[0]) != b.count(v[1]):
	print('NO')
else:
	print('YES')
	print(*v)


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

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

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
n = inin()
arr = []
for i in range(n):
	arr.append(inin())
if len(set(arr)) != 2:
	print('NO')
else:
	petya = 0
	vasya = 0
	ele = arr[0]
	mele = 0
	for i in arr:
		if i == ele:
			petya += 1
		else:
			mele = i
			vasya += 1
	if petya != vasya:
		print('NO')
	else:
		print('YES')
		print(ele, mele)


arr = [0] * 100
t = 0
arr2 = []
arr3 = [0] * 100
for i in [0] * int(input()):
	a = int(input())
	arr[a - 1] += 1
	arr2.append(a)
for k in arr:
	if k > 0:
		arr3[k - 1] += 1
for i in set(arr3):
	if i % 2:
		t = 1
c = set(arr2)
if t % 2 or len(c) > 2:
	print('NO')
else:
	print('YES\n', *c)


a = [int(input()) for i in range(int(input()))]
d = dict()
for i in a:
	if i not in d.keys():
		d[i] = 0
	d[i] += 1
if len(d.keys()) == 2 and d[a[0]] == len(a) // 2:
	print('YES')
	for i in d.keys():
		print(i, end=' ')
else:
	print('NO')


n = int(input())
number = []
number1 = []
for i in range(n):
	number.append(int(input()))
number1 = list(set(number))
if len(number1) == 2 and number.count(number1[0]) == n // 2 and (number.count(number1[1]) == n // 2):
	print('YES')
	print(number1[0], number1[1])
else:
	print('NO')


n = int(input())
d = {}
for i in range(n):
	num = input()
	if num in d:
		d[num] += 1
	else:
		d[num] = 1
keys = list(d.keys())
if len(d) != 2:
	ans = 'NO'
elif d[keys[0]] != d[keys[1]]:
	ans = 'NO'
else:
	ans = 'YES'
if ans == 'YES':
	print(ans)
	print(keys[0] + ' ' + keys[1])
else:
	print(ans)


from collections import Counter

def go():
	n = int(input())
	c = Counter()
	for i in range(n):
		c[int(input())] += 1
		if len(c) > 2:
			return 'NO'
	if len(c) != 2:
		return 'NO'
	else:
		keys = list(c.keys())
		if keys[0] != keys[1] and c[keys[0]] == c[keys[1]]:
			return 'YES' + '\n' + '{} {}'.format(keys[0], keys[1])
		else:
			return 'NO'
print(go())


t = int(input())
list1 = []
answer = []
while t > 0:
	a = int(input())
	list1.append(a)
	t -= 1
for i in list1:
	if i not in answer:
		answer.append(i)
if len(answer) != 2:
	print('NO')
elif list1.count(answer[0]) == list1.count(answer[1]):
	print('YES')
	print(*answer)
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
x = a[0]
y = a[-1]
nb_x = 0
nb_y = 0
for i in range(n):
	if a[i] == x:
		nb_x += 1
	if a[i] == y:
		nb_y += 1
if x != y and nb_x == nb_y and (nb_x + nb_y == n):
	print('YES')
	print(x, y)
else:
	print('NO')


a = {}
b = []
for i in range(int(input())):
	x = int(input())
	if x not in a:
		a[x] = 1
	else:
		a[x] += 1
if len(a) != 2:
	print('NO')
else:
	b = [a[i] for i in a]
	if b[0] != b[1]:
		print('NO')
	else:
		print('YES')
		print(*list(a))


num = int(input())
cards = []
for i in range(num):
	cards.append(int(input()))
cards.sort()
dif = 1
idx = 0
out = []
for i in range(1, num):
	if cards[i] != cards[i - 1]:
		dif += 1
		idx = i
		out.append(cards[i - 1])
		out.append(cards[i])
if dif != 2:
	print('NO')
elif idx * 2 == num:
	print('YES')
	for i in out:
		print(i, end=' ')
else:
	print('NO')


n = int(input())
tab = []
for x in range(n):
	tab.append(int(input()))
third = 0
a = tab[0]
counta = 1
countb = 0
for x in range(1, n):
	if tab[x] == a:
		counta += 1
	elif countb == 0:
		b = tab[x]
		countb += 1
	elif tab[x] == b:
		countb += 1
	else:
		third = 1
		break
if third == 0 and counta == countb:
	print('YES')
	print(a, b)
else:
	print('NO')


a = int(input())
b = []
for i in range(a):
	b.append(int(input()))
v = set(b)
g = len(b)
if len(v) == 2:
	m = list(v)
	n = b.count(m[0])
	z = b.count(m[1])
	if z == n:
		print('YES')
		print(*v)
	else:
		print('NO')
else:
	print('NO')


N = int(input().strip())
num = dict()
for _ in range(N):
	x = int(input().strip())
	if x in num:
		num[x] += 1
	elif len(num) < 2:
		num[x] = 1
	else:
		print('NO')
		exit(0)
if len(num) == 2:
	(n1, n2) = list(num)
	if num[n1] == num[n2]:
		print('YES\n' + str(n1) + ' ' + str(n2))
	else:
		print('NO')
else:
	print('NO')


n = int(input())
d = dict()
keys = []
for i in range(n):
	a = input()
	if a in d:
		d[a] += 1
	else:
		keys.append(a)
		d[a] = 1
if len(d) == 2:
	if d[keys[0]] == d[keys[1]]:
		print('YES')
		print(keys[0] + ' ' + keys[1])
	else:
		print('NO')
else:
	print('NO')


def main():
	n = int(input())
	a = []
	for i in range(n):
		num = int(input())
		a.append(num)
	c = list(set(a))
	b = list(map(a.count, list(set(a))))
	if len(b) == 2 and b[0] == b[1]:
		print('YES')
		print(c[0], c[1])
	else:
		print('NO')
main()


from collections import Counter
n = int(input())
l = [int(input()) for _ in range(n)]
c = Counter(l)
if len(c) != 2:
	print('NO')
	exit()
karma = 0
for i in c:
	if not karma:
		karma = 1
		prev = c[i]
	elif prev != c[i]:
		print('NO')
		exit()
print('YES')
for i in c:
	print(i, end=' ')


n = int(input())
l = []
for i in range(0, n):
	a = int(input())
	l.append(a)
mn = min(l)
mx = max(l)
if mn != mx and l.count(mn) == n / 2 and (l.count(mx) == n / 2):
	print('YES')
	print(str(l[0]) + ' ' + str(mn + mx - l[0]))
else:
	print('NO')


n = int(input())
a = [int(input()) for _ in [0] * n]
b = {*a}
print('NO' if len(b) != 2 or a.count(a[0]) != n // 2 else f'YES\n{[*b][0]} {[*b][1]}')


int1 = int(input())
y = []
for i in range(int1):
	g = int(input())
	y.append(g)
set1 = sorted(set(y))
f = list(set1)
if len(set1) == 2 and y.count(f[0]) == y.count(f[1]):
	print('YES')
	print(f[0], f[1])
else:
	print('NO')


a = []
n = int(input())
for i in range(n):
	t = int(input())
	a.append(t)
b = set(a)
b = list(b)
if len(b) > 2:
	print('NO')
elif len(b) == 1:
	print('NO')
elif a.count(b[0]) == a.count(b[1]):
	print('YES')
	print(b[0], b[1])
else:
	print('NO')


n = int(input())
d = dict()
for i in range(n):
	num = int(input())
	if num not in d:
		d[num] = 1
	else:
		d[num] += 1
ans = list(d.keys())
if len(ans) == 2 and d[ans[0]] == d[ans[1]]:
	print('YES')
	print(ans[0], ans[1])
else:
	print('NO')


n = int(input())
li = []
for i in range(n):
	s = int(input())
	li.append(str(s))
uniq = list(set(li))
if len(uniq) % 2 == 0 and len(uniq) == 2:
	if li.count(uniq[0]) == li.count(uniq[1]):
		print('YES')
		bl = list(sorted(uniq))
		B = ' '.join(bl)
		print(B)
	else:
		print('NO')
else:
	print('NO')


def ip(func=int):
	ls = list(map(func, input().split()))
	return ls if len(ls) > 1 else ls[0]
n = ip()
a = [ip() for _ in range(n)]
if len(set(a)) != 2 or len([i for i in a if i == a[0]]) != n // 2:
	print('NO')
else:
	a = list(set(a))
	print('YES')
	print(a[0], a[1])


n = int(input())
l = [0] * n
for i in range(n):
	t = int(input())
	l[i] = t
d = {}
k = 0
for i in range(n):
	d[l[i]] = 0
for i in range(n):
	d[l[i]] = d[l[i]] + 1
l = list(set(l))
if len(l) == 2 and d[l[0]] == d[l[1]]:
	print('YES')
else:
	print('NO')
	k = 1
if k == 0:
	print(l[0], l[1])


n = int(input())
s = []
for i in range(n):
	s.append(int(input()))
t = set(s)
c = []
for i in t:
	count = 0
	for j in s:
		if i == j:
			count += 1
	c.append(count)
if len(c) > 2:
	print('NO')
elif c == list(set(c)):
	print('NO')
elif c[0] != c[1]:
	print('NO')
else:
	print('YES')
	for i in t:
		print(i, end=' ')


n = int(input())
a = [int(input()) for i in range(n)]
if len(set(a)) != 2 or len([i for i in a if i == a[0]]) != n // 2:
	print('NO')
else:
	a = list(set(a))
	print('YES')
	print(a[0], a[1])


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = vary(1)
arr = []
for _ in range(testcases):
	arr.append(vary(1))
arr.sort()
n = len(arr)
if arr[0] == arr[n // 2 - 1] and arr[n // 2] == arr[n - 1] and (arr[0] != arr[n - 1]):
	print('YES')
	print(arr[0], arr[-1])
else:
	print('NO')


a = []
n = int(input())
for i in range(n):
	a.append(int(input()))
a.sort()
print('YES' + '\n' + str(a[0]) + ' ' + str(a[n - 1]) if a[0] == a[n // 2 - 1] and a[n // 2] == a[n - 1] and (a[0] != a[n - 1]) else 'NO')


n = int(input())
lst = [int(input()) for i in range(n)]
sets = list(set(lst))
print('YES\n%i %i' % (sets[0], sets[1]) if len(sets) == 2 and lst.count(sets[0]) == lst.count(sets[1]) else 'NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if len(set(a)) > 2:
	print('NO')
else:
	hsh = [0] * 101
	for i in a:
		hsh[i] += 1
	flag = 0
	for i in range(len(hsh)):
		if hsh[i] != 0:
			for j in range(i + 1, len(hsh)):
				if hsh[j] == hsh[i]:
					print('YES')
					print(i, j)
					flag = 1
					break
	if flag == 0:
		print('NO')


n = int(input())
a = []
counta = 0
countb = 0
for i in range(n):
	a.append(input())
max = set(a)
if len(max) == 1:
	print('NO')
elif n == 2:
	for k in range(1, 2):
		if a[k] == a[k - 1]:
			print('NO')
		else:
			max = set(a)
			aa = int(list(max)[0])
			bb = int(list(max)[1])
			print('YES')
			print(aa, bb)
else:
	max = set(a)
	aa = int(list(max)[0])
	bb = int(list(max)[1])
	for p in range(n):
		if aa == int(a[p]):
			counta += 1
		else:
			countb += 1
	if len(max) == 2 and counta == countb:
		print('YES')
		aa = int(list(max)[0])
		bb = int(list(max)[1])
		print(aa, bb)
	else:
		print('NO')


n = int(input())
a = []
for x in range(n):
	a += [int(input())]
if len(set(a)) == 2:
	if a.count(list(set(a))[0]) == a.count(list(set(a))[1]):
		print('YES')
		print(list(set(a))[0], list(set(a))[1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
if n % 2 == 1:
	print('NO')
else:
	out = True
	a = [0] * n
	for i in range(n):
		a[i] = int(input())
	a = sorted(a)
	if a[0] != a[n // 2 - 1]:
		out = False
	if a[n // 2] != a[n - 1]:
		out = False
	if a[0] == a[n - 1]:
		out = False
	if out:
		print('YES')
		print(a[0], a[n - 1])
	else:
		print('NO')


def insertionsort(a):
	b = []
	c = 0
	for i in range(len(a)):
		for j in range(len(b)):
			if a[i] < b[j]:
				break
			c = j
		b.insert(c + 1, a[i])
	return b
a = int(input())
p = []
for j in range(a):
	p.append(int(input()))
y = 0
z = 0
v = ''
p = insertionsort(p)
for i in range(len(p)):
	if p[i] == p[0]:
		y += 1
	if p[i] == p[len(p) // 2]:
		z += 1
if y == z == len(p) / 2 and p[0] != p[len(p) // 2]:
	print('YES')
	v = str(p[0]) + ' ' + str(p[len(p) // 2])
	print(v)
else:
	print('NO')


l = {}
num = []
n = int(input())
for i in range(n):
	a = int(input())
	if a not in l:
		l[a] = 1
		num.append(a)
	else:
		l[a] += 1
if len(num) == 2 and l[num[0]] == l[num[1]]:
	print('YES\n{} {}'.format(num[0], num[1]))
else:
	print('NO')


n = int(input())
a = int(input())
ak = 1
b = 0
bk = 0
for i in range(2, n + 1):
	b = int(input())
	if b != a:
		bk = 1
		break
	else:
		ak += 1
for j in range(i, n):
	k = int(input())
	if k == a:
		ak += 1
	if k == b:
		bk += 1
if ak == bk and ak + bk == n:
	print('YES')
	print(a, b)
else:
	print('NO')


q = {}
for _ in ' ' * int(input()):
	a = int(input())
	q[a] = q.get(a, 0) + 1
if len(q) == 2:
	if max(q.values()) == min(q.values()):
		print('YES')
		print(*q, end=' ')
		exit()
print('NO')


n = int(input())
lis = [0] * 101
for i in range(n):
	x = int(input())
	lis[x] += 1
distints = 0
for i in range(1, 101):
	if lis[i]:
		distints += 1
	if distints > 2:
		break
if distints == 2:
	nos = []
	for i in range(1, 101):
		if lis[i]:
			nos.append([i, lis[i]])
	if nos[0][1] == nos[1][1]:
		print('YES')
		print(nos[0][0], nos[1][0])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
cards = list(map(int, (input() for i in range(n))))
cardsset = set(cards)
if len(cardsset) == 2:
	card1 = min(cardsset)
	card2 = max(cardsset)
	card1c = cards.count(card1)
	card2c = cards.count(card2)
	if card1c + card2c == n and card1c == card2c:
		print('YES')
		print(card1, card2)
	else:
		print('NO')
else:
	print('NO')


N = int(input())
n = []
for i in range(N):
	n.append(int(input()))
first = n[0]
first_n = 0
second = '?'
second_n = 0
for i in n:
	if i == first:
		first_n += 1
	elif i != first and second == '?' or i == second:
		second = i
		second_n += 1
	else:
		print('NO')
		break
else:
	if first_n != second_n:
		print('NO')
	else:
		print('YES')
		print(first, second)


n = int(input())
l = []
for i in range(0, n):
	a = int(input())
	l.append(a)
l.sort()
c = 1
m = l[0]
for i in range(len(l)):
	if l[i] != m:
		c = c + 1
		m = l[i]
if c != 2:
	print('NO')
else:
	m = l[0]
	(c, d) = (0, 0)
	for i in range(len(l)):
		if m == l[i]:
			c = c + 1
		else:
			d = i
			break
	if c != len(l) // 2:
		print('NO')
	else:
		li = []
		li.append(l[0])
		li.append(l[d])
		print('YES')
		for i in li:
			print(i, end=' ')


n = int(input())
d = {}
count = 0
for i in range(n):
	t = int(input())
	if t not in d:
		d[t] = 1
		count = count + 1
	else:
		d[t] = d[t] + 1
if count == 2:
	t = 0
	for i in d:
		t = d[i]
		break
	flag = 0
	c = []
	for i in d:
		if d[i] != t:
			flag = 1
			break
	if flag == 0:
		print('YES')
		for i in d:
			print(i, end=' ')
		print()
	else:
		print('NO')
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
s = set(l)
l1 = list(s)
x = l.count(l1[0])
if len(s) == 2 and x == n - x:
	print('YES')
	print(*s)
else:
	print('NO')


n = int(input())
a = []
cnt = [0] * 101
for i in range(n):
	a.append(int(input()))
	cnt[a[-1]] += 1
s = list(set(a))
if len(s) != 2 or cnt[s[0]] != cnt[s[1]]:
	print('NO')
else:
	print('YES\n' + str(s[0]) + ' ' + str(s[1]))


from collections import Counter
n = int(input())
l = []
for _ in range(n):
	l.append(int(input()))
val = list(Counter(l).values())
key = list(Counter(l).keys())
if len(key) != 2:
	print('NO')
	exit()
if val[0] == val[1]:
	print('YES')
	print(key[0], key[1])
else:
	print('NO')


n = int(input())
a = list((int(input()) for i in range(n)))
if len(set(a)) == 2 and a.count(list(set(a))[0]) == a.count(list(set(a))[1]):
	a = list(set(a))
	print('YES')
	print(min(a), max(a))
else:
	print('NO')


q = 1
a = []
temp = ''
n = int(input())
while n > 0:
	n -= 1
	a.append(int(input()))
temp = list(set(a))
if len(temp) == 2 and a.count(temp[0]) == a.count(temp[1]):
	print('YES')
	print(*temp)
else:
	print('NO')


from collections import Counter

def main():
	n = int(input())
	a = []
	for _ in range(n):
		a.append(int(input()))
	c = Counter(a)
	freqs = c.most_common()
	safe = len(freqs) == 2 and freqs[0][1] == freqs[1][1] and (freqs[0][1] + freqs[1][1] == n)
	if safe:
		print('YES')
		print(freqs[0][0], freqs[1][0])
	else:
		print('NO')
main()


n = int(input())
lst = []
for i in range(n):
	lst.append(int(input()))
st = set(lst)
if len(st) != 2:
	print('NO')
	exit()
ls = list(st)
if lst.count(ls[0]) == lst.count(ls[1]):
	print('YES')
	print(ls[0], ls[1], sep=' ')
	exit()
print('NO')


from sys import setcheckinterval, stdin
setcheckinterval(1000)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))
n = iin()
dc = {}
a = []
for i in range(n):
	a.append(iin())
	try:
		dc[a[-1]] += 1
	except:
		dc[a[-1]] = 1
v = list(dc.values())
if len(dc) == 2 and v[0] == v[1]:
	print('YES')
	print(*set(a))
else:
	print('NO')


n = int(input())
m = []
for i in range(0, n):
	m = m + [[x for x in input().split()]]
if m.count(min(m)) == len(m) / 2 and m.count(max(m)) == len(m) / 2:
	print('YES')
	print(min(m)[0], max(m)[0])
else:
	print('NO')


a = int(input())
b = []
c = []
for i in range(a):
	b.append(int(input()))
c = list(set(b))
d = [0 for i in range(len(c))]
for i in range(len(c)):
	for j in range(len(b)):
		if c[i] == b[j]:
			d[i] += 1
n = 0
e = []
for i in range(len(c)):
	for j in range(len(c)):
		if i == j:
			continue
		if d[i] == d[j]:
			e.append((c[i], c[j]))
			n += 1
f = list(set(e))
if n == 2 and d[0] == d[-1] == a // 2:
	print('YES')
	for i in range(int(len(f) / 2)):
		print(f[i][0], f[i][1])
else:
	print('NO')


n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
larr = list(set(arr))
if len(larr) == 2 and arr.count(larr[0]) == arr.count(larr[1]):
	print('YES')
	print('{0} {1}'.format(larr[0], larr[1]))
else:
	print('NO')


cards = int(input())
cards_num = []
for x in range(cards):
	z = int(input())
	cards_num.append(z)
cards_num.sort()
x = cards_num[0]
y = cards_num[-1]
ans = {x: 0, y: 0}
try:
	for z in range(cards):
		ans[cards_num[z]] += 1
except KeyError:
	print('NO')
	exit()
if ans[cards_num[0]] == ans[cards_num[-1]] and cards_num[0] != cards_num[-1]:
	print('YES')
	print(f'{cards_num[0]} {cards_num[-1]}')
else:
	print('NO')


n = int(input())
histo = {}
for _ in range(n):
	card = int(input())
	if card not in histo:
		histo[card] = 1
	else:
		histo[card] += 1
keys = list(histo.keys())
vals = list(histo.values())
if len(keys) == 2 and vals[0] == vals[1]:
	print('YES')
	print('{} {}'.format(keys[0], keys[1]))
else:
	print('NO')


x = 0
n = int(input())
A = [0] * 101
while x < n:
	a = int(input())
	for i in range(101):
		if i == a:
			A[i] += 1
	x += 1
kol = 0
summ = 0
B = []
index1 = index2 = 0
for i in range(101):
	if A[i] > 0:
		B.append(A[i])
		index2 = index1
		index1 = i
		kol += 1
		summ += A[i]
if kol == 2 and B[0] == B[1]:
	print('YES\n', index1, index2)
else:
	print('NO')


from collections import Counter
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
C = dict(Counter(A))
if len(C.keys()) == 2 and list(C.values())[0] == list(C.values())[1]:
	print('YES')
	print(list(C.keys())[0], list(C.keys())[1])
else:
	print('NO')


from sys import *
from decimal import *
getcontext().prec = 100

class graph:

	def __init__(self, sz, is_oriented):
		self.g = []
		for i in range(sz):
			self.g.append(set())
		self.size = sz
		self.oriented = is_oriented

	def __str__(self):
		out = 'size: {0}\n'.format(self.size)
		for i in range(self.size):
			out += '{0} -> '.format(i + 1)
			for j in self.g[i]:
				out += str(j)
			out += '\n'
		return out

	def addvertex(self):
		self.g.append(set())

	def addedge(self, u, v):
		self.g[u].add(v)
		if self.oriented:
			self.g[v].add[u]

	def neighbours(self, v):
		return self.g[v]

	def is_neighbour(self, u, v):
		return v in self.g[u]

class dsu:

	def __init__(self, number):
		self.par = [z for z in range(number + 1)]
		self.rk = [0] * (number + 1)
		self.size = number

	def find(self, a):
		if a == self.par[a]:
			return a
		self.par[a] = self.find(self.par[a])
		return self.par[a]

	def unite(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return 0
		if self.rk[a] < self.rk[b]:
			(a, b) = (b, a)
		self.par[b] = a
		if self.rk[a] == self.rk[b]:
			self.rk[a] += 1
		return 1

	def create(self):
		self.size += 1
		self.par.append(self.size)
		self.rk.append(0)

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
cnt = dict()
st = set()
arr = []
for i in range(n):
	k = int(input())
	if not cnt.get(k):
		cnt[k] = 1
	cnt[k] += 1
	st.add(k)
	arr.append(k)
if len(st) != 2:
	print('NO')
	exit(0)
for lol in arr:
	if cnt[lol] != cnt[arr[0]]:
		print('NO')
		exit(0)
print('YES')
for i in st:
	print(i, end=' ')


n = int(input())
a = []
(p, v) = (0, 0)
b = []
for i in range(n):
	x = int(input())
	b.append(x)
	if x not in a:
		a.append(x)
	if len(a) > 2:
		print('NO')
		exit()
if len(a) == 2:
	for el in b:
		if el == a[0]:
			p += 1
		else:
			v += 1
	if p == v:
		print('YES')
		print(' '.join((str(el) for el in a)))
	else:
		print('NO')
else:
	print('NO')


n = int(input())
d = {}
for _ in range(n):
	t = int(input())
	if t not in d:
		d[t] = 0
	d[t] += 1
if len(d) != 2:
	print('NO')
	exit(0)
k = list(d.keys())
if d[k[0]] != d[k[1]]:
	print('NO')
else:
	print('YES')
	print(str(k[0]) + ' ' + str(k[1]))


n = int(input())
numbers = [int(input()) for i in range(n)]
setOfNumbers = list(set(numbers))
if len(setOfNumbers) == 2 and numbers.count(setOfNumbers[0]) == numbers.count(setOfNumbers[1]):
	print('YES')
	print(setOfNumbers[0], setOfNumbers[1])
else:
	print('NO')


def main():
	n = int(input())
	counts = {}
	for _ in range(n):
		number = input()
		if len(counts) < 3:
			counts[number] = counts.get(number, 0) + 1
	is_fair = True
	if len(counts) == 2:
		values = list(counts.values())
		if values[0] != values[1]:
			is_fair = False
	else:
		is_fair = False
	if is_fair:
		print('YES')
		numbers = list(counts.keys())
		print(numbers[0], numbers[1])
	else:
		print('NO')
main()


lis = []
for _ in range(int(input())):
	lis.append(int(input()))
lis = sorted(lis)
res = [lis[0], lis[-1]]
if res[0] != res[1] and len(lis) % 2 == 0:
	for i in range(len(lis) // 2):
		if lis[i] != res[0] or lis[-1 - i] != res[1]:
			print('NO')
			exit(0)
elif len(lis) % 2 != 0 or res[0] == res[1]:
	print('NO')
	exit(0)
print('YES')
print(*res)


def readln():
	return map(int, input().rstrip().split())
n = int(input())
data = []
for i in range(0, n):
	data.append(input())
x = data[0]
data = list(filter(lambda a: a != x, data))
cx = n - len(data)
if len(data) == 0:
	print('NO')
	exit()
y = data[0]
data = list(filter(lambda a: a != y, data))
cy = n - cx - len(data)
if cx != cy or len(data) != 0:
	print('NO')
else:
	print('YES')
	print('{} {}'.format(x, y))


from collections import Counter
lines = []
numCards = input()
while len(lines) < int(numCards):
	card = input()
	lines.append(card)
words = Counter(lines)
k = words.most_common()
if len(k) == 1:
	print('NO')
	exit()
if k[0][1] != k[1][1]:
	print('NO')
	exit()
takenCards = k[0][1] + k[1][1]
if int(takenCards) == int(numCards):
	print('YES')
	print(k[0][0], k[1][0])
else:
	print('NO')


n = int(input())
lis = []
for i in range(n):
	d = int(input())
	lis.append(d)
s = set(lis)
lis2 = list(s)
if len(s) == 2 and lis.count(lis2[0]) == lis.count(lis2[1]):
	print('YES')
	print(' '.join(map(str, lis2)))
else:
	print('NO')


n = int(input())
if n % 2 == 1:
	print('NO')
else:
	out = True
	a = [0] * n
	for i in range(n):
		a[i] = int(input())
	if len(set(a)) == 1 or len(set(a)) > 2:
		out = False
	if out and a.count(a[0]) != n // 2:
		out = False
	if out == False:
		print('NO')
	else:
		print('YES')
		print(*set(a))


n = int(input())
b = int(input())
a = b1 = 1
c = c1 = 0
for i in range(1, n):
	m = int(input())
	if m == b:
		b1 += 1
	elif a == 1:
		a = 2
		c = m
		c1 = 1
	elif m == c:
		c1 += 1
	else:
		a = 0
		break
if a and b1 == c1:
	print('YES')
	print('%d %d' % (b, c))
else:
	print('NO')


i = int(input())
dict = {}
if i % 2 == 0:
	for j in range(i):
		p = int(input())
		if p in dict.keys():
			dict[p] += 1
		else:
			dict[p] = 1
		i -= 1
if len(dict.keys()) == 2:
	val = []
	for j in dict.keys():
		val.append(dict[j])
	if val[0] == val[1]:
		print('YES')
		print(' '.join([str(i) for i in dict.keys()]))
	else:
		print('NO')
else:
	print('NO')


loop = int(input())
dict = {}
while loop:
	temp = int(input())
	if temp in dict.keys():
		dict[temp] += 1
	else:
		dict[temp] = 1
	loop -= 1
if len(dict.keys()) == 2:
	val = []
	for i in dict.keys():
		val.append(dict[i])
	if val[0] == val[1]:
		print('YES')
		print(' '.join([str(i) for i in dict.keys()]))
	else:
		print('NO')
else:
	print('NO')


def main():
	N = int(input())
	A = tuple((int(input()) for _ in range(N)))
	cards = dict()
	for i in A:
		cards[i] = cards.get(i, 0) + 1
	if len(cards) != 2:
		print('NO')
	else:
		v = tuple(cards.items())
		if v[0][1] == v[1][1]:
			print('YES')
			print(v[0][0], v[1][0])
		else:
			print('NO')
main()


arr = []
(x, y) = (0, 0)
k = True
n = int(input())
for i in range(n):
	a = int(input())
	arr.append(a)
p = set(arr)
s = []
if len(p) == 2:
	for i in p:
		s.append(arr.count(i))
	if s[0] == s[1]:
		print('YES')
		print(' '.join(map(str, p)))
	else:
		print('NO')
else:
	print('NO')


from collections import Counter
n = int(input())
l = []
for i in range(n):
	x = int(input())
	l.append(x)
if len(set(l)) == 2:
	x = Counter(l)
	y = []
	for j in x.values():
		y.append(j)
	if len(set(y)) == 1:
		print('YES')
		print(*set(l))
	else:
		print('NO')
else:
	print('NO')


n = int(input())
chisla = []
schet = []
for i in range(n):
	c = int(input())
	if c not in chisla:
		chisla.append(c)
		schet.append(1)
	elif chisla[-1] == c:
		schet[-1] += 1
	else:
		schet[0] += 1
if len(chisla) == 2 and schet[0] == schet[1]:
	print('YES')
	print(chisla[0], chisla[1])
else:
	print('NO')


n = int(input())
d = {}
for _ in range(n):
	s = input()
	if s in d:
		d[s] += 1
	else:
		d[s] = 1
d = sorted(d.items(), key=lambda x: x[1])
if len(d) == 2:
	for i in range(len(d) - 1):
		if d[i][1] == d[i + 1][1]:
			print('YES')
			print(d[i][0], d[i + 1][0])
			break
	else:
		print('NO')
else:
	print('NO')


num = int(input())
d = {}
y = [int(input()) for x in range(num)]
for i in y:
	d[i] = d.get(i, 0) + 1
for (h, l) in d.items():
	for (j, k) in d.items():
		if l == k and h != j and (l == num / 2):
			print('YES')
			print('{} {}'.format(h, j))
			quit()
print('NO')


def dildo():
	n = int(input())
	d = {}
	k = 0
	m = 0
	for i in range(n):
		x = int(input())
		if x not in d:
			d[x] = 1
		else:
			d[x] += 1
	l = list(d.items())
	l = sorted(l, key=lambda x: x[1])
	for i in range(len(l)):
		if len(l) % 2 == 1 or len(l) > 2:
			print('NO')
			return
		elif i != len(l) - 1 and l[i][1] == l[i + 1][1]:
			print('YES')
			print(l[i][0], l[i + 1][0])
			return
	print('NO')
dildo()


n = int(input())
l = [0 for i in range(105)]
for i in range(n):
	a = int(input())
	l[a] += 1
ls = []
v = []
for i in range(101):
	if l[i] > 0:
		ls.append([l[i], i])
		v.append(i)
ls.sort()
if len(ls) == 2:
	if ls[0][0] == n // 2:
		print('YES')
		print(ls[0][1], ls[1][1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
lst = []
for i in range(n):
	x = int(input())
	lst.append(x)
lst1 = list(set(lst))
if len(lst1) != 2:
	print('NO')
else:
	cnt = lst.count(lst1[0])
	cnt1 = lst.count(lst1[1])
	if cnt == cnt1:
		print('YES')
		print(lst1[0], lst1[1])
	else:
		print('NO')


n = int(input())
k = [None] * n
for i in range(n):
	k[i] = int(input())
s = list(set(k))
if len(s) == 2 and k.count(s[0]) == k.count(s[1]):
	print('YES')
	print(s[0], s[1])
else:
	print('NO')


l = []
f = 0
r = int(input())
for i in range(r):
	n = int(input())
	l.append(n)
l.sort()
if l[0] == l[r // 2 - 1] and l[r // 2] == l[r - 1] and (l[0] != l[r - 1]):
	print('YES')
	print(l[0], l[r - 1])
else:
	print('NO')


from sys import stdin, stdout
from collections import Counter
n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
x = dict(Counter(l))
v = list(x.values())
k = list(x.keys())
if len(k) == 2 and v[0] == v[1]:
	print('YES')
	print(k[0], k[1])
else:
	print('NO')


n = int(input())
a = [0] * 101
for i in range(n):
	x = int(input())
	a[x] += 1
res = []
for x in range(1, 101):
	if a[x] > 0:
		res.append(x)
if len(res) == 2 and a[res[0]] + a[res[1]] == n and (a[res[0]] == a[res[1]]):
	print('YES\n%d %d' % (res[0], res[1]))
else:
	print('NO')


from collections import Counter
n = int(input())
a = Counter([int(input()) for i in range(n)])
if len(a) != 2 or len(set(a.values())) != 1:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, a.keys())))


n = int(input())
k = int(input())
s1 = 1
s2 = 0
m = set()
m.add(k)
for i in range(n - 1):
	k1 = int(input())
	if k1 == k:
		s1 += 1
	else:
		s2 += 1
	m.add(k1)
if s1 == s2 and len(m) == 2:
	print('YES')
	print(*m)
else:
	print('NO')


n = int(input())
(a, b, c, d) = (-1, -1, 0, 0)
for i in range(n):
	x = int(input())
	if a == -1 or a == x:
		a = x
		c += 1
	elif b == -1 or b == x:
		b = x
		d += 1
	else:
		c = 1000
if c == d:
	print('YES')
	print(a, b)
else:
	print('NO')


n = int(input())
a = {}
for i in range(n):
	key = int(input())
	if key not in a:
		a[key] = 0
	else:
		a[key] = a.get(key) + 1
if len(a) == 2:
	c = 101
	d = ''
	k = 0
	for key in a:
		if c == a.get(key) and k > 0:
			print('YES' + '\n', end='')
			print(key, d)
		elif c != a.get(key) and k > 0:
			print('NO')
		else:
			k += 1
			c = a.get(key)
			d = key
else:
	print('NO')


n = int(input())
arr = []
count = []
for i in range(n):
	x = int(input())
	if x not in arr:
		arr.append(x)
		count.append(1)
	else:
		ind = arr.index(x)
		count[ind] += 1
if len(arr) != 2:
	print('NO')
elif count[0] == count[1]:
	print('YES')
	print(str(arr[0]) + ' ' + str(arr[1]))
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	a = int(input())
	l.append(a)
c = set(l)
c = list(c)
if len(c) == 2 and l.count(c[0]) + l.count(c[1]) == n and (l.count(c[0]) == l.count(c[1])):
	print('YES')
	f = sorted(c)
	print(*f)
else:
	print('NO')


n = int(input())
b = []
for i in range(n):
	c = int(input())
	b.append(c)
b.sort()
if n == 2:
	if b[0] != b[-1]:
		print('YES')
		print(b[0], b[-1])
	else:
		print('NO')
elif b[0] == b[n // 2 - 1] and b[n // 2] == b[-1]:
	if b[0] != b[-1]:
		print('YES')
		print(b[0], b[-1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
array = []
for i in range(0, n):
	array.append(int(input()))
array = sorted(array)
if array[0] == array[int(n / 2) - 1] and array[n - int(n / 2)] == array[n - 1] and (array[0] != array[n - 1]):
	print('YES\n' + str(array[0]) + ' ' + str(array[n - 1]))
else:
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
b = a[0:int(n // 2)]
c = a[n // 2:n]
d = True
if b[0] == c[0]:
	d = False
else:
	for i in range(1, n // 2):
		if b[i] != b[0] or c[i] != c[0]:
			d = False
if d:
	print('YES')
	print(b[0], c[0])
else:
	print('NO')


n = int(input())
ans = []
lst = []
for i in range(n):
	x = int(input())
	lst.append(x)
	if x not in ans:
		ans.append(x)
if len(ans) == 2 and lst.count(ans[0]) == lst.count(ans[1]):
	print('YES')
	print(' '.join(map(str, ans)))
else:
	print('NO')


n = int(input())
a = []
cnt = []
for i in range(n):
	a.append(int(input()))
set_a = set(a)
if len(set_a) != 2:
	print('NO')
elif a.count(max(set_a)) == a.count(min(set_a)):
	print('YES')
	print(min(set_a), max(set_a))
else:
	print('NO')


n = int(input())
s = set()
d = dict()
for i in range(n):
	k = int(input())
	s.add(k)
	if k not in d:
		d[k] = 1
	else:
		d[k] += 1
if len(s) != 2:
	print('NO')
else:
	s = list(s)
	if d[s[0]] == d[s[1]]:
		print('YES')
		print(s[0], s[1])
	else:
		print('NO')


from collections import Counter
n = int(input())
arr = []
for i in range(n):
	arr.append(int(input()))
ctr = Counter(arr)
if len(ctr) == 2:
	c = []
	ind = []
	for i in ctr:
		c.append(ctr[i])
		ind.append(i)
	if c[0] == c[1]:
		print('YES')
		print(ind[0], ind[1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
freq = {}
for _ in range(n):
	num = int(input())
	freq[num] = freq.get(num, 0) + 1
keys = list(freq.keys())
if len(keys) == 2 and freq[keys[0]] == n // 2:
	print('YES')
	print(*keys)
else:
	print('NO')


n = int(input())
c = []
z = []
for i in range(n):
	x = int(input())
	c.append(x)
	z.append(x)
c = set(c)
c = list(c)
if len(c) == 2 and n % 2 == 0 and (z.count(c[0]) == n // 2):
	print('YES')
	print(c[0], end=' ')
	print(c[1], end=' ')
else:
	print('NO')


n = int(input())
l = []
for u in range(n):
	l.append(int(input()))
d = list(set(l))
s = len(d)
if s == 2 and l.count(d[0]) == l.count(d[1]):
	print('YES')
	print(*d)
else:
	print('NO')


def main():
	n = int(input())
	dic = {}
	for i in range(n):
		inp = int(input())
		if inp in dic:
			dic[inp] += 1
		else:
			dic[inp] = 1
	for i in dic:
		for j in dic:
			if dic[i] == dic[j] and i != j and (dic[i] + dic[j] == n):
				print('YES')
				print(i, j)
				return
	print('NO')
main()


num = int(input())
lst = []
p = 0
j = 0
for i in range(num):
	n = int(input())
	if n in lst and n == lst[0]:
		p += 1
		continue
	elif n in lst and n == lst[1]:
		j += 1
		continue
	else:
		lst.append(n)
if len(lst) == 2 and p == j:
	print('YES')
	print(f'{lst[0]} {lst[1]}')
else:
	print('NO')


n = int(input())
arr = []

def contain(arr, a):
	for (i, t) in arr:
		if i == a:
			return True
	return False

def increment(arr, a):
	for i in range(0, len(arr)):
		if arr[i][0] == a:
			arr[i] = (arr[i][0], arr[i][1] + 1)
while n:
	a = int(input())
	if not contain(arr, a):
		arr.append((a, 1))
	else:
		increment(arr, a)
	n = n - 1
if len(arr) == 2:
	if arr[0][1] == arr[1][1]:
		print('YES')
		for (i, t) in arr:
			print(i, end=' ')
	else:
		print('NO')
else:
	print('NO')


from sys import stdin, stdout
n = int(stdin.readline())
count = [0 for i in range(1000)]
s = set()
for i in range(n):
	a = int(stdin.readline())
	s.add(a)
	count[a] += 1
if len(s) == 2 and count.count(max(count)) == 2:
	s = list(s)
	stdout.write('YES\n' + str(s[0]) + ' ' + str(s[1]))
else:
	stdout.write('NO')


n = int(input())
cards = []
for i in range(1, n + 1):
	cards.append(int(input()))
cards = sorted(cards)
first_part = cards[n // 2 - 1] == cards[0]
second_part = cards[n // 2] == cards[-1]
compare_1 = cards[0] != cards[-1]
compare_2 = cards[n // 2] != cards[n // 2 - 1]
if first_part and second_part and compare_1 and compare_2:
	print('YES')
	print(cards[0], cards[-1])
else:
	print('NO')


n = int(input(), base=10)
alist = []
for i in range(n):
	ai = int(input())
	alist.append(ai)
alist.sort()
List = list(set(alist))
List.sort()
Len = len(List)
flag = 1
for i in range(n // 2):
	if alist[n // 2] == alist[i]:
		flag = 0
		break
if Len == 2 and alist[n // 2] != alist[n // 2 - 1] and flag:
	print('YES')
	print(alist[n // 2 - 1], alist[n // 2])
else:
	print('NO')


m = set()
n = int(input())
mp = {}
for i in range(n):
	x = int(input())
	m.add(x)
	if x in mp:
		mp[x] += 1
	else:
		mp[x] = 1
if len(m) == 2:
	n1 = list(m)[0]
	n2 = list(m)[1]
if len(m) == 2 and n1 != n2 and (mp[n1] == mp[n2]):
	print('YES')
	print(list(m)[0], list(m)[1])
else:
	print('NO')


i = int(input())
a = {}
for n in range(i):
	x = int(input())
	if x in a:
		a[x] += 1
	else:
		a[x] = 1
if len(a) == 2 and list(a.values())[0] == list(a.values())[1]:
	print('YES')
	print(*list(a.keys()))
else:
	print('NO')


import os
import sys
if 'PYCHARM' in os.environ:
	sys.stdin = open('in', 'r')
n = int(input())
N = 101
c = [0] * N
for i in range(n):
	c[int(input())] += 1
d = set()
dg = []
cn = 0
for i in range(N):
	if c[i]:
		d.add(c[i])
		dg.append(i)
if len(dg) == 2 and len(d) == 1:
	print('YES')
	print(*dg)
else:
	print('NO')


n = int(input())
m = []
for i in range(n):
	m.append(int(input()))
if m.count(m[0]) == n // 2:
	x = m[0]
	for i in range(n // 2):
		m.remove(x)
	y = m[0]
	for i in range(n // 2):
		if y in m:
			m.remove(y)
	if len(m) == 0:
		print('YES')
		print(x, y)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
k = int(input())
a = set()
a.add(k)
p1 = 1
p2 = 0
for i in range(n - 1):
	k1 = int(input())
	if k1 == k:
		p1 += 1
	else:
		p2 += 1
		a.add(k1)
if p1 == p2 and len(a) == 2:
	print('YES')
	print(' '.join((str(x) for x in a)))
else:
	print('NO')


n = int(input())
e = set()
d = {}
for i in range(n):
	x = int(input())
	try:
		d[x] = d[x] + 1
	except:
		d[x] = 1
if len(d) != 2:
	print('NO')
else:
	L = []
	A = []
	for x in d:
		L.append(d[x])
		A.append(x)
	if L[0] == L[1]:
		print('YES', end='\n')
		print(str(A[0]) + ' ' + str(A[1]))
	else:
		print('NO')


n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
if len(set(arr)) != 2 or n % 2 == 1:
	print('NO')
else:
	(a, b) = map(int, list(set(arr)))
	if arr.count(a) == arr.count(b):
		print('YES')
		print(a, b)
	else:
		print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
peterNb = l[0]
countP = 0
countV = 0
found = False
for i in range(1, len(l)):
	if l[i] != peterNb and (not found):
		varyNb = l[i]
		found = True
	elif found and l[i] != peterNb and (l[i] != varyNb):
		print('NO')
		break
	elif l[i] == peterNb:
		countP += 1
	elif l[i] == varyNb and found:
		countV += 1
	if i == len(l) - 1:
		if countV == countP:
			print('YES')
			print(peterNb, varyNb)
		else:
			print('NO')


number_of_cards = int(input())
cards = [0 for x in range(number_of_cards)]
for i in range(number_of_cards):
	cards[i] = int(input())
cards.sort()
first_number = cards[0]
cards_with_first_number = 1
while cards_with_first_number < len(cards) and cards[cards_with_first_number] == first_number:
	cards_with_first_number += 1
if cards_with_first_number < len(cards):
	second_number = cards[cards_with_first_number]
	cards_with_second_number = 1
	while cards_with_first_number + cards_with_second_number < len(cards) and cards[cards_with_first_number + cards_with_second_number] == second_number:
		cards_with_second_number += 1
	if cards_with_first_number + cards_with_second_number < len(cards) or cards_with_first_number != cards_with_second_number:
		print('NO')
	else:
		print('YES')
		print(first_number, second_number)
else:
	print('NO')


def chestnaya_igra(lst):
	a = list()
	for elem in lst:
		if lst.count(elem) == len(lst) // 2:
			a.append(elem)
	if len(set(a)) == 2:
		return ('YES', sorted(list(set(a))))
	return ('NO', [0])
n = int(input())
b = list()
for i in range(n):
	z = int(input())
	b.append(z)
print(chestnaya_igra(b)[0])
if chestnaya_igra(b)[1] != [0]:
	print(*chestnaya_igra(b)[1])


n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
b = list(set(a))
if len(b) == 2:
	if a.count(b[0]) == a.count(b[1]):
		print('YES')
		print(*b)
	else:
		print('NO')
else:
	print('NO')


a = int(input())
b = []
for i in range(a):
	b.append(int(input()))
sum1 = 0
c = []
if a % 2 == 1:
	print('NO')
else:
	for i in range(a):
		if b[i] == b[0]:
			sum1 += 1
	if sum1 == a / 2:
		sum2 = 0
		for i in range(a):
			if b[i] != b[0]:
				c.append(b[i])
		for j in range(int(a / 2)):
			if c[j] == c[0]:
				sum2 += 1
		if sum2 == sum1:
			print('YES')
			print(b[0], c[0])
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
lst = []
lst1 = []
for i in range(n):
	n1 = int(input())
	lst.append(n1)
s = set(lst)
for k in s:
	lst1.append(k)
lst1.sort()
if len(s) == 2:
	if lst.count(lst1[0]) == lst.count(lst1[1]):
		print('YES')
		print(lst1[0], lst1[1])
	else:
		print('NO')
else:
	print('NO')


n = int(input())
list1 = []
for i in range(n):
	x = int(input())
	list1.append(x)
s = set(list1)
list2 = list(s)
if len(s) != 2:
	print('NO')
else:
	d = 0
	t = list2[0]
	for i in range(n):
		if list1[i] == t:
			d = d + 1
	if 2 * d == n:
		print('YES')
		print(list2[0], list2[1])
	else:
		print('NO')


import collections
c = collections.Counter()
n = int(input())
for i in range(n):
	t = input()
	c[t] += 1
if len(c) == 2:
	t = list(c.values())
	if t[0] == t[1]:
		print('YES')
		print(' '.join(c.keys()))
	else:
		print('NO')
else:
	print('NO')


n = int(input())
dictx = {}
for j in range(n):
	i = int(input())
	if i in dictx.keys():
		dictx[i] += 1
	else:
		dictx[i] = 1
if len(dictx.keys()) == 2:
	for i in dictx.keys():
		if dictx[i] == n // 2:
			print('YES')
			print(*dictx.keys())
			break
		else:
			print('NO')
			break
else:
	print('NO')


n = int(input())
uniq = []
count = {}
for i in range(n):
	a = int(input())
	if a not in count:
		uniq.append(a)
		count[a] = 1
	elif a in count:
		count[a] = count[a] + 1
if len(count) != 2 or count[uniq[0]] != count[uniq[1]]:
	print('NO')
elif len(count) == 2 and count[uniq[0]] == count[uniq[1]]:
	print('YES')
	print(uniq[0], uniq[1])


from collections import Counter
n = int(input())
numbers = []
for _ in range(n):
	numbers.append(int(input()))
unique_nums = set(numbers)
counts = list(Counter(numbers).values())
if len(unique_nums) == 2 and counts[0] == counts[1]:
	print('YES')
	print(' '.join((str(i) for i in unique_nums)))
else:
	print('NO')


n = int(input())
a = []
while n:
	a.append(int(input()))
	n -= 1
a.sort()
first = a[0]
second = a[int(len(a) / 2)]
dem = -1
if first == second:
	print('NO')
	quit()
for i in a:
	dem += 1
	if dem < int(len(a) / 2) and i != first:
		print('NO')
		quit()
	elif dem >= int(len(a) / 2) and i != second:
		print('NO')
		quit()
print('YES')
print(first, second)


def func():
	v = []
	c = [0] * 3
	for i in range(int(input())):
		item = int(input())
		if item not in v:
			v.append(item)
		c[v.index(item)] += 1
		if len(v) == 3:
			print('NO')
			return
	if len(v) == 2 and c[0] == c[1]:
		print('YES')
		print(f'{v[0]} {v[1]}')
	else:
		print('NO')
func()


n = int(input())
list1 = []
for i in range(n):
	list1.append(int(input()))
list2 = list(set(list1))
list2.sort()
if len(list2) != 2:
	print('NO')
elif list1.count(list1[0]) != len(list1) * 0.5:
	print('NO')
else:
	print('YES')
	for i in list2:
		print(i, end=' ')


n = int(input())
m = {}
for _ in range(n):
	x = int(input())
	if x not in m:
		m[x] = 0
	m[x] += 1
if len(m) <= 1 or len(m) > 2:
	print('NO')
else:
	tmp = list(m.values())
	if tmp[0] == tmp[1]:
		print('YES')
		tmp1 = list(m.keys())
		print('{} {}'.format(tmp1[0], tmp1[1]))
	else:
		print('NO')


n = int(input())
g = []
s = 0
for i in range(n):
	c = int(input())
	if c in g:
		g.append(c)
	elif c not in g:
		g.append(c)
		s += 1
g.sort()
if g.count(g[0]) + g.count(g[-1]) == n and s % 2 == 0 and (g.count(g[0]) == g.count(g[-1])):
	print('YES')
	print(g[0], g[-1])
else:
	print('NO')


n = int(input())
z = []
for _ in range(n):
	z.append(int(input()))
p = list(set(z))
if len(set(z)) == 2 and z.count(p[0]) == z.count(p[1]):
	(print('YES'), print(p[0], p[1]))
else:
	print('NO')


n = int(input())
d = dict()
for _ in range(n):
	a = int(input())
	if a not in d.keys():
		d[a] = 1
	else:
		d[a] += 1
if len(d.keys()) != 2:
	print('NO')
else:
	v = set()
	for val in d.values():
		v.add(val)
	if len(v) == 1:
		print('YES')
		print(*d.keys())
	else:
		print('NO')


n = int(input())
nums = []
j = 0
for i in range(n):
	k = int(input())
	nums.append(k)
if n % 2 != 0:
	print('NO')
	exit()
nums.sort()
if len(set(nums)) == 2 and nums.count(nums[0]) == nums.count(nums[-1]):
	print('YES')
	print(*set(nums))
else:
	print('NO')


n = int(input())
d = []
for i in range(n):
	s = int(input())
	d.append(s)
se = list(set(d))
if len(set(d)) == 2 and d.count(se[0]) == d.count(se[1]):
	print('YES')
	print(se[0], se[1])
else:
	print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
s = list(set(a))
if len(s) % 2 != 0:
	print('NO')
else:
	l = a.count(s[0])
	m = n - l
	if l == m:
		print('YES')
		print(*s)
	else:
		print('NO')


from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
	d[int(input())] += 1
if len(d.keys()) != 2:
	print('NO')
else:
	keys = list(d.keys())
	if d[keys[0]] != d[keys[1]]:
		print('NO')
	else:
		print('YES')
		print('%d %d' % (keys[0], keys[1]))


n = int(input())
l = []
while n > 0:
	l.append(int(input()))
	n = n - 1
s = set(l)
if len(s) != 2:
	print('NO')
	exit()
s = list(s)
x = l.count(s[0])
y = l.count(s[1])
if x != y:
	print('NO')
	exit()
print('YES')
print(s[0], s[1])


from collections import defaultdict

def main():
	count = int(input())
	number_to_count = defaultdict(int)
	for _ in range(count):
		number_to_count[int(input())] += 1
	(is_win, cards) = count_strategy(number_to_count)
	if is_win:
		print('YES')
		print('{} {}'.format(cards[0], cards[1]))
	else:
		print('NO')

def count_strategy(number_to_count):
	keys = list(number_to_count.keys())
	if len(keys) != 2:
		return (False, [])
	if number_to_count[keys[0]] == number_to_count[keys[1]]:
		return (True, [keys[0], keys[1]])
	return (False, [])

def test1():
	(result, numbers) = count_strategy({11: 2, 27: 2})
	assert result
	assert sorted(numbers) == [11, 27]

def test2():
	(result, numbers) = count_strategy({2: 1, 6: 2})
	assert not result
	assert numbers == []

def test3():
	(result, numbers) = count_strategy({1: 2, 2: 2, 3: 3})
	assert not result
	assert numbers == []
main()


n = int(input())
D = dict()
for i in range(n):
	x = input()
	D[x] = D.get(x, 0) + 1
if len(D) == 2 and D[list(D)[0]] == D[list(D)[1]]:
	print('YES')
	print(list(D)[0], list(D)[1])
else:
	print('NO')


read = lambda : tuple(map(int, input().split()))
n = read()[0]
arr = sorted([read()[0] for i in range(n)])
arrN = []
c = -1
k = 0
for el in arr:
	if el != c:
		arrN += [[k, c]]
		c = el
		k = 0
	k += 1
arrN += [[k, c]]
arrN = arrN[1:]
if len(arrN) != 2:
	print('NO')
elif arrN[0][0] == arrN[1][0]:
	print('YES')
	print(arrN[0][1], arrN[1][1])
else:
	print('NO')


def main():
	n = int(input())
	L = [None] * n
	for i in range(n):
		L[i] = int(input())
	solver(L)

def solver(L):
	counts = dict()
	for x in L:
		if x in counts:
			counts[x] += 1
		else:
			counts[x] = 1
			if len(counts) > 2:
				print('NO')
				return
	revCounts = dict()
	for x in counts:
		if counts[x] in revCounts:
			print('YES')
			print(x, revCounts[counts[x]])
			return
		else:
			revCounts[counts[x]] = x
	print('NO')
	return
main()


from collections import defaultdict
n = int(input())
a = defaultdict(int)
for i in range(n):
	k = int(input())
	a[k] += 1
if len(a.keys()) != 2:
	print('NO')
	exit()
prev_k = -1
prev_v = -1
for (k, v) in sorted(a.items(), key=lambda x: x[1]):
	if v == prev_v:
		print('YES')
		print(prev_k, k)
		exit()
	prev_k = k
	prev_v = v
else:
	print('NO')


from collections import defaultdict
n = int(input())
a = defaultdict(int)
for i in range(n):
	a[input()] += 1
if len(a) == 2 and len(set(a.values())) == 1:
	print('YES')
	print(*a)
else:
	print('NO')


n = int(input())
a = dict()
for i in range(n):
	x = int(input())
	if x in a:
		a[x] += 1
	else:
		a[x] = 1
(c, d) = (False, False)
for key in a:
	for k in a:
		if a[key] == a[k] and a[key] + a[k] == n and (key != k):
			(c, d) = (key, k)
if c and d:
	print('YES')
	print(c, d, sep=' ')
else:
	print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
l2 = []
for x in l:
	if x not in l2:
		l2.append(x)
if len(l2) != 2:
	print('NO')
	exit(0)
if l.count(l2[0]) == n // 2:
	print('YES')
	print(l2[0], l2[1])
else:
	print('NO')


n = int(input())
a = list()
ans = str()
for i in range(n):
	d = int(input())
	a.append(d)
s = set(a)
if len(s) != 2:
	ans = 'NO'
else:
	b = list(s)
	x = a.count(b[0])
	y = a.count(b[1])
	if x != y:
		ans = 'NO'
	else:
		ans = 'YES'
print(ans)
if ans == 'YES':
	print(b[0], b[1])


print((lambda L: 'YES\n%d %d' % (L[0], L[-1]) if L.count(L[0]) == L.count(L[-1]) == len(L) / 2 else 'NO')(sorted([int(input()) for i in range(int(input()))])))


n = int(input())
numbers = []
for i in range(n):
	number = int(input())
	numbers.append(number)
ans = numbers[0]
numbers.sort()
c = numbers[0]
d = numbers[-1]
if numbers.count(c) + numbers.count(d) == len(numbers):
	if numbers.count(c) == numbers.count(d):
		if ans == c:
			ans1 = d
		else:
			ans1 = c
		print('YES')
		print(ans, ans1)
	else:
		print('NO')
else:
	print('NO')


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

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

def map_string():
	return input().split()
n = int(input())
a = []
for _ in range(n):
	a.append(int(input()))
b = list(set(a[:]))
if len(b) == 2 and a.count(a[0]) == n // 2:
	print('YES')
	print(b[0], b[1])
else:
	print('NO')


def fair1(cards):
	p1 = 0
	p2 = 0
	p1t = True
	while cards != []:
		current = cards[0]
		i = 0
		while i < len(cards):
			if cards[i] == current:
				if p1t:
					p1 += 1
				else:
					p2 += 1
				del cards[i]
			else:
				i += 1
		p1t = not p1t
	return p1 == p2

def fair(cards):
	cards.sort()
	count = 1
	prev = cards[0]
	counts = [0]
	output = [cards[0]]
	for i in range(len(cards)):
		if cards[i] != prev:
			count += 1
			prev = cards[i]
			output.append(cards[i])
			counts.append(1)
		else:
			counts[-1] += 1
	if count != 2:
		return [False, None]
	if counts[0] != counts[1]:
		return [False, None]
	return [True, output]
while True:
	try:
		count = input()
		cards = []
		for i in range(int(count)):
			cards.append(input())
		[isfair, o] = fair(cards)
		if isfair:
			print('YES')
			print(o[1] + ' ' + o[0])
		else:
			print('NO')
	except EOFError:
		break


n = int(input())
a = []
for i in range(n):
	b = int(input())
	a.append(b)
c = list(set(a))
if len(c) != 2:
	print('NO')
else:
	k = 0
	for i in range(len(a)):
		if a[i] == c[0]:
			k += 1
	if k == len(a) // 2:
		print('YES')
		print(c[0], c[1])
	else:
		print('NO')


n = int(input())
l = []
for i in range(n):
	l.append(input())
if len(set(l)) != 2:
	print('NO')
else:
	x = list(set(l))
	c1 = l.count(x[0])
	c2 = l.count(x[1])
	if c1 == c2:
		print('YES')
		print(x[0], x[1])
	else:
		print('NO')


from sys import stdin, stdout
n = int(stdin.readline().rstrip())
cards = []
for _ in range(n):
	cards.append(int(stdin.readline().rstrip()))
n1 = max(cards)
n2 = min(cards)
c1 = cards.count(n1)
c2 = cards.count(n2)
if c1 == c2 and c1 + c2 == n and (n1 != n2):
	print('YES')
	print(str(n1) + ' ' + str(n2))
else:
	print('NO')


n = int(input())
vas = 0
pet = 0
kv = 0
kp = 0
k = 0
vse = n
chv = int(input())
chp = int(input())
n -= 2
if chv != chp:
	vas = chv
	pet = chp
	kv += 1
	kp += 1
	k += 2
	while n > 0:
		ch = int(input())
		n -= 1
		if ch == vas:
			kv += 1
			k += 1
		elif ch == pet:
			kp += 1
			k += 1
	if kp == kv and k == vse:
		print('YES')
		print(vas, pet, end='')
	else:
		print('NO')
else:
	vas = chv
	kv += 2
	k += 2
	if n > 0:
		ch = int(input())
		n -= 1
		while ch == vas and n > 0:
			kv += 1
			k += 1
			n -= 1
			ch = int(input())
		if n > 0:
			pet = ch
		kp += 1
		k += 1
		while n > 0:
			ch = int(input())
			n -= 1
			if ch == vas:
				kv += 1
				k += 1
			elif ch == pet:
				kp += 1
				k += 1
		if kv == kp and k == vse:
			print('YES')
			print(vas, pet, end='')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
a = {}
for i in range(n):
	s = int(input())
	a[s] = a.get(s, 0) + 1
if len(a) != 2:
	print('NO')
else:
	s = list(a.keys())
	if a[s[0]] == a[s[1]]:
		print('YES')
		print(s[0], s[1])
	else:
		print('NO')


N = int(input())
cards = []
for i in range(N):
	cards.append(int(input()))
cards.sort()
now = cards[0]
counts = [cards.count(now)]
card_results = [now]
for i in cards:
	if now != i:
		now = i
		counts.append(cards.count(now))
		card_results.append(now)
if len(counts) != 2:
	print('NO')
elif counts[0] != counts[1]:
	print('NO')
else:
	print('Yes' + '\n' + str(card_results[0]), str(card_results[1]))


n = int(input())
dict = {}
for i in range(0, n):
	x = int(input())
	if x in dict.keys():
		dict[x] += 1
	else:
		dict[x] = 1
L = list(dict.keys())
if len(L) != 2:
	print('NO')
else:
	a = dict[L[0]]
	b = dict[L[1]]
	if a != b:
		print('NO')
	else:
		print('YES')
		print(*L)