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

Starter code:

Solutions:
n = int(input())
z = list(map(int, input().split()))
z.sort()
if z[n - 1] < z[n]:
    print("YES")
else:
    print("NO")

    


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


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

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())
a = sorted([int(i) for i in input().split()])
if a[n-1] < a[n]:
    print ('YES')
else:
    print ('NO')

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

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

n=int(input())
a=list(map(int ,input().strip().split(' ')))
a.sort()
if a[n-1]<a[n]:
  print('YES')
else:
  print('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())

a = list(map(int, input().split()))

a.sort()

print("YES" if a[n] > a[n - 1] else "NO") 



n = int(input())
players = list(map(int, input().split()))

players.sort()

if players[n] > players[n - 1]:
    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")


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())
a=list(map(int, input().split()))
a.sort()
if a[n-1]<a[n]:
    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')


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


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



n = int(input())
l  = sorted(map(int, input().split()))

print(['NO', 'YES'][l[n] > l[n-1]])


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


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


# A. Chess Tourney

n = int(input())
r = list(map(int, input().split()))

r = sorted(r)

f, s = min(r[n:]), max(r[:n])

if f > s:
	print('YES')
else:
	print('NO')


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())
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()))
a.sort()
if a[n - 1] == a[n]:
    print("NO")
else:
    print("YES")