Berland annual chess tournament is coming!

Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organizers should guarantee the win for the team of BerOil.

Thus, organizers should divide all 2·n players into two teams with n people each in such a way that the first team always wins.

Every chess player has its rating r_{i}. It is known that chess player with the greater rating always wins the player with the lower rating. If their ratings are equal then any of the players can win.

After teams assignment there will come a drawing to form n pairs of opponents: in each pair there is a player from the first team and a player from the second team. Every chess player should be in exactly one pair. Every pair plays once. The drawing is totally random.

Is it possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing?


-----Input-----

The first line contains one integer n (1 ≤ n ≤ 100).

The second line contains 2·n integers a_1, a_2, ... a_2n (1 ≤ a_{i} ≤ 1000).


-----Output-----

If it's possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing, then print "YES". Otherwise print "NO".


-----Examples-----
Input
2
1 3 2 4

Output
YES

Input
1
3 3

Output
NO

Difficulty: EASY
Tags: Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
import sys
input = sys.stdin.readline
n = int(input())
a = sorted(list(map(int, input().split())))
print('YES' if a[n - 1] < a[n] else 'NO')


n = int(input())
arr = []
maxes = []
string = input()
arr = [int(x) for x in string.split(' ')]
for x in range(n):
	maxes.append(arr[arr.index(max(arr))])
	del arr[arr.index(max(arr))]
for each in maxes:
	if each < max(arr) or each == max(arr):
		print('NO')
		exit(0)
print('YES')


n = int(input())
arr = sorted(map(int, input().split()))
arr1 = arr[:n]
arr2 = arr[n:]
if arr1[-1] >= arr2[0]:
	print('NO')
else:
	print('YES')


n = int(input())
l = sorted(map(int, input().split()))
for i in range(n):
	if l[i] == l[-i - 1]:
		print('NO')
		exit()
print('YES')


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
k = n * 2 - 1
ans = 'YES'
for i in range(n):
	if l[k] == l[i]:
		ans = 'NO'
		break
	k = k - 1
print(ans)


N = int(input())
X = list(sorted(map(int, input().split())))
print('YES' if X[N - 1] != X[N] else 'NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[n] > a[n - 1]:
	print('YES')
else:
	print('NO')


n = input()
a = sorted([int(x) for x in input().split()])
if a[len(a) // 2 - 1] < a[len(a) // 2]:
	print('YES')
else:
	print('NO')


(n, a) = (int(input()), sorted(map(int, input().split())))
print('YES' if a[n] > a[n - 1] else 'NO')


import sys, os
n = int(input())
n *= 2
data = list(map(int, input().split()))
data = sorted(data)
data1 = data[:n // 2]
data2 = data[n // 2:]
for i in range(n // 2):
	if data1[i] in data2:
		print('NO')
		return
		sys.exit
		os.abort()
print('YES')


n = int(input())
l = list(map(int, input().split()))
l.sort()
flag = False
for i in range(n):
	if l[n - 1] == l[n]:
		print('NO')
		flag = True
		break
if not flag:
	print('YES')


def solution():
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	if a[n - 1] == a[n]:
		print('NO')
	else:
		print('YES')
solution()


n = int(input())
x = [int(q) for q in input().split()]
y = sorted(x)
a = y[:n]
b = y[n:]
u = 0
for i in a:
	if i in b:
		u += 1
		break
if u == 0:
	print('YES')
else:
	print('NO')


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
print('YES' if a[n] != a[n - 1] else 'NO')


n = int(input())
l = sorted([int(i) for i in input().split()])
if max(l[:n]) < min(l[n:]):
	print('YES')
else:
	print('NO')


from sys import stdin
n = int(input())
l = list(map(int, stdin.readline().split()))
l.sort()
flag = 0
for i in range(n):
	if l[n - i - 1] == l[n + i]:
		flag = 1
		break
if flag:
	print('NO')
else:
	print('YES')


n = int(input())
A = sorted([int(i) for i in input().split()])
if A[n] > A[n - 1]:
	print('YES')
else:
	print('NO')


def main(n, a):
	for (i, j) in zip(a[:n], list(reversed(a[n:]))):
		if i >= j:
			return 'NO'
	return 'YES'
print(main(int(input()), sorted(list(map(int, input().split(' '))))))


n = int(input())
entrada = list(map(int, input().split()))
entrada.sort(reverse=True)
l = entrada[:n]
r = entrada[n:]
flag = True
for i in range(n):
	if l[i] <= max(r):
		flag = False
		break
if flag:
	print('YES')
else:
	print('NO')


pairs = int(input())
elo_input = input()
elo_list = []
elo_list = elo_input.split(' ')
for k in range(0, len(elo_list)):
	elo_list[k] = int(elo_list[k])
elo_list.sort()
team1 = elo_list[pairs:]
team2 = elo_list[:pairs][::-1]
if team1[0] == team2[0]:
	print('NO')
else:
	print('YES')


def sr(s):
	for i in range(1, len(s)):
		val = s[i]
		j = i - 1
		while j >= 0 and s[j] > val:
			s[j + 1] = s[j]
			j = j - 1
		s[j + 1] = val
	return s
r = int(input()) * 2
b = input().split()

def g(f):
	for i in range(len(f)):
		f[i] = int(f[i])
	return f
b = g(b)
b.sort()
if b[r // 2 - 1] < b[r // 2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print('YES' if a[len(a) // 2 - 1] < a[len(a) // 2] else 'NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
mid = l[n]
r = True
for i in range(n):
	if l[i] >= mid:
		r = False
		break
if r:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
out = 'NO'
if max(a[:n]) < min(a[n:]):
	out = 'YES'
print(out)


n = int(input())
s = input()
i = 0
b = []
j = 0
chsl = 0
while i < len(s):
	if s[i] == ' ':
		b.append(chsl)
		l = 1
		j += 1
		chsl = 0
	elif int(s[i]) != 0:
		chsl = chsl * 10 + int(s[i])
	else:
		chsl = chsl * 10
	i += 1
b.append(chsl)
b.sort()
if int(b[n - 1]) == int(b[n]):
	print('NO')
else:
	print('YES')


n = int(input())
r = input().split()
m = list(map(int, r))
m.sort()
print(['No', 'Yes'][m[n - 1] < m[n]])


n = int(input())
m = [int(i) for i in input().split()]
m = sorted(m)
if m[len(m) // 2 - 1] == m[len(m) // 2]:
	print('NO')
else:
	print('YES')


def solve():
	s = input()
	if s == '':
		return
	n = int(s)
	a = list(map(lambda x: int(x), input().split()))
	a.sort()
	if a[n - 1] == a[n]:
		print('NO')
	else:
		print('YES')
solve()


def solve():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a.sort()
	if a[n - 1] == a[n]:
		return 'NO'
	else:
		return 'YES'
print(solve())


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
if l[n - 1] < l[n]:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	L = [int(x) for x in input().split()]
	print(solver(n, L))

def solver(n, L):
	L.sort()
	if L[n - 1] != L[n]:
		return 'YES'
	else:
		return 'NO'
main()


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
if l[n - 1] > l[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(sorted(list(map(int, input().split())), reverse=True))
if min(a[:n]) > max(a[n:]):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
t = False
a.sort()
for i in a[:n]:
	for j in a[n:]:
		if i >= j:
			t = True
	if t:
		break
if t:
	print('NO')
else:
	print('YES')


n = int(input())
a = input()
a = [int(x) for x in a.split()]
f = 1
a.sort()
b = []
c = []
a.sort()
for i in range(n):
	b.append(a[i])
	c.append(a[i + n])
for i in range(n):
	for j in range(n):
		if b[i] == c[j]:
			f = 0
			break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
a[n:] = sorted(a[n:])
for i in range(n):
	if a[i] <= a[i + n]:
		print('NO')
		exit()
print('YES')


while 1:
	try:
		n = int(input())
		a = [int(x) for x in input().split()]
		print('YES' if sorted(a)[n] > sorted(a)[n - 1] else 'NO')
	except EOFError:
		break


n = int(input())
c = input().split(' ')
for i in range(len(c)):
	for j in range(len(c) - i - 1):
		if int(c[j]) < int(c[j + 1]):
			t = c[j]
			c[j] = c[j + 1]
			c[j + 1] = t
if c[n - 1] == c[n]:
	print('NO')
else:
	print('YES')


n = int(input())
a = input()
a = a.split()
for i in range(2 * n):
	a[i] = int(a[i])
a.sort()
b = []
c = []
for i in range(n):
	b.append(a[i])
for i in range(n):
	c.append(a[i + n])
j = 'YES'
for i in range(n):
	if b[i] >= min(c):
		j = 'NO'
print(j)


half = int(input())
msg = input().split()
arr = []
for char in msg:
	arr.append(int(char))
arr = sorted(arr)
if arr[half] != arr[half - 1]:
	print('YES')
else:
	print('NO')


n = int(input()) * 2
players = list(map(int, input().split()))
firt = [0] * (n // 2)
max = 0
max_i = 0
for i in range(n // 2):
	for j in range(n):
		if players[j] > max:
			max = players[j]
			max_i = j
	firt[i] = max
	players[max_i] = -1
	(max, max_i) = (0, 0)
for j in range(n):
	if players[j] > max:
		max = players[j]
if max >= firt[n // 2 - 1]:
	print('NO')
else:
	print('YES')


n = int(input())
num = list(map(int, input().split()))
num.sort()
num1 = num[:n]
num2 = num[n:]
if num1[-1] < num2[0]:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
if l[n] > l[n - 1]:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	data = input().split(' ')
	rates = [int(i) for i in data]
	print(distribution(n, rates))

def distribution(count, rates):
	rates.sort(reverse=True)
	if rates[count - 1] > rates[count]:
		return 'YES'
	return 'NO'
main()


n = int(input())
n *= 2
arr = list(map(int, input().split()))
arr.sort()
if arr[n // 2] > arr[n // 2 - 1]:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(map(int, input().strip().split()))
s.sort(reverse=True)
f = s[0:n:1]
c = s[n::1]
for i in f:
	for j in c:
		if i == j:
			f = 1
			break
	if f == 1:
		break
if f == 1:
	print('NO')
else:
	print('YES')


n = int(input().strip())
powers = list(map(int, input().strip().split()))
powers.sort()
if powers[n - 1] < powers[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
y = True
i = 0
j = 2 * n - 1
while i < n and y:
	if a[i] >= a[j]:
		y = False
	i += 1
	j -= 1
if y:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout

def ri():
	return map(int, input().split())
n = int(input())
p = list(ri())
p.sort()
if p[n - 1] != p[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 1:
	b = [a[0]]
	c = [a[1]]
else:
	b = a[:2 * n // 2]
	c = a[2 * n // 2:]
for x in b:
	if x in c:
		print('NO')
		exit()
print('YES')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = a[:n]
c = a[n:]
if min(c) > max(b):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
st = 'YES'
if a[n - 1] == a[n]:
	st = 'NO'
print(st)


n = int(input())
get = lambda : list(map(int, input().split()))
l = get()
l.sort()
if l[n - 1] < l[n]:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
wins = 1
j = 2 * n - 1
if l[n - 1] != l[n]:
	print('YES')
else:
	print('NO')


a = int(input())
wow = [int(e) for e in input().split()]
wow.sort()
if wow[a - 1] == wow[a]:
	print('NO')
else:
	print('YES')


n = int(input())
A = sorted(map(int, input().split()))
print(('NO', 'YES')[A[n - 1] < A[n]])


n = int(input())
a = []
a = input().split()
for i in range(0, n * 2):
	a[i] = int(a[i])
a.sort()
first = []
second = []
for i in range(0, n):
	first.append(a[i])
for i in range(n, n * 2):
	second.append(a[i])
if min(second) > max(first):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[n - 1] == a[n]:
	print('No')
else:
	print('Yes')


def main():
	n = int(input())
	rs = sorted([int(x) for x in input().split()], reverse=True)
	if rs[n - 1] > rs[n]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append(max(a))
	del a[a.index(max(a))]
if min(b) > max(a):
	print('YES')
else:
	print('NO')


n = int(input())
ll = list(map(int, input().split()))
ll = sorted(ll)
k = ll[0:n]
l = ll[n:]
t = True
for i in range(n):
	for j in range(n):
		if l[i] <= k[j]:
			t = False
			break
	if t == False:
		break
print('YES' if t == True else 'NO')


n = int(input())
r = map(int, input().split())
r = sorted(r)
(f, s) = (min(r[n:]), max(r[:n]))
if f > s:
	print('YES')
else:
	print('NO')


import math
import sys

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

def solution():
	n = int(input())
	a = scan()
	a.sort()
	b = a[:n]
	a = a[n:]
	a = set(a).intersection(set(b))
	if len(a) > 0:
		print('NO')
	else:
		print('YES')
solution()


a = int(input())
b = [int(x) for x in input().split()]
b.sort()
lis1 = [x for x in b[a:]]
lis2 = [x for x in b[:a]]
if min(lis1) > max(lis2):
	print('Yes')
else:
	print('No')


a = int(input())
b = sorted(list(map(int, input().split())))
print('YES' if b[a - 1] < b[a] else 'NO')


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

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

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 math import log2, sqrt
n = I()
l = lint()
l.sort(reverse=True)
a = l[:n]
b = l[n:]
m = 0
debug(a, b)
k = 0
for i in range(n):
	if a[k] in b:
		m = -1
		break
	if a[k] > b[k]:
		m += 1
	else:
		m -= 1
	k += 1
print('YES') if m > 0 else print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
b = a[:n]
c = a[n:]
if min(c) > max(b):
	print('YES')
else:
	print('NO')


n = int(input())
lst = input().split()
for i in range(n * 2):
	lst[i] = int(lst[i])
lst.sort()
k = 0
for i in range(n):
	if lst[n] > lst[i]:
		k += 1
if k == n:
	print('YES')
else:
	print('NO')


def main():
	nbEquipe = int(input())
	liste = list(map(int, input().split()))
	liste.sort()
	if liste[nbEquipe] > liste[nbEquipe - 1]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
nums = list(map(int, input().split()))
nums = sorted(nums)
if nums[len(nums) // 2 - 1] < nums[len(nums) // 2]:
	print('YES')
else:
	print('NO')


n = int(input())
A = [int(x) for x in input().split()]
A.sort()
if A[n] == A[n - 1]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
(i, j) = (0, 2 * n - 1)
while i < j:
	if a[j] <= a[i]:
		break
	i += 1
	j -= 1
if i > j:
	print('YES')
else:
	print('NO')


n = int(input())
sl = list(map(int, input().split()))
sl.sort()
s1 = sl[:n]
s2 = sl[n:]
count = 0
if max(s1) >= min(s2):
	count = 1
if count == 1:
	print('NO')
else:
	print('YES')


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 = input()
nb = []
x = ''
for i in range(len(b)):
	if b[i] != ' ':
		x = x + b[i]
	else:
		nb.append(int(x))
		x = ''
if x != '':
	nb.append(int(x))
b = nb
b = ins(b)
if b[n] > b[n - 1]:
	print('YES')
else:
	print('NO')


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

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

def si():
	return str(input())

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

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

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

def fsi():
	return str(stdin.readline())

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

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

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans
n = ii()
l = sorted(li())
count = 0
for i in range(n):
	if l[i] != l[2 * n - i - 1]:
		count += 1
if count == n:
	print('YES')
else:
	print('NO')


n = int(input())
arr = [int(i) for i in input().strip().split()]
arr.sort(reverse=True)
print('NO' if arr[n - 1] == arr[n] else 'YES')


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
if a[n - 1] == a[n]:
	print('NO')
else:
	print('YES')


import sys

def is_possible(n, ratings_list):
	sorted_ratings_list = sorted(ratings_list, reverse=True)
	team1 = sorted_ratings_list[:n]
	team2 = sorted_ratings_list[n:]
	if team1[-1] in team2:
		return 'NO'
	else:
		return 'YES'

def main():
	n = int(sys.stdin.readline().strip())
	ratings_list = list(map(int, sys.stdin.readline().rstrip('\n').split(' ')))
	print(is_possible(n, ratings_list))
main()


n = int(input())
players = list(map(int, input().split()))
ans = 0
team1 = []
for x in range(n):
	big = max(players)
	ans += big
	team1.append(big)
	players.remove(big)
if ans > sum(players) and max(players) < min(team1):
	print('YES')
else:
	print('NO')


n = int(input())
data = list(map(int, input().split()))
data.sort()
if n == 1 and data[0] == data[1] or data[0] == data[-1] or data[n] == data[n - 1]:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
b = a[:int(len(a) / 2)]
c = a[int(len(a) / 2):]
if c[0] > b[len(b) - 1]:
	print('YES')
else:
	print('NO')


n = int(input())
ratings = [int(i) for i in input().split(' ')]
ratings = sorted(ratings)
group1 = ratings[:n]
group2 = ratings[n:]
if group1[-1] < group2[0]:
	print('YES')
else:
	print('NO')


n = int(input())
a2 = sorted(list(map(int, input().split())))
b1 = []
for i in range(n):
	b1.append(a2[len(a2) - 1])
	a2.remove(a2[len(a2) - 1])
if max(a2) < min(b1):
	print('YES')
else:
	print('NO')


import sys
n = int(input())
arr_ret_top = []
arr_ret = list(map(int, input().split()))
for i in range(n):
	arr_ret_top.append(max(arr_ret))
	numbers = arr_ret.index(max(arr_ret))
	del arr_ret[numbers]
for i in range(n):
	if arr_ret[i] >= min(arr_ret_top):
		print('NO')
		sys.exit()
print('YES')


def prog():
	n = int(input())
	mas = list(map(int, input().split()))
	mas.sort()
	if mas[n - 1] == mas[n]:
		print('NO')
	else:
		print('YES')
prog()


n = int(input())
l = list(map(int, input().split()))
l.sort()
x = l[:len(l) // 2]
y = l[len(l) // 2:]
flag = True
if min(y) <= max(x):
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
flag = False
g = []
h = []
for i in range(n):
	g.append(a[i])
a.reverse()
for i in range(n):
	h.append(a[i])
for i in range(len(g)):
	for i in range(len(h)):
		if g[i] == h[i]:
			print('NO')
			flag = True
			break
	if flag == True:
		break
if flag == False:
	print('Yes')


import sys
n = int(input())
ratings_line = input()
r = map(lambda s: int(s), ratings_line.split())
rs = sorted(r)
if rs[n - 1] == rs[n]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
sorted_list = sorted(a, reverse=True)
team1 = sorted_list[:n]
team2 = sorted_list[n:]
if team1[-1] in team2:
	print('NO')
else:
	print('YES')


n = int(input())
a = input().strip().split(' ')
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
if a[n - 1] >= a[n]:
	print('NO')
else:
	print('YES')


n = int(input())
line = input()
nums = [int(s) for s in line.split()]
nums.sort()
if nums[n] > nums[n - 1]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
a1 = a[:n]
a2 = a[n:2 * n]
a2 = a2[::-1]
ans = 'T'
for i in range(n):
	if a2[i] <= a[i]:
		ans = 'NO'
		break
if ans == 'NO':
	print(ans)
else:
	print('YES')


n = int(input())
a = [int(x) for x in input().split()]
assert len(a) == n + n
a.sort()
if a[n - 1] < a[n]:
	print('YES')
else:
	print('NO')


input()
ns = list(map(int, input().split()))
ns.sort()
i = len(ns) // 2
if ns[i] == ns[i - 1]:
	print('NO')
else:
	print('YES')


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort()
if l[n - 1] < l[n]:
	print('YES')
else:
	print('NO')


import sys

def main():
	n = int(sys.stdin.readline())
	liste = list(map(int, sys.stdin.readline().split()))
	liste.sort()
	if liste[n - 1] < liste[n]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
ratings = []
l = input()
q = l.split(' ')
for x in range(0, 2 * n):
	ratings.append(int(q[x]))
ratings.sort(reverse=True)
Ateam = ratings[:int(len(ratings) / 2)]
Bteam = ratings[int(len(ratings) / 2):]
if Ateam[len(Ateam) - 1] > Bteam[0]:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
s = input()
t = s.split()
for k in t:
	if k != ' ':
		a.append(int(k))
a = sorted(a)
if a[n - 1] == a[n]:
	print('NO')
else:
	print('YES')


a = int(input())
l = input().split()
m = []
for i in range(len(l)):
	m += [int(l[i])]
m.sort()
if m[a - 1] < m[a]:
	print('YES')
else:
	print('NO')


flag = 0
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a, reverse=True)
b = a[0:n]
c = a[n:]
for i in range(0, len(b)):
	for j in range(0, len(c)):
		if b[i] <= c[j]:
			flag = 1
			break
if flag > 0:
	print('NO')
else:
	print('YES')


n = int(input())
A = list(map(int, input().split()))
ans = 'YES'
A.sort(reverse=True)
for i in range(n):
	if A[i] <= A[n]:
		ans = 'NO'
print(ans)


n = int(input())
a = list(map(int, input().split()))
for el in range(2 * n):
	for i in range(2 * n - el - 1):
		if a[i] > a[i + 1]:
			(a[i], a[i + 1]) = (a[i + 1], a[i])
k1 = []
k2 = []
for el in range(n):
	k1.append(a[el])
for el in range(n, n * 2):
	k2.append(a[el])
for el1 in k1:
	for el2 in k2:
		if el2 <= el1:
			print('NO')
			exit()
print('YES')


def unir(izq, der):
	arr = []
	(n, m, i, j) = (len(izq), len(der), 0, 0)
	while i != n and j != m:
		if izq[i] < der[j]:
			arr.append(izq[i])
			i += 1
		else:
			arr.append(der[j])
			j += 1
	return arr + izq[i:] + der[j:]

def mergesort(arr):
	n = len(arr)
	if n <= 1:
		return arr
	izq = arr[:int(n / 2)]
	der = arr[int(n / 2):]
	izq = mergesort(izq)
	der = mergesort(der)
	return unir(izq, der)
N = int(input())
arr = [int(x) for x in input().split()]
arrsorted = mergesort(arr)
if arrsorted[N - 1] != arrsorted[N]:
	print('YES\n')
else:
	print('NO\n')


n = int(input())
l = list(map(int, input().split()))
l.sort()
b = True
for i in range(2 * n - 1, n - 1, -1):
	for j in range(n):
		if not l[i] > l[j]:
			b = False
			break
		if not b:
			break
if b:
	print('YES')
else:
	print('NO')


n = int(input())
num_list = sorted(list(map(int, input().split())))
middle = num_list[n]
for _ in range(n - 1, -1, -1):
	if num_list[_] == middle:
		print('NO')
		exit(0)
print('YES')


n = int(input())
a = list(input().split(' '))
a = [int(i) for i in a]
a.sort()
if a[n - 1] < a[n]:
	print('YES')
elif a[n - 1] == a[n]:
	print('NO')


n = int(input(''))
a = input('').split()
c = list()
for b in a:
	b = int(b)
	c.append(b)
c.sort()
if c[n - 1] < c[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = a[:n]
c = a[n:]
b.sort()
c.sort()
if b[-1] == c[0]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
m = 0
for i in range(2 * n, n - 1, -1):
	for j in range(i - 1):
		if a[j] > a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
print('NO' if a[n] == a[n - 1] else 'YES')


a = int(input())
b = a * 2
c = input()
c = [c]
c = c[0].split(' ')
for i in range(len(c)):
	c[i] = int(c[i])

def resitev():
	d = sorted(c)
	f = d[a:2 * a]
	s = d[a - 1]
	x = 0
	for i in f:
		if i > s:
			x += 1
	if x == a:
		return 'Yes'
	return 'No'
print(resitev())


n = int(input()) * 2
a = sorted([int(x) for x in input().split()])
print('YNEOS'[not min(a[n // 2:]) > max(a[:n // 2])::2])


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())
w = input().split(' ')
for i in range(2 * n):
	w[i] = int(w[i])
w = bubble(w)
oil = w[:n]
mobil = w[n:]
if oil[-1] < mobil[0]:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	ratings = list(map(int, input().split()))
	ratings.sort()
	if ratings[n] > ratings[n - 1]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort(reverse=True)
a = arr[0:n]
b = arr[n:]
ans = True
for x in a:
	if x in b:
		ans = False
		break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
f = True
a.sort()
if a[n] == a[n - 1]:
	f = False
if f == True:
	print('YES')
else:
	print('NO')


def merge(list1, list2):
	i = 0
	j = 0
	len_list1 = len(list1)
	len_list2 = len(list2)
	new_list = []
	while len_list1 != 0 and len_list2 != 0:
		if list1[i] <= list2[j]:
			new_list.append(list1[i])
			i += 1
			len_list1 -= 1
		else:
			new_list.append(list2[j])
			j += 1
			len_list2 -= 1
	if len_list1 == 0:
		new_list += list2[j:]
	else:
		new_list += list1[i:]
	return new_list

def merge_sort(num):
	if len(num) <= 1:
		return num
	else:
		left_part = num[:len(num) // 2]
		right_part = num[len(num) // 2:]
		return merge(merge_sort(left_part), merge_sort(right_part))

def search(a, lst1):
	for i in range(len(lst1)):
		if lst1[i] == a:
			ans = i
			break
	return ans
n = int(input())
num = list(map(int, input().split()))
lst = merge_sort(num)
k = 0
strong = lst[len(lst) // 2:]
weak = lst[:len(lst) // 2]
flag = True
for i in range(len(strong)):
	if min(strong) > max(weak):
		k += 1
	else:
		flag = False
		break
	strong.pop(search(min(strong), strong))
	weak.pop(search(max(weak), weak))
if flag:
	print('Yes')
else:
	print('No')


n = int(input())
L = input().split()
for i in range(len(L)):
	L[i] = int(L[i])
L.sort()
if L[n - 1] == L[n]:
	print('NO')
else:
	print('YES')


n = int(input())
r = [int(w) for w in input().split()]
r.sort()
if r[n] > r[n - 1]:
	print('yes')
else:
	print('no')


n = int(input())
l = list(map(int, input().split()))
l.sort()
l1 = []
l2 = []
for (index, i) in enumerate(l):
	if index < len(l) // 2:
		l1.append(i)
	else:
		l2.append(i)
if l1[len(l1) - 1] < l2[0]:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(map(int, input().split()))
l2 = l[n:]
for a in l[:n]:
	if a in l2:
		print('NO')
		exit()
print('YES')


n = int(input())
line = list(map(int, input().split()))
line.sort()
line_a = line[:n]
line_b = line[n:]
if line_a[-1] == line_b[0]:
	print('NO')
else:
	print('YES')


def insertion_sort(l):
	a = [l[0]]
	for i in range(1, len(l)):
		b = -1
		for j in range(len(a)):
			if l[i] <= a[j]:
				b = j
				break
		if b != -1:
			a = a[:b] + [l[i]] + a[b:]
		else:
			a += [l[i]]
	return a
n = int(input())
players = input().split()
for i in range(len(players)):
	players[i] = int(players[i])
players.sort()
p1 = players[:n]
p3 = players[n:]
if p1[-1] == p3[0]:
	print('NO')
else:
	print('YES')


n = int(input())
l = []
l = [int(x) for x in input().split()]
l.sort()
s = l[n]
t = []
for i in range(n):
	t.append(l[i])
if s not in t:
	print('YES')
else:
	print('NO')


n = int(input())

def Count_Sort(l, m):
	t = []
	n = []
	for i in range(m):
		if i < len(l):
			n.append(0)
		t.append(0)
	for i in l:
		t[i - 1] += 1
	for i in range(1, m):
		t[i] += t[i - 1]
	for i in range(len(l) - 1, -1, -1):
		n[t[l[i] - 1] - 1] = l[i]
		t[l[i] - 1] -= 1
	return n
l = input()
l = l.split()
for i in range(len(l)):
	l[i] = int(l[i])
l = Count_Sort(l, 1000)
if l[n - 1] < l[n]:
	print('YES')
else:
	print('NO')


input()
l = list(map(int, input().split()))
l.sort()
if l[len(l) // 2] > l[len(l) // 2 - 1]:
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split()
a = [int(i) for i in a]
c = 0
for i in range(1, 2 * n):
	key = a[i]
	j = i - 1
	while j >= 0 and key < a[j]:
		a[j + 1] = a[j]
		j -= 1
	a[j + 1] = key
if a[n - 1] >= a[n]:
	print('NO')
else:
	print('YES')


import math
n = int(input())
lst = list(map(int, input().strip().split(' ')))
lst.sort()
if lst[n - 1] < lst[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
k1 = []
k2 = []
for i in range(n):
	k2.append(a[i])
for i in range(n, n * 2):
	k1.append(a[i])
if max(k2) < min(k1):
	print('YES')
else:
	print('NO')


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
a = sorted(L())
if a[n] <= a[n - 1]:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(g) for g in input().split()]
x = [0] * 1001
for i in range(2 * n):
	x[a[i]] += 1
s = 0
i = 0
while s < n:
	i += 1
	s += x[i]
if s == n:
	print('YES')
else:
	print('NO')


n = int(input())
u = [int(x) for x in input().split()]
u.sort()
k2 = u[:n]
k1 = u[n:2 * n]
if k2[n - 1] == k1[0]:
	print('NO')
else:
	print('YES')


def mergeSort(a):
	if len(a) <= 1:
		return a
	else:
		m = len(a) // 2
		return merge(mergeSort(a[:m]), mergeSort(a[m:]))

def merge(a, b):
	k = n = 0
	c = []
	while len(a) != k and len(b) != n:
		if a[k] <= b[n]:
			c.append(a[k])
			k += 1
		else:
			c.append(b[n])
			n += 1
	c.extend(a[k:] + b[n:])
	return c
n = input()
a = list(map(int, input().split()))
a = mergeSort(a)
m = len(a) // 2
sum1 = sum2 = 0
b = a[:m]
c = a[m:]
if b[m - 1] < c[0]:
	print('YES')
else:
	print('NO')


def shahmatisty(lst):
	a = sorted(lst)
	if a[len(lst) // 2 - 1] == a[len(lst) // 2]:
		return 'NO'
	return 'YES'
n = int(input())
b = [int(j) for j in input().split()]
print(shahmatisty(b))


n = int(input())
l = list(map(int, input().split()))
l.sort()
l1 = l[0:n]
l2 = l[n:2 * n]
k = l1[-1]
if k in l2:
	print('NO')
else:
	print('YES')


n = int(input())
M1 = list(map(int, input().split()))
M1.sort()
M2 = M1[n:]
M1 = M1[:n]
if max(M1) < min(M2):
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
print((l[n - 1] > l[n]) * 'YES' + (not l[n - 1] > l[n]) * 'NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
x = a[:n]
y = a[n:]
for i in x[::-1]:
	for j in y:
		if i == j:
			print('NO')
			exit(0)
print('YES')


x = int(input())
y = input()
z = y.split()
z_ = [int(d) for d in z]
z_.sort()
q = len(z_)
a = z_[:q // 2]
b = z_[q // 2:]
for i in range(q // 2):
	for j in range(q // 2):
		if b[i] > a[j]:
			continue
		else:
			print('NO')
			exit()
print('YES')


n = int(input())
chessers = list(map(int, input().split()))
was = []
chessers.sort()
chessers1 = chessers[:n]
chessers2 = chessers[n:]
flag = True
for i in chessers1:
	if i in chessers2:
		flag = False
		break
if flag == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
x = 0
y = 0
for i in range(n):
	x += a[i]
for i in range(n, 2 * n):
	y += a[i]
if x != y and a[n - 1] != a[n]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
A = []
B = []
for i in range(n):
	A.append(a[i])
for i in range(n, 2 * n):
	B.append(a[i])
if A[n - 1] >= B[0]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
x = []
y = []
for i in range(n):
	x.append(a[i])
for i in range(n, n * 2):
	y.append(a[i])
for i in range(n):
	for j in range(n):
		if x[i] == y[j]:
			print('NO')
			exit(0)
print('YES')


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
a = ar[:n]
b = ar[n:]
if len(set(a) & set(b)) == 0:
	print('YES')
else:
	print('NO')


n = int(input())
inf = [int(i) for i in input().split()]
inf.sort()
if inf[n] > max(inf[:n]):
	print('YES')
else:
	print('NO')


n = int(input())
i = 0
s = input().split()
a = []
while i < 2 * n:
	a.append(int(s[i]))
	i += 1
a.sort()
if a[n - 1] != a[n]:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(map(int, input().split()))
print(['NO', 'YES'][l[n] > l[n - 1]])


def lol(a):
	mid = len(a) // 2
	return a[mid - 1] < a[mid]
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
print('YES' if lol(a) else 'NO')


input()
a = sorted(map(int, input().split()))
if a[len(a) // 2 - 1] < a[len(a) // 2]:
	print('YES')
else:
	print('NO')


n = int(input())
p = list(map(int, input().split()))
p.sort()
t = 1
for i in p[:n]:
	for j in p[n:]:
		if i >= j:
			t = 0
	if not t:
		break
if t:
	print('YES')
else:
	print('NO')


import math
a = []
n = input()
n = int(n)
s = input().split()
for i in range(0, 2 * n):
	a.append(int(s[i]))
a.sort()
if a[n] == a[n - 1]:
	print('NO\n')
else:
	print('YES\n')


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
t1 = t[:n]
t2 = t[n:2 * n]
if t1[n - 1] < t2[0]:
	print('YES')
else:
	print('NO')


n = int(input())
k = list(map(int, input().split(' ')))
k.sort()
(a, k) = (k[0:n], k[n:])
for i in k:
	if i in a:
		print('NO')
		exit()
print('YES')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ft = a[:n]
st = a[n:]
st.reverse()
if ft[-1] != st[-1]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = set(a)
if len(a) == len(b):
	print('YES')
else:
	a.sort()
	c = a[:n]
	d = a[n:2 * n]
	e = set(c) & set(d)
	if e:
		print('NO')
	else:
		print('YES')


n = int(input())
b = list(map(int, input().split()))
b.sort()
x = b[:len(b) // 2]
y = b[len(b) // 2:]
if x[-1] < y[0]:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
lose = arr[0:n]
win = arr[n:]
if win[0] > lose[-1]:
	print('YES')
else:
	print('NO')


qtd = int(input())
lista = [int(i) for i in input().split()]
lista.sort()
fracos = lista[:qtd]
forte = lista[qtd]
saida = 'YES'
for fraco in fracos:
	if fraco >= forte:
		saida = 'NO'
print(saida)


from collections import Counter

def Chess_tourney():
	n = int(input())
	array = list(map(int, input().split()))
	Quicksort(array, 0, 2 * n - 1)
	if array[n] == array[n - 1]:
		return 'NO'
	return 'YES'

def Quicksort(array, p, r):
	if p < r:
		q = Partition(array, p, r)
		Quicksort(array, p, q - 1)
		Quicksort(array, q + 1, r)

def Partition(array, p, r):
	x = array[r]
	i = p - 1
	for j in range(p, r):
		if array[j] < x:
			i += 1
			Swap(array, i, j)
	Swap(array, i + 1, r)
	return i + 1

def Swap(array, i, j):
	tmp = array[i]
	array[i] = array[j]
	array[j] = tmp
print(Chess_tourney())


def insertionSort(a):
	for i in range(1, len(a)):
		key = a[i]
		j = i - 1
		while j >= 0 and key < a[j]:
			a[j + 1] = a[j]
			j -= 1
		a[j + 1] = key
	return a
a = int(input())
b = input() + ' '
x = ''
c = []
for i in range(len(b)):
	if b[i] == ' ':
		c = c + [int(x)]
		x = ''
	else:
		x = x + b[i]
c = insertionSort(c)
if c[len(c) // 2] < c[len(c) // 2 - 1] or c[len(c) // 2] > c[len(c) // 2 - 1]:
	print('YES')
else:
	print('NO')


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def wr(arr):
	return ''.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
n = ii()
a = sorted(li())
print('NO') if a[n] == a[n - 1] else print('YES')