You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array.


-----Input-----

The first line contains two integers n_{A}, n_{B} (1 ≤ n_{A}, n_{B} ≤ 10^5), separated by a space — the sizes of arrays A and B, correspondingly.

The second line contains two integers k and m (1 ≤ k ≤ n_{A}, 1 ≤ m ≤ n_{B}), separated by a space.

The third line contains n_{A} numbers a_1, a_2, ... a_{n}_{A} ( - 10^9 ≤ a_1 ≤ a_2 ≤ ... ≤ a_{n}_{A} ≤ 10^9), separated by spaces — elements of array A.

The fourth line contains n_{B} integers b_1, b_2, ... b_{n}_{B} ( - 10^9 ≤ b_1 ≤ b_2 ≤ ... ≤ b_{n}_{B} ≤ 10^9), separated by spaces — elements of array B.


-----Output-----

Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes).


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

Output
YES

Input
3 3
3 3
1 2 3
3 4 5

Output
NO

Input
5 2
3 1
1 1 1 1 1
2 2

Output
YES



-----Note-----

In the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).

In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers chosen in A will be less than all the numbers chosen in B: $3 < 3$.

Difficulty: EASY
Tags: Sorting
Skill types: Sorting

Starter code:

Solutions:
(asize, bsize) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[m * -1]:
	print('YES')
else:
	print('NO')


(na, nb) = [int(x) for x in input().split()]
(k, m) = [int(x) for x in input().split()]
k = input().split()[k - 1]
l = input().split()
m = l[len(l) - m]
if int(m) > int(k):
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A[k - 1] >= B[len(B) - m]:
	print('NO')
else:
	print('YES')


import sys
(na, nb) = map(int, sys.stdin.readline().split())
(k, m) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
if a[k - 1] < b[nb - m]:
	print('YES')
else:
	print('NO')


wwwww = list(map(int, input().split()))
info = list(map(int, input().split()))
a = info[0]
b = info[1]
f = list(map(int, input().split()))
s = list(map(int, input().split()))
t = f[a - 1]
p = s[-b]
if t < p:
	print('YES')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print('YES' if max(a[0:k]) < min(b[-m:n2]) else 'NO')


from sys import stdin, stdout

def main():
	stdin.readline().rstrip()
	(k, m) = [int(i) for i in stdin.readline().rstrip().split()]
	max_k_members_of_A = int(stdin.readline().rstrip().split()[k - 1])
	min_m_members_of_B = int(stdin.readline().rstrip().split()[-m])
	if max_k_members_of_A < min_m_members_of_B:
		return 'YES'
	else:
		return 'NO'
print(main())


i = lambda : map(int, input().split())
(x, y) = i()
(k, m) = i()
print('YNEOS'[sorted(i())[k - 1] >= sorted(i())[::-1][m - 1]::2])


(n, m) = map(int, input().split())
(x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[x - 1] < b[m - y]:
	print('YES')
else:
	print('NO')


import sys
from sys import stdin

def solve():
	(na, nb) = [int(x) for x in input().split()]
	(k, m) = [int(x) for x in input().split()]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if a[k - 1] < b[nb - m]:
		print('YES')
	else:
		print('NO')

def main():
	solve()
main()


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
print('YES' if a[k - 1] < b[nb - m] else 'NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxa = a[k - 1]
minb = b[-m]
if minb > maxa:
	print('YES')
else:
	print('NO')


(n1, n2) = (s for s in input().split())
(k, m) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


(len_A, len_B) = [int(x) for x in input().split()]
(m, n) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
if A[m - 1] < B[-n]:
	print('YES')
else:
	print('NO')


(nA, nB) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
maxak = A[k - 1]
count = 0
bk = B[m - 1]
if B[0] > maxak:
	print('YES')
elif B[nB - m] > maxak:
	print('YES')
else:
	print('NO')


(na, nb) = [int(x) for x in input().split()]
(n, m) = [int(x) for x in input().split()]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[n - 1] < b[nb - m]:
	print('YES')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k1, k2) = map(int, input().split())
arr1 = []
arr2 = []
arr1 += map(int, input().split())
arr2 += map(int, input().split())
if arr1[k1 - 1] < arr2[n2 - k2]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(p, q) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[p - 1] < b[nb - q]:
	print('YES')
else:
	print('NO')


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


def solve(na, nb, k, m, a, b):
	res_a = max(a[:k])
	res_b = min(b[-m:])
	return 'NO' if res_a >= res_b else 'YES'

def main():
	(na, nb) = list(map(int, input().split(' ')))
	(k, m) = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	print(solve(na, nb, k, m, a, b))
main()


def quick_sort(arr, lo, hi):
	i = lo
	j = hi
	pivot = arr[int((lo + hi) / 2)]
	while i < j:
		while arr[i] < pivot:
			i += 1
		while arr[j] > pivot:
			j -= 1
		if i <= j:
			(arr[i], arr[j]) = (arr[j], arr[i])
			i += 1
			j -= 1
	if lo < j:
		quick_sort(arr, lo, j)
	if i < hi:
		quick_sort(arr, i, hi)
(n1, n2) = input().split()
(k, m) = input().split()
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
if max(A) < min(B):
	print('YES')
elif int(k) == 1 and min(A) < max(B):
	print('YES')
else:
	quick_sort(A, 0, len(A) - 1)
	quick_sort(B, 0, len(B) - 1)
	subB = B[len(B) - int(m):]
	if A[int(k) - 1] >= min(subB):
		print('NO')
	else:
		print('YES')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


nab = input().split(' ')
km = input().split(' ')
a = input().split(' ')
b = input().split(' ')
if int(a[int(km[0]) - 1]) < int(b[int(nab[1]) - int(km[1])]):
	print('YES')
else:
	print('NO')


R = lambda : list(map(int, input().split()))
((_a, _b), (k, m), a, b) = (R(), R(), R(), R())
print('YES' if a[k - 1] < b[-m] else 'NO')


sc = lambda : map(int, input().split())
(na, nb) = sc()
(k, m) = sc()
A = list(sc())
B = list(sc())
print(('NO', 'YES')[A[k - 1] < B[-m]])


(n, m) = map(int, input().split(' '))
(a, b) = map(int, input().split(' '))
arr1 = [int(i) for i in input().split(' ')]
arr2 = [int(i) for i in input().split(' ')]
if arr1[a - 1] < arr2[m - b]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = [0] + [int(x) for x in input().split()]
b = [0] + [int(x) for x in input().split()]
if a[k] < b[-m]:
	print('YES')
else:
	print('NO')


(nA, nB) = input().split()
(nA, nB) = (int(nA), int(nB))
(k, m) = input().split()
(k, m) = (int(k), int(m))
a = input()
b = input()
A = []
B = []
for i in a.split():
	A.append(int(i))
for j in b.split():
	B.append(int(j))
if A[k - 1] < B[nB - m]:
	print('YES')
else:
	print('NO')


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


(n1, n2) = input().split(' ')
(k, m) = input().split(' ')
x = input().split()
y = input().split()
if int(x[int(k) - 1]) < int(y[-int(m)]):
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ac = a[k - 1]
bc = b[len(b) - m]
if ac < bc:
	print('YES')
else:
	print('NO')


def inp():
	return map(int, input().split(' '))
(na, nb) = inp()
(k, m) = inp()
a = list(inp())
b = list(inp())
if a[k - 1] < b[nb - m]:
	print('YES')
else:
	print('NO')


import sys
(NA, NB) = input().split()
(K, M) = input().split()
(K, M) = (int(K), int(M))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A[K - 1] < B[-M]:
	print('YES')
else:
	print('NO')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
arrA = list(map(int, input().split()))
arrB = list(map(int, input().split()))
arrA = arrA[:k]
arrB = arrB[nB - m:]
if arrA[-1] < arrB[0]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
line = input()
arr1 = line.split()
for i in range(na):
	arr1[i] = int(arr1[i])
line = input()
arr2 = line.split()
for i in range(nb):
	arr2[i] = int(arr2[i])
arr2 = arr2[::-1]
chosen1 = []
chosen2 = []
for i in range(k):
	chosen1.append(arr1[i])
for i in range(m):
	chosen2.append(arr2[i])
if min(chosen2) > max(chosen1):
	print('YES')
else:
	print('NO')


def is_smaller(source_number, target_number) -> bool:
	if source_number >= target_number:
		return False
	return True
(a_size, b_size) = map(int, input().split())
(k, m) = map(int, input().split())
a_arr = list(map(int, input().split()))
b_arr = list(map(int, input().split()))
target_arr = []
for i in range(m):
	target_arr.append(b_arr[~i])
is_ok = True
source_arr = a_arr[:k]
(target_max, target_min) = (target_arr[0], target_arr[-1])
for a_number in source_arr:
	if not is_smaller(a_number, target_min):
		is_ok = False
if is_ok:
	print('YES')
else:
	print('NO')


import sys
import math
import bisect

def main():
	(n, m) = map(int, input().split())
	(k1, k2) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A.sort()
	B.sort(reverse=True)
	if max(A[:k1]) < min(B[:k2]):
		print('YES')
	else:
		print('NO')
main()


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
x = A[k - 1]
y = B[len(B) - m]
if x < y:
	print('YES')
else:
	print('NO')


(na, nb) = input().split()
(k, m) = input().split()
k = int(k)
m = int(m)
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
b.sort(reverse=True)
if a[k - 1] < b[m - 1]:
	print('YES')
else:
	print('NO')


import time
(na, nb) = (int(i) for i in input().split())
(k, m) = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
start = time.time()
if A[k - 1] < B[len(B) - m]:
	print('YES')
else:
	print('NO')
finish = time.time()


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
a.sort()
amax = a[k - 1]
id = -1
for i in range(nb):
	if b[i] > amax:
		id = i
		break
if nb - id >= m and id != -1:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split(' '))
(k, m) = map(int, input().split(' '))
list_a = list(map(int, input().split(' ')))
list_b = list(map(int, input().split(' ')))
temp_k = 0
temp_m = 0
(l, r) = ([], [])
for i in range(k):
	l.append(list_a[i])
for i in range(m):
	r.append(list_b[b - i - 1])
if l[-1] < r[-1]:
	print('YES')
else:
	print('NO')


N = list(map(int, input().split()))
KM = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
del A[KM[0]:len(A)]
del B[0:len(B) - KM[1]]
if A[len(A) - 1] >= B[0]:
	print('NO')
else:
	print('YES')


(Na, Nb) = tuple((int(i) for i in input().split()))
(k1, k2) = tuple((int(i) for i in input().split()))
A = list((int(i) for i in input().split()))
B = list((int(i) for i in input().split()))
if A[k1 - 1] < B[Nb - k2]:
	print('YES')
else:
	print('NO')


(A, B) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in a[:k]:
	if i < b[-m]:
		ans += 1
if ans == k:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
(k, m) = map(int, input().split())
a1 = [int(y) for y in input().split()]
a1.sort()
a11 = a1[:k]
a2 = [int(z) for z in input().split()]
a2.sort()
a21 = a2[len(a2) - m:]
if a11[-1] < a21[0]:
	print('YES')
else:
	print('NO')


(x, y) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[len(b) - m]:
	print('YES')
else:
	print('NO')


3
(Na, Nb) = map(int, input().split())
(k, m) = map(int, input().split())
assert 1 <= k <= Na
assert 1 <= m <= Nb
a = list(map(int, input().split()))
b = list(map(int, input().split()))
assert len(a) == Na
assert len(b) == Nb
print('YES' if a[k - 1] < b[-m] else 'NO')


s = input().split(' ')
n = int(s[0])
m = int(s[1])
s = input().split(' ')
x = int(s[0])
y = int(s[1])
a = input().split(' ')
b = input().split(' ')
if int(a[x - 1]) < int(b[m - y]):
	print('YES')
else:
	print('NO')


(sa, sb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[-m]:
	print('Yes')
else:
	print('No')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
l = l[:k]
l1 = l1[len(l1) - m:]
if l[-1] < l1[0]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
arr_a = list(map(int, input().split()))
arr_b = list(map(int, input().split()))
if arr_a[k - 1] < arr_b[nb - m]:
	print('YES')
else:
	print('NO')


def check_arrays(A, B, k, m):
	if A[k - 1] < B[len(B) - m]:
		return 'YES'
	else:
		return 'NO'
(nA, nB) = [int(x) for x in input().split()]
(k, m) = [int(x) for x in input().split()]
aA = [int(x) for x in input().split()]
aB = [int(x) for x in input().split()]
print(check_arrays(aA, aB, k, m))


(nA, nB) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
maxak = A[k - 1]
count = 0
for i in range(nB):
	if B[i] > maxak:
		count = count + 1
		if count == m:
			break
if count == m:
	print('YES')
else:
	print('NO')


f = lambda : map(int, input().split())
(a, b) = f()
(k, m) = f()
la = list(f())
lb = list(f())
print('YNEOS'[la[k - 1] >= lb[-m]::2])


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
lstA = list(map(int, input().split()))
lstB = list(map(int, input().split()))
chosenA = []
chosenB = []
for i in range(k):
	chosenA.append(lstA[i])
for i in range(-1, -m - 1, -1):
	chosenB.append(lstB[i])
ans = 'NO'
if chosenA[-1] < chosenB[-1]:
	ans = 'YES'
print(ans)


(A, B) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
for i in range(B):
	if b[i] > a[k - 1]:
		count = count + 1
	if count == m:
		print('YES')
		break
if count != m:
	print('NO')


(n, m) = [int(i) for i in input().split()]
(x, y) = [int(i) for i in input().split()]
a = list(map(int, input().split()))[:n]
b = list(map(int, input().split()))[:m]
a.sort()
b.sort()
c = a[:x]
d = b[-y:]
c.sort()
d.sort()
if c[-1] < d[0]:
	print('YES')
else:
	print('NO')


(number_array_a, number_array_b) = map(int, input().split())
(k, m) = map(int, input().split())
array_a = list(map(int, input().split()))
array_b = list(map(int, input().split()))
max_a = array_a[k - 1]
min_b = array_b[-m]
if max_a < min_b:
	print('YES')
else:
	print('NO')


def main():
	data = input().split()
	size_a = int(data[0])
	size_b = int(data[1])
	data = input().split()
	k = int(data[0])
	m = int(data[1])
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	if a[k - 1] < b[len(b) - m]:
		print('YES')
	else:
		print('NO')
main()


(n, m) = map(int, input().split())
(first, second) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
l = -1000000000
h = -100000000
for i in range(0, len(arr1)):
	if i == first - 1:
		l = arr1[i]
for i in range(0, len(arr2)):
	if i == m - second:
		h = arr2[i]
if l < h:
	print('YES')
else:
	print('NO')


(size_A, size_B) = map(int, input().split())
(k, m) = map(int, input().split())
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
sum = 0
for num in b:
	if num > a[k - 1]:
		sum += 1
		if sum >= m:
			print('YES')
			break
else:
	print('NO')


def Main():
	(nA, mA) = map(int, input().split())
	(k, m) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if A[k - 1] < B[mA - m]:
		print('YES')
	else:
		print('NO')
Main()


(n1, n2) = map(int, input().split())
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if a[n - 1] < b[-m]:
	print('YES')
else:
	print('NO')


(n, m) = [int(x) for x in input().split()]
(k, t) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
if a[k - 1] < b[m - t]:
	print('YES')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
l1 = sorted(list(map(int, input().split())))
l2 = sorted(list(map(int, input().split())))
if l1[k - 1] < l2[-m]:
	print('YES')
else:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict, deque

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

def I():
	return int(input())

def LIST(n, m=None):
	return [0] * n if m is None else [[0] * m for i in range(n)]

def ELIST(n):
	return [[] for i in range(n)]

def MI(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = VI()
	return arr

def MS(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = input()
	return arr

def MIT(n=None, m=None):
	if n is None:
		(n, m) = VI()
	a = MI(n, m)
	arr = LIST(m, n)
	for (i, l) in enumerate(a):
		for (j, x) in enumerate(l):
			arr[j][i] = x
	return arr

def run(na, nb, k, m, a, b):
	if a[k - 1] < b[nb - m]:
		print('YES')
	else:
		print('NO')

def main(info=0):
	(na, nb) = VI()
	(k, m) = VI()
	a = VI()
	b = VI()
	run(na, nb, k, m, a, b)
main()


nurray = input().split()
choo = input().split()
Aarray = input().split()
Barray = input().split()
iAarray = list(Aarray)
iBarray = list(Barray)
dem = 0
for i in range(len(iBarray)):
	if int(iAarray[int(choo[0]) - 1]) < int(iBarray[i]):
		if len(iBarray) - i - 1 >= int(choo[1]) - 1:
			print('YES')
			break
		else:
			print('NO')
			break
	else:
		dem += 1
if dem >= len(iBarray):
	print('NO')


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


l = lambda : map(int, input().split())
(a, b) = l()
(k, m) = l()
A = list(l())
B = list(l())
print(('NO', 'YES')[A[k - 1] < B[b - m]])


data = list(map(int, input().split()))
nA = data[0]
nB = data[1]
data = list(map(int, input().split()))
k = data[0]
m = data[1]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A[k - 1] < B[nB - m]:
	print('YES')
else:
	print('NO')


(p, q) = input().split()
(a, b) = input().split()
a = int(a)
b = int(b)

def inp(s):
	j = 0
	a = []
	for i in range(len(s)):
		if s[i] == ' ':
			a.append(int(s[j:i]))
			j = i + 1
		if i == len(s) - 1:
			a.append(int(s[j:]))
	return a
s = input()
t = input()
t = inp(t)
s = inp(s)
x = []
y = []
for i in range(a):
	x.append(s[i])
for i in range(1, b + 1):
	y.append(t[len(t) - i])
if max(x) < min(y):
	print('YES')
else:
	print('NO')


(len_a, len_b) = map(int, input().split())
(k, m) = map(int, input().split())
a = input().split()[k - 1]
b = input().split()[len_b - m]
if int(a) < int(b):
	print('YES')
else:
	print('NO')


import time
(COL, ROW, LEN) = (1000, 1000, 26)
matrix = [[0] * COL for i in range(ROW)]
arr = [0] * LEN
direction = ((0, -1), (-1, 0), (0, 1), (1, 0))

class Pair:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def timer(func, *pargs, **kargs):
	start = time.time()
	func(*pargs, **kargs)
	return time.time() - start
(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a1.sort()
a2.sort()
if k <= len(a1):
	if m <= len(a2):
		if a2[len(a2) - m] > a1[k - 1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


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


def Arrays():
	input()
	(k, m) = map(int, input().split())
	na = list(map(int, input().split()))
	nb = sorted(map(int, input().split()), reverse=True)
	na = na[:k]
	nb = sorted(nb[:m])
	if len(na) == 0 or len(nb) == 0:
		print('NO')
	elif na[len(na) - 1] >= nb[0]:
		print('NO')
	else:
		print('YES')
Arrays()


nl = list(map(int, input().split()))
rl = list(map(int, input().split()))
k = rl[0]
m = rl[1]
vla = list(map(int, input().split()))
vlb = list(map(int, input().split()))
tempa = vla[:k]
tempb = vlb[-m:]
if tempa[-1] < tempb[0]:
	print('YES')
else:
	print('NO')


(n_a, n_b) = tuple(map(int, input().split()))
(k, m) = tuple(map(int, input().split()))
a = list(map(int, input().split()))[:k]
b = list(map(int, input().split()))[-m:]
num_a = a[-1]
num_b = b[0]
if num_a < num_b:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
arrA = list(map(int, input().split()))[:na]
arrB = list(map(int, input().split()))[:nb]
if arrA[k - 1] < arrB[nb - m]:
	print('Yes')
else:
	print('No')


temp = [int(x) for x in input().split()]
nA = temp[0]
nB = temp[1]
temp = [int(x) for x in input().split()]
k = temp[0]
m = temp[1]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
if A[k - 1] < B[-m]:
	print('YES')
else:
	print('NO')


(nA, nB) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
Ak = A[k - 1]
lb = len(B)
if B[lb - m] > Ak:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(reversed(list(map(int, input().split()))))
print('YES' if A[k - 1] < B[m - 1] else 'NO')


input()
(k, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
print('YES' if a[k - 1] < b[len(b) - m] else 'NO')


from sys import stdin, stdout

def main():
	number_of_elements_in_A_B = stdin.readline().rstrip()
	k_m = [int(i) for i in stdin.readline().rstrip().split()]
	k = k_m[0]
	m = k_m[1]
	listA = [int(i) for i in stdin.readline().rstrip().split()]
	listB = [int(i) for i in stdin.readline().rstrip().split()]
	k_members_of_A = listA[:k]
	m_members_of_B = listB[-m:]
	if max(k_members_of_A) < min(m_members_of_B):
		return 'YES'
	else:
		return 'NO'
print(main())


def A_arrays():
	sizes = input().split()
	k = input().split()
	arrayA = input().split()
	arrayB = input().split()
	checkA = []
	for i in range(int(k[0])):
		checkA.append(arrayA[i])
	while True:
		if int(arrayB[0]) > int(checkA[-1]):
			if len(arrayB) >= int(k[1]):
				print('YES')
				return
		else:
			arrayB.pop(0)
			if len(arrayB) < int(k[1]):
				print('NO')
				return
A_arrays()


(a, b) = input().split()
(c, d) = input().split()
c = int(c)
d = int(d)
l = list(map(int, input().split()))
li = list(map(int, input().split()))
l = l[:c]
li = li[-d:]
if max(l) < min(li):
	print('YES')
else:
	print('NO')


first_line = list(map(int, input().split()))
second_line = list(map(int, input().split()))
size_a = first_line[0]
size_b = first_line[1]
k = second_line[0]
m = second_line[1]
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def main():
	if k > len(A):
		print('NO')
		return
	if m > len(B):
		print('NO')
		return
	if A[k - 1] < B[-m]:
		print('YES')
	else:
		print('NO')
main()


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort(reverse=True)
if a[k - 1] < b[m - 1]:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
(k, l) = map(int, input().split())
lsA = list(map(int, input().split()))
lsB = list(map(int, input().split()))
flag = True
subA = lsA[:k]
subB = lsB[m - l:]
if max(subA) < min(subB):
	print('YES')
else:
	print('NO')


(na, nb) = [int(j) for j in input().split()]
(k, m) = [int(j) for j in input().split()]
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
if a[k - 1] < b[nb - m]:
	print('YES')
else:
	print('NO')


a = input()
b = int(a.split()[1])
a = int(a.split()[0])
k = input()
m = int(k.split()[1])
k = int(k.split()[0])
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
if a1[k - 1] >= a2[-m]:
	print('NO')
else:
	print('YES')


(na, nb) = [int(x) for x in input().split()]
(m, k) = [int(x) for x in input().split()]
vA = list(map(int, input().split()))
vB = list(map(int, input().split()))
markA = vA[m - 1]
markB = vB[-k]
if markB > markA:
	print('YES')
else:
	print('NO')


(na, nb) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
if l1[k - 1] < l2[nb - m]:
	print('YES')
else:
	print('NO')


import sys
import os

def getin():
	return list(map(int, input().split(' ')))
(na, nb) = getin()
(k, m) = getin()
a = getin()
b = getin()
if sorted(a)[k - 1] < sorted(b)[nb - m]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(['NO', 'YES'][a[k - 1] < b[nb - m]])


lijn1 = input().split()
a = int(lijn1[0])
b = int(lijn1[1])
lijn2 = input().split()
k = int(lijn2[0])
m = int(lijn2[1])
A = input().split()
B = input().split()
if int(A[k - 1]) < int(B[b - m]):
	print('YES')
else:
	print('NO')


(n1, n2) = [int(x) for x in input().split()]
(k, m) = [int(x) for x in input().split()]
A = list((int(num) for num in input().strip().split()))[:n1]
B = list((int(num) for num in input().strip().split()))[:n2]
sortA = A.sort()
sortB = B.sort(reverse=True)
if A[k - 1] < B[m - 1]:
	print('YES')
else:
	print('NO')


(n, l) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[l - m]:
	print('YES')
	quit()
print('NO')


(m, n) = [int(x) for x in input().split()]
(i, j) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
print('YES' if a[i - 1] < b[-j] else 'NO')


def solve(a, b, n, m):
	(a, b) = (sorted(a), sorted(b, reverse=True))
	if a[n - 1] < b[m - 1]:
		return 'YES'
	return 'NO'
(x, y) = map(int, input().split())
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(solve(a, b, n, m))


def bs(b, val):
	low = 0
	high = len(b) - 1
	while low <= high:
		mid = (low + high) // 2
		if b[mid] > val and b[mid - 1] <= val:
			return mid
		elif b[mid] <= val:
			low = mid + 1
		else:
			high = mid - 1
	return -1
(n, m) = map(int, input().split())
(k, j) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[0]:
	if len(b) >= j:
		print('YES')
		exit()
ans = bs(b, a[k - 1])
if ans == -1:
	print('NO')
	exit()
elif len(b) - ans >= j:
	print('YES')
else:
	print('NO')


size = [int(x) for x in input().split()]
(size1, size2) = (size[0], size[1])
number = [int(x) for x in input().split()]
(k, m) = (number[0], number[1])
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

def test():
	if b[size2 - m] > a[k - 1]:
		print('YES')
		return
	else:
		print('NO')
		return
test()


(x, y) = map(int, input().split())
(n, m) = map(int, input().split())
l1 = sorted(map(int, input().split()))
l2 = sorted(map(int, input().split()))
print(['NO', 'YES'][l1[n - 1] < l2[-m]])


(Na, Nb) = map(int, input().split())
(k, m) = map(int, input().split())
lista_a = list(map(int, input().split()))
lista_b = list(map(int, input().split()))
if lista_a[k - 1] < lista_b[Nb - m]:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(aN, bN) = map(int, input().split())
arrayA = list(map(int, input().split()))
arrayB = list(map(int, input().split()))
if arrayA[aN - 1] < arrayB[b - bN]:
	print('YES')
else:
	print('NO')


(aa, bb) = map(int, input().split())
(k, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
a.sort()
b.sort()
b = b[-m:]
cetak = 'YES'
tm = 0
while tm < k:
	if a[tm] >= b[0]:
		cetak = 'NO'
		break
	else:
		tm += 1
print(cetak)


(n, m) = map(int, input().split())
(k1, k2) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k1 - 1] < b[m - k2]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
ai = list(map(int, input().split()))
ai.sort()
num = ai[k - 1]
bi = list(map(int, input().split()))
ans = [int(bi[i] > num) for i in range(nb)]
if sum(ans) >= m:
	print('YES')
else:
	print('NO')


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


import sys
element_of_array = input()
k_and_m = input()
array1_raw = input()
array2_raw = input()
(k, m) = k_and_m.split()
k = int(k) - 1
array1 = array1_raw.split()
array2 = array2_raw.split()
offset = len(array2) - int(m)
if int(array1[int(k)]) < int(array2[int(offset)]):
	print('YES')
else:
	print('NO')


s = input().split(' ')
N = int(s[0])
M = int(s[1])
s = input().split(' ')
A = int(s[0])
B = int(s[1])
s = input().split(' ')
a = [int(x) for x in s]
s = input().split(' ')
b = [int(x) for x in s]
if a[A - 1] < b[M - B]:
	print('YES')
else:
	print('NO')


(x, y) = tuple(input().split())
(k, m) = tuple(input().split())
(k, m) = (int(k), int(m))
l1 = input().split()
l2 = input().split()
l3 = []
l4 = []
for i in l1:
	l3.append(int(i))
for i in l2:
	l4.append(int(i))
f = l3[:k]
l4.reverse()
q = l4[:m]
if max(f) < min(q):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().strip().split())
(xa, xb) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
if a[xa - 1] < b[m - xb]:
	print('YES')
else:
	print('NO')


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


I = lambda : map(int, input().split())
(A, B) = I()
(k, m) = I()
k = sorted(I())[k - 1]
m = sorted(I())[-m]
print('YNEOS'[k >= m::2])


(n_a, n_b) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if a[k - 1] < b[n_b - m]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
array_a = list(map(int, input().split()))
array_b = list(map(int, input().split()))
size_a = len(array_a)
size_b = len(array_b)
flag = True
sub_a = array_a[0:k]
sub_b = array_b[size_b - m:size_b]
if sub_a[len(sub_a) - 1] >= sub_b[0]:
	flag = False
if flag:
	print('YES')
else:
	print('NO')


(a1, a2) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
B.sort(reverse=True)
if A[k - 1] < B[m - 1]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = a[k - 1]
temp = []
for i in range(nb):
	if b[i] > x:
		temp = b[i:]
		break
if len(temp) >= m:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
input = stdin.readline
(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[nb - m]:
	stdout.write('YES')
else:
	stdout.write('NO')


(a, b) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
A = sorted(A)
B = sorted(B, reverse=True)
if A[k - 1] < B[m - 1]:
	print('YES')
else:
	print('NO')


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


(n, m) = map(int, input().split())
(a, b) = map(int, input().split())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
k = l[a - 1]
count = len([i for i in m if i > k])
if count >= b:
	print('YES')
else:
	print('NO')


(a, s) = map(int, input().split())
(k, m) = map(int, input().split())
f = list(map(int, input().split()))
b = list(map(int, input().split()))
if f[k - 1] < b[s - m]:
	print('YES')
else:
	print('NO')


def main():
	(a, b) = map(int, input().split())
	(k, m) = map(int, input().split())
	print(('NO', 'YES')[k <= a and m <= b and (int(input().split()[k - 1]) < int(input().split()[-m]))])
main()


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
A.sort()
B.sort(reverse=True)
if k > na or m > nb:
	print('NO')
elif A[k - 1] < B[m - 1]:
	print('YES')
else:
	print('NO')


import sys
import time

def main():
	first_line_input = sys.stdin.readline().strip()
	second_line_input = sys.stdin.readline().strip()
	second_line_input = list(map(int, second_line_input.split(' ')))
	third_line_input = sys.stdin.readline().strip()
	third_line_input = list(map(int, third_line_input.split(' ')))
	fourth_line_input = sys.stdin.readline().strip()
	fourth_line_input = list(map(int, fourth_line_input.split(' ')))
	var_k = second_line_input[0]
	var_m = second_line_input[1]
	array_A = third_line_input
	array_B = fourth_line_input
	array_A.sort()
	array_B.sort(reverse=True)
	list_k_array_A = array_A[0:var_k]
	list_m_array_B = array_B[0:var_m]
	highest_no_list_m_array_A = list_k_array_A[-1]
	lowest_no_list_m_array_A = list_k_array_A[0]
	lowest_no_list_m_array_B = list_m_array_B[-1]
	flag_ans = 'NO'
	if highest_no_list_m_array_A < lowest_no_list_m_array_B and lowest_no_list_m_array_A < lowest_no_list_m_array_B:
		flag_ans = 'YES'
	print(flag_ans)
main()


input()
data = [int(info) for info in input().split(' ')]
first_array_length = data[0]
second_array_length = data[1]
first_array = [int(info) for info in input().split(' ')]
second_array = [int(info) for info in input().split(' ')]
if first_array[first_array_length - 1] >= second_array[len(second_array) - second_array_length]:
	print('NO')
else:
	print('YES')


(a1, b1) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
c = a[k - 1]
i = 0
while i < b1:
	if b[i] > c:
		break
	i += 1
if len(b[i:]) >= m:
	print('YES')
else:
	print('NO')


import itertools as ittls
from collections import Counter
import re

def inputarray(func=int):
	return map(func, input().split())
(n, m) = inputarray()
(p, q) = inputarray()
A = list(inputarray())
B = list(reversed(list(inputarray())))
print('YES' if A[p - 1] < B[q - 1] else 'NO')


(lena, lenb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))[:k]
b = list(map(int, input().split()))[lenb - m:]
print('YES' if a[-1] < b[0] else 'NO')


import webbrowser
if True == False:
	url = input()
	while True:
		webbrowser.open(url)
else:
	(a, b) = [int(i) for i in input().split()]
	(m, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	p = [int(i) for i in input().split()]
	l.sort()
	p.sort()
	l2 = l[:m]
	p2 = p[b - k:]
	if max(l2) < min(p2):
		print('YES')
	else:
		print('NO')


inp = input()
i = 0
f = inp.find(' ')
nA = int(inp[i:f])
nB = int(inp[f + 1:])
inp = input()
i = 0
f = inp.find(' ')
k = int(inp[i:f])
m = int(inp[f + 1:])
inp = input() + ' '
i = 0
a = []
b = []
for j in range(0, nA):
	f = inp.find(' ', i)
	a += [int(inp[i:f])]
	i = f + 1
inp = input() + ' '
i = 0
for j in range(0, nB):
	f = inp.find(' ', i)
	b += [int(inp[i:f])]
	i = f + 1
if a[k - 1] < b[nB - m]:
	print('YES')
else:
	print('NO')


def process():
	(n, m) = map(int, input().split())
	(p, q) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(m):
		if b[i] > a[p - 1]:
			if m - i >= q:
				return 'YES'
			else:
				return 'NO'
	return 'NO'
print(process())


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l4 = list(map(int, input().split()))
l3.sort()
l4.sort(reverse=True)
if l3[l2[0] - 1] < l4[l2[1] - 1]:
	print('YES')
else:
	print('NO')


z = lambda : tuple(map(int, input().split()))
(s, s1) = z()
(a, b) = z()
print('YES' if z()[a - 1] < z()[-b] else 'NO')


import itertools, functools, math

def solve():
	(na, nb) = map(int, input().split())
	(k, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if a[k - 1] < b[nb - m]:
		return 'YES'
	return 'NO'
print(solve())


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max = a[k - 1]
min = b[nb - m]
if max < min:
	print('YES')
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
(k, m) = input().split()
m = int(m)
k = int(k)
A = input().split()
B = input().split()
for i in range(a):
	A[i] = int(A[i])
for i in range(b):
	B[i] = int(B[i])
if k <= a and A[k - 1] < B[-m]:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
(la, lb) = map(int, stdin.readline().split())
(k, m) = map(int, stdin.readline().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


line1 = [int(x) for x in input().split()]
line2 = [int(x) for x in input().split()]
line3 = [int(x) for x in input().split()]
line4 = [int(x) for x in input().split()]
k = line2[0]
m = line2[1]
if line3[k - 1] < line4[len(line4) - m]:
	print('YES')
else:
	print('NO')


n = [int(x) for x in input().split()]
k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
if b[n[1] - k[1]] > a[k[0] - 1]:
	print('YES')
else:
	print('NO')


(n1, n2) = (int(i) for i in input().split())
(k, m) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
k1 = a[k - 1]
k2 = -1
for i in range(n2):
	if b[i] > k1:
		k2 = i
		break
if k2 == -1:
	print('NO')
elif n2 - k2 >= m:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
y = a[k - 1]
w = b[nb - m]
if y < w:
	print('YES')
else:
	print('NO')


(Na, Nb) = input().split()
(Na, Nb) = (int(Na), int(Nb))
(k, m) = input().split()
(k, m) = (int(k), int(m))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
if A[k - 1] > B[Nb - m] or A[k - 1] == B[Nb - m]:
	print('NO')
else:
	print('YES')


(a, b) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
inplist1 = list(map(int, input().split()))
inplist2 = list(map(int, input().split()))
if inplist1[k - 1] < inplist2[b - m]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if k <= na:
	temp1 = k - 1
	i = 0
	while i < nb and b[i] <= a[temp1]:
		i += 1
	if i == nb:
		print('NO')
	elif nb - i >= m:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(na, nb) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
lo = 0
hi = 0
for i in range(na):
	if i == k - 1:
		lo = a[i]
for i in range(nb):
	if i == nb - m:
		hi = b[i]
if lo < hi:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(na - 1, -1, -1):
	if a[i] < b[nb - m]:
		c = i + 1
		break
if c >= k:
	print('YES')
else:
	print('NO')


line1 = input('').split()
sizeA = int(line1[0])
sizeB = int(line1[1])
line2 = input('').split()
k = int(line2[0])
m = int(line2[1])
listA = list(map(int, input('').split()))
listB = list(map(int, input('').split()))
sub_listA = listA[:k]
sub_listB = listB[len(listB) - m:]
flag = True
if max(sub_listA) >= min(sub_listB):
	flag = False
if flag:
	print('YES')
else:
	print('NO')


import collections

def solve(lenA, lenB, k, m, a, b):
	maxA = max(sorted(a)[:k])
	minB = min(sorted(b, reverse=True)[:m])
	return maxA < minB
[lenA, lenB] = list(map(int, input().strip().split()))
[k, m] = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
print('YES' if solve(lenA, lenB, k, m, a, b) else 'NO')


strinp = str(input()).split(sep=' ')
strinp2 = str(input()).split(sep=' ')
n = int(strinp[0])
m = int(strinp[1])
k = int(strinp2[0])
l = int(strinp2[1])
masa = str(input()).split(sep=' ')
masb = str(input()).split(sep=' ')
if int(masa[k - 1]) < int(masb[m - l]):
	print('YES')
else:
	print('NO')


(n_a, n_b) = str(input()).split()
(k, m) = str(input()).split()
k = int(k)
m = int(m)
line_a = str(input()).split()
line_a = [int(it) for it in line_a]
line_a.sort()
line_b = str(input()).split()
line_b = [int(it) for it in line_b]
line_b.sort(reverse=True)
if line_a[k - 1] < line_b[m - 1]:
	print('YES')
else:
	print('NO')


(nA, nB) = map(int, input().strip().split())
(k, m) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
if a[k - 1] < b[nB - m]:
	print('YES')
else:
	print('NO')


(Len_A, Len_B) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A[k - 1] < B[Len_B - m]:
	print('YES')
else:
	print('NO')


(a, b) = [int(x) for x in input().split()]
(k, m) = [int(x) for x in input().split()]
array1 = sorted([int(x) for x in input().split()])
array2 = sorted([int(x) for x in input().split()], reverse=True)
if array1[k - 1] < array2[m - 1]:
	print('YES')
else:
	print('NO')


nab = list(map(int, input().split()))
km = list(map(int, input().split()))
na = list(map(int, input().split()))
nb = list(map(int, input().split()))
if na[km[0] - 1] < nb[nab[1] - km[1]]:
	print('YES')
else:
	print('NO')


(x, y) = map(int, input().split())
(k, m) = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
b = [int(x) for x in input().split()]
b.sort()
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


(sa, sb) = map(int, input().split())
(k, m) = map(int, input().split())
arra = [int(i) for i in input().split()]
arrb = [int(i) for i in input().split()]
if arra[k - 1] < arrb[-m]:
	print('Yes')
else:
	print('No')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
lsa = list(map(int, input().split()))
lsb = list(map(int, input().split()))
print('YNEOS'[lsa[k - 1] >= lsb[nb - m]::2])


(n1, m1) = map(int, input().split())
(n2, m2) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b = b[::-1]
l = []
n = []
for i in range(n2):
	l.append(a[i])
for i in range(m2):
	n.append(b[i])
s = max(l)
s2 = min(n)
if s < s2:
	print('YES')
else:
	print('NO')


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
(na, nb) = li()
(k, m) = li()
a = li()
b = li()
a.sort()
b.sort()
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


(a, b) = input().split()
(n, m) = map(int, input().split())
ls1 = list(map(int, input().split()))
ls2 = list(map(int, input().split()))
if ls1[n - 1] < ls2[-m]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(m, k) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
i = 0
while i < nb and b[i] <= a[m - 1]:
	i += 1
if i + k - 1 >= nb:
	print('NO')
else:
	print('YES')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
l2.sort()
t = l1[k - 1]
index = n2
for i in range(0, n2):
	if l2[i] > t:
		index = i
		break
if index == n2:
	print('NO')
elif n2 - index >= m:
	print('YES')
else:
	print('NO')


def findOccurence(b, q, num):
	for i in range(q):
		if b[i] > num:
			return i
	return -1
(p, q) = map(int, input().split())
(k, m) = map(int, input().split())
a = sorted([int(i) for i in input().split()])
b = sorted([int(i) for i in input().split()])
index = findOccurence(b, q, a[k - 1])
if index == -1:
	print('NO')
elif q - index >= m:
	print('YES')
else:
	print('NO')


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


(m, n) = map(int, input().split())
(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = list(map(int, input().split()))
flag = 0
for i in range(a):
	if c[i] < d[-b]:
		flag = 1
	else:
		flag = 0
		break
print(['NO', 'YES'][flag == 1])


(n, m) = map(int, input().split(' '))
(k, l) = map(int, input().split(' '))
a = input().split(' ')
b = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
for i in range(m):
	b[i] = int(b[i])
if a[k - 1] < b[m - l]:
	print('YES')
else:
	print('NO')


input()
(k, m) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
a = A[k - 1]
b = B[-m]
if a < b:
	print('YES')
else:
	print('NO')


inp = lambda : list(map(int, input().split()))
l1 = inp()
(a, b) = inp()
print(['NO', 'YES'][inp()[a - 1] < inp()[-b]])


def check_arrays(_a, _b, _k, _m):
	if _a[k - 1] >= _b[-m]:
		return 'NO'
	else:
		return 'YES'
(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(check_arrays(a, b, k, m))


def bol(a, b, k, m):
	if a[k - 1] < b[len(b) - m]:
		print('YES')
	else:
		print('NO')
n = list(map(int, input('').split()))
para = list(map(int, input('').split()))
a = list(map(int, input('').split()))
b = list(map(int, input('').split()))
bol(a, b, para[0], para[1])


input()
(k, m) = list(map(int, input().split(' ')))
A = sorted(list(map(int, input().split(' '))))
B = sorted(list(map(int, input().split(' '))), reverse=True)
print('YES' if A[k - 1] < B[m - 1] else 'NO')


(alen, blen) = input().split(' ')
(k, m) = input().split(' ')
a = input().split(' ')
b = input().split(' ')
k = int(k)
m = int(m)
num1 = a[k - 1]
num2 = b[-m]
if int(num1) < int(num2):
	print('Yes')
else:
	print('No')


(a1, b1) = map(int, input().split())
(k, m) = map(int, input().split())
(a, b) = (list(map(int, input().split())), list(map(int, input().split()))[::-1])
print('YES' if a[k - 1] < b[m - 1] else 'NO')


import sys
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
(n1, n2) = li()
(k, m) = li()
A = li()
B = li()
if A[k - 1] < B[n2 - m]:
	print('YES')
else:
	print('NO')


def arrays(size_of_arrays, chosen_quantity, array_a, array_b):
	max_array_a = array_a[chosen_quantity[0] - 1]
	min_array_b = array_b[0 - chosen_quantity[1]]
	result = 'YES' if max_array_a < min_array_b else 'NO'
	return result
size_of_arrays = [int(i) for i in input().split()]
chosen_quantity = [int(i) for i in input().split()]
array_a = [int(i) for i in input().split()]
array_b = [int(i) for i in input().split()]
print(arrays(size_of_arrays, chosen_quantity, array_a, array_b))


input()
(k, j) = map(int, input().split())
print(['NO', 'YES'][list(map(int, input().split()))[k - 1] < list(map(int, input().split()))[-j]])


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = sorted([int(_) for _ in input().split()])
b = sorted([int(_) for _ in input().split()])
if a[k - 1] < b[-m]:
	print('Yes')
else:
	print('No')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
nas = map(int, input().split())
nbs = map(int, input().split())
nas = list(sorted(nas))
nbs = list(sorted(nbs))
print('YES' if nas[k - 1] < nbs[nb - 1 - (m - 1)] else 'NO')


(l1, l2) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[l2 - m]:
	print('YES')
else:
	print('NO')


(x, y) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
l1 = [int(o) for o in input().split()]
l2 = [int(u) for u in input().split()]
f = l1[:k]
l2.reverse()
q = l2[:m]
if max(f) < min(q):
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
arr1 = arr1[k - 1]
arr2 = arr2[-m]
if arr1 < arr2:
	print('YES')
else:
	print('NO')


ans = 'YES'
(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
print('YES' if first[k - 1] < second[-m] else 'NO')


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


ab = list(map(int, input().split()))
km = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A[km[0] - 1] < B[ab[1] - km[1]]:
	print('YES')
else:
	print('NO')


(a, b) = (int(i) for i in input().split())
(k, m) = (int(i) for i in input().split())
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split() if int(i) > a1[k - 1]]
if len(a2) >= m:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
a1 = a[:k]
b1 = b[len(b) - m:len(b)]
if min(b1) <= max(a1):
	print('NO')
else:
	print('YES')


n = input().split()
m = input().split()
l1 = input().split()
l2 = input().split()
k = 0
for x in range(int(m[0])):
	if int(l1[x]) >= int(l2[int(n[1]) - int(m[1])]):
		print('NO')
		k = 1
		break
if k == 0:
	print('YES')


from sys import stdin, stdout
(a, b) = map(int, stdin.readline().strip().split())
(m, n) = map(int, stdin.readline().strip().split())
ls = list(map(int, stdin.readline().strip().split()))
ls2 = list(map(int, stdin.readline().strip().split()))
stdout.write('YES\n' if ls[m - 1] < ls2[-n] else 'NO\n')


def is_listA_less_than_listB(listA, listB, k, m):
	lst1 = listA[:k]
	lst2 = listB[-m:len(listB)]
	if lst1[-1] < lst2[0]:
		return 'YES'
	return 'NO'
(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
listA = list(map(int, input().split()))
listB = list(map(int, input().split()))
print(is_listA_less_than_listB(listA, listB, k, m))


(_, (k, m)) = (input(), map(int, input().split()))
(A, B) = ([int(i) for i in input().split()], [int(i) for i in input().split()])
if A[k - 1] < B[-m]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
temp = a[k - 1]
flag = True
for i in range(nb):
	if b[i] > temp:
		if nb - i >= m:
			print('YES')
			flag = False
			break
if flag:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print('YES' if max(A[:k]) < min(B[-m:]) else 'NO')


import unittest
import sys

class Arrays:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		(self.a, self.b) = map(int, uinput().split())
		(self.k, self.m) = map(int, uinput().split())
		self.na = list(map(int, uinput().split()))
		self.nb = list(map(int, uinput().split()))
		self.na = sorted(self.na)
		self.nb = sorted(self.nb)

	def calculate(self):
		result = 'YES' if self.na[self.k - 1] < self.nb[-self.m] else 'NO'
		return result

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '3 3\n2 1\n1 2 3\n3 4 5'
		d = Arrays(test)
		self.assertEqual(d.a, 3)
		self.assertEqual(d.b, 3)
		self.assertEqual(d.na, [1, 2, 3])
		self.assertEqual(d.nb, [3, 4, 5])
		self.assertEqual(Arrays(test).calculate(), 'YES')
		test = '3 3\n3 3\n1 2 3\n3 4 5'
		self.assertEqual(Arrays(test).calculate(), 'NO')
		test = '5 2\n3 1\n1 1 1 1 1\n2 2'
		self.assertEqual(Arrays(test).calculate(), 'YES')
		test = '1\n1 2\n1'

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Arrays(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Arrays().calculate())


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


(n1, n2) = map(int, input().strip().split(' '))
(k, m) = map(int, input().strip().split(' '))
lst1 = list(map(int, input().strip().split(' ')))
lst2 = list(map(int, input().strip().split(' ')))
if lst1[k - 1] < lst2[n2 - m]:
	print('YES')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k1, k2) = map(int, input().split())
(l1, l2) = (list(map(int, input().split())), list(map(int, input().split())))
if l1[k1 - 1] < l2[-k2]:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
ar1 = list(map(int, input().split()))
if ar[n - 1] < ar1[-k]:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
temp = a[k - 1]
for j in b:
	if j > temp:
		l = b.index(j)
		break
try:
	if nb - l >= m:
		print('YES')
	else:
		print('NO')
except:
	print('NO')


r = lambda : map(int, input().split())
(l_a, l_b) = r()
(k, m) = r()
a = list(r())
b = list(r())
if a[k - 1] < b[l_b - m]:
	print('YES')
else:
	print('NO')


pada = input()
(r, t) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
if a[r - 1] < b[len(b) - t]:
	print('YES')
else:
	print('NO')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if a[k - 1] < b[nB - m]:
	print('YES')
else:
	print('NO')


input()
(k, m) = map(int, input().split())
l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
if l1[k - 1] < l2[-m]:
	print('YES')
else:
	print('NO')


read = lambda : map(int, input().split())
input()
(k, m) = read()
(a, b) = (sorted(read()), sorted(read()))
print('YES' if a[k - 1] < b[-m] else 'NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, 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 [int(x) for x in sys.stdin.readline().split()]

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():
	(n1, n2) = LI()
	(k, m) = LI()
	a = sorted(LI())
	b = sorted(LI())
	if a[k - 1] < b[-m]:
		return 'YES'
	return 'NO'
print(main())


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


import sys
(na, nb) = map(int, sys.stdin.readline().split())
(k, m) = map(int, sys.stdin.readline().split())
lista = list(map(int, sys.stdin.readline().split()))
listb = list(map(int, sys.stdin.readline().split()))
lista.sort()
listb.sort()
if lista[k - 1] < listb[-m]:
	print('YES')
else:
	print('NO')


def main():
	(na, nb) = map(int, input().split())
	(k, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(('NO', 'YES')[k <= na and m <= nb and (a[k - 1] < b[-m])])
main()


read = lambda : list(map(int, input().split()))
(na, nb) = read()
(n, m) = read()
A = read()
B = read()
m -= 1
C = A[:n]
D = B[nb - m - 1:]
print('YES' if max(C) < min(D) else 'NO')


(n, m) = map(int, input().split())
(x, y) = map(int, input().split())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
l2.sort(reverse=True)
if all((l1[i] < l2[y - 1] for i in range(x))):
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, l) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[nb - l]:
	print('YES')
else:
	print('NO')


input()
(k, m) = map(int, input().split())
data1 = list(map(int, input().split()))
data2 = list(map(int, input().split()))
print(('NO', 'YES')[data1[k - 1] < data2[-m]])


R = lambda : map(int, input().split())
(a_len, b_len) = R()
(k, m) = R()
a = sorted(R())
b = sorted(R(), reverse=True)
a_min = max(a[:k])
b_max = min(b[:m])
if a_min >= b_max:
	print('NO')
else:
	print('YES')


(na, nb) = [int(x) for x in input().split()]
(k, m) = [int(x) for x in input().split()]
qa = [int(x) for x in input().split()]
qb = [int(x) for x in input().split()]
print('YES' if qa[k - 1] < qb[-m] else 'NO')


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

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

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(1):
	(na, nb) = map(int, input().split())
	(ka, kb) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ka -= 1
	if a[ka] < b[-kb]:
		print('YES')
	else:
		print('NO')


def solve(na, nb, k, m, a, b):
	res_a = a[:k]
	res_b = min(b[-m:])
	for i in res_a:
		if i >= res_b:
			return 'NO'
	return 'YES'

def main():
	(na, nb) = list(map(int, input().split(' ')))
	(k, m) = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	print(solve(na, nb, k, m, a, b))
main()


(A_size, B_size) = (int(i) for i in input().split())
(k, m) = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
if A[k - 1] < B[-m]:
	print('YES')
else:
	print('NO')


def main_function():
	input()
	(k, m) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	b = [int(i) for i in input().split(' ')]
	counter_a = 0
	counter_b = 0
	if a[k - 1] < b[-m]:
		return 'YES'
	return 'NO'
print(main_function())


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
maxArrayA = int(input().split()[k - 1])
minArrayB = int(input().split()[b - m])
if maxArrayA < minArrayB:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
mas1 = list(map(int, input().split()))
mas2 = list(map(int, input().split()))
print(['NO', 'YES'][mas1[k - 1] < mas2[len(mas2) - m]])


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = [int(z) for z in input().split()]
b = [int(z) for z in input().split()]
print('YNEOS'[a[k - 1] >= b[-m]::2])


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


from bisect import bisect_left
(n, m) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
i = bisect_left(a, b[-m])
if i >= k:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
input = stdin.readline
(n, m) = list(map(int, input().split()))
(K, M) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
stdout.write('YES' if a[K - 1] < b[-M] else 'NO')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
listA = [i for i in map(int, input().split())]
listB = [i for i in map(int, input().split())]
if listA[k - 1] < listB[-m]:
	print('YES')
else:
	print('NO')


import itertools as it
import functools
import operator
import collections
import math
import sys

def solve(xs, ys, k, m):
	return max(xs[:k]) < min(ys[-m:])

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def tf_to_yn(tf):
	return 'YES' if tf else 'NO'

def main():
	[na, nb] = [int(i) for i in input().strip().split()]
	[k, m] = [int(i) for i in input().strip().split()]
	xs = [int(i) for i in input().strip().split()]
	ys = [int(i) for i in input().strip().split()]
	assert len(xs) == na
	assert len(ys) == nb
	result = tf_to_yn(solve(xs, ys, k, m))
	print(result)
main()


(n1, n2) = input().strip().split(' ')
(n1, n2) = [int(n1), int(n2)]
(k, m) = input().strip().split(' ')
(k, m) = [int(k), int(m)]
a = list(map(int, input().strip().split(' ')))
b = list(map(int, input().strip().split(' ')))
a.sort()
b.sort()
pp = a[k - 1]
xx = n2
for i in range(n2):
	if b[i] > pp:
		xx = i
		break
if n2 - xx >= m:
	print('YES')
else:
	print('NO')


input()
(k, m) = map(int, input().split())
(*l,) = map(int, input().split())
(*r,) = map(int, input().split())
t = l[k - 1]
c = 0
for i in range(len(r)):
	if r[i] > t:
		c += len(r) - i
		break
print('YNEOS'[c < m::2])


(n1, n2) = map(int, input().split())
(s, t) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
if l1[s - 1] < l2[-t]:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(l, r) = map(int, input().split())
v = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
b = b[::-1]
ma = max(v[0:l])
mi = min(b[0:r])
print(['NO', 'YES'][ma < mi])


n = [int(x) for x in input().split()]
(nb_a, nb_b) = (n[0], n[1])
l = [int(x) for x in input().split()]
(k, m) = (l[0], l[1])
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
if b[len(b) - m] > a[k - 1]:
	print('YES')
else:
	print('NO')


R = lambda : list(map(int, input().split()))
(n, m) = R()
(k, l) = R()
n1 = R()
m1 = R()
k1 = [1 for i in n1 if i < m1[m - l]]
print(['NO', 'YES'][sum(k1) >= k])


(A, B) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b = sorted(b, reverse=True)
(ok, ok2) = (False, False)
(i, j) = (0, 0)
while True:
	if a[i] < b[j]:
		k -= 1
		m -= 1
		if ok and ok2:
			break
	if k <= 0:
		ok = True
	else:
		i += 1
	if i == len(a):
		break
	if m <= 0:
		ok2 = True
	else:
		j += 1
	if j == len(b):
		break
	if ok and ok2:
		break
print('YES' if ok and ok2 else 'NO')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
x = [int(q) for q in input().split()]
y = [int(e) for e in input().split()]
t = x[k - 1]
index = -1
for i in range(len(y)):
	if y[i] > t:
		index = i
		break
r = len(y) - index
if index == -1:
	print('NO')
else:
	if r >= m:
		print('YES')
	if r < m:
		print('NO')


(a, b) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
if p[k - 1] < q[b - m]:
	print('YES')
else:
	print('NO')


z = lambda : map(int, input().split())
(s, s1) = z()
(a, b) = z()
print('YES' if max(list(z())[:a]) < min(list(z())[s1 - b:]) else 'NO')


Regel1 = input()
Regel2 = input()
Regel3 = input()
Regel4 = input()
LengteRijen = list(map(int, Regel1.split(' ')))
k_m = list(map(int, Regel2.split(' ')))
Getallen_A = list(map(int, Regel3.split(' ')))
Getallen_B = list(map(int, Regel4.split(' ')))
if Getallen_A[k_m[0] - 1] < Getallen_B[LengteRijen[1] - k_m[1]]:
	print('Yes')
else:
	print('No')


n = input()
limits_map = map(int, input().split())
limits = list(limits_map)
a_map = map(int, input().split())
a = list(a_map)
b_map = map(int, input().split())
b = list(b_map)
if a[limits[0] - 1] < b[len(b) - limits[1]]:
	print('YES')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
a = [0] * n1
b = [0] * n2
a = input().split()
b = input().split()
for i in range(n1):
	a[i] = int(a[i])
for i in range(n2):
	b[i] = int(b[i])
if b[n2 - m] > a[k - 1]:
	print('YES')
else:
	print('NO')


(n1, n2) = input().split()
n1 = int(n1)
n2 = int(n2)
(k, m) = input().split()
k = int(k)
m = int(m)
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
tempA = A[k - 1]
tempB = B[n2 - m]
if tempA < tempB:
	print('YES')
else:
	print('NO')


def arrays():
	par1 = list(map(int, input().split()[0:2]))
	par2 = list(map(int, input().split()[0:2]))
	par3 = list(map(int, input().split()[0:par1[0]]))
	par4 = list(map(int, input().split()[0:par1[1]]))
	count = 0
	for i in range(par1[1]):
		if par4[i] > par3[par2[0] - 1]:
			count = count + 1
		if count == par2[1]:
			return 'YES'
	return 'NO'
print(arrays())


data = []
for i in range(4):
	data.append(input())
c = [int(i) for i in data[1].split()]
a = [int(i) for i in data[2].split()]
b = [int(i) for i in data[3].split()]
x = a[:c[0]][-1:][0]
y = b[-c[1]:][0]
if y > x:
	print('YES')
else:
	print('NO')


num_input = input()
num_input = num_input.split(' ')
nA = int(num_input[0])
nB = int(num_input[1])
num_input = input()
num_input = num_input.split(' ')
k = int(num_input[0])
m = int(num_input[1])
num_input = input()
num_input = num_input.split(' ')
A = num_input
num_input = input()
num_input = num_input.split(' ')
B = num_input
if int(A[k - 1]) < int(B[nB - m]):
	print('YES')
else:
	print('NO')


(len1, len2) = map(int, input().split())
(x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = a[:x]
n = b[:-(y + 1):-1]
n.sort()
if m[-1] >= n[0]:
	print('NO')
else:
	print('YES')


def f():
	return [int(i) for i in input().split()]
([na, nb], [k, m], a, b) = (f(), f(), f(), f())
(ax, bx) = (a[:k], b[-m:])
for x in ax:
	if x >= bx[0]:
		print('NO')
		exit()
print('YES')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
print('YES' if l1[k - 1] < l2[b - m] else 'NO')


input1 = input()
(Na, Nb) = input1.split(' ')
Na = int(Na)
Nb = int(Nb)
if Na >= 1 and Nb <= pow(10, 5):
	input2 = input()
	(Nk, Nm) = input2.split(' ')
	Nk = int(Nk)
	Nm = int(Nm)
	if Nk >= 1 and Nk <= Na and (Nm >= 1) and (Nm <= Nb):
		input3 = input()
		NNA = input3.split(' ')
		if int(NNA[0]) >= pow(-10, 9) and int(NNA[Na - 1]) <= pow(10, 9):
			input4 = input()
			NNB = input4.split(' ')
			if int(NNB[0]) >= pow(-10, 9) and int(NNB[Nb - 1]) <= pow(10, 9):
				val1 = NNA[Nk - 1]
				val2 = NNB[Nb - Nm]
				if int(val1) < int(val2):
					print('YES')
				else:
					print('NO')


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = a[0:k]
b = b[nb - m:nb]
if a[-1] < b[0]:
	print('YES')
else:
	print('NO')


import math
from collections import *
import sys
from functools import reduce
import time
from itertools import groupby

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

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)]
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1), (+1, +1), (+1, +0), (+1, -1), (+0, +1)]
(n, m) = get_ints()
(a, b) = get_ints()
kimchii = get_list()
lydia = get_list()
print('YES' if kimchii[a - 1] < lydia[m - b] else 'NO')


(na, nb) = map(int, input().split())
(ka, mb) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[ka - 1] < b[len(b) - mb]:
	print('YES')
else:
	print('NO')


input()
(k, m) = map(int, input().split())
(*a,) = sorted(map(int, input().split()))
(*b,) = sorted(map(int, input().split()), reverse=True)
print('YES' if a[k - 1] < b[m - 1] else 'NO')


(sa, sb) = map(int, input().split())
(k, m) = map(int, input().split())
array_A = list(map(int, input().split()))
array_B = list(map(int, input().split()))
print('YES' if array_A[k - 1] < array_B[-m] else 'NO')


import math
import sys
input = sys.stdin.readline

def invr():
	return list(map(int, input().split()))
invr()
(k, m) = invr()
a = invr()
b = invr()
aa = a[k - 1]
bb = b[len(b) - m]
print('YES' if aa < bb else 'NO')


(n_a, n_b) = map(int, input().split())
(k, m) = map(int, input().split())
small = list(map(int, input().split()))
large = list(map(int, input().split()))
if small[k - 1] < large[-m]:
	print('YES')
else:
	print('NO')


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


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
na_values = list(map(int, input().split()))
nb_values = list(map(int, input().split()))
last_value_from_na = na_values[k - 1]
starting_value_from_nb = nb_values[-m]
if starting_value_from_nb > last_value_from_na:
	print('YES')
else:
	print('NO')


(m, n) = map(int, input().split())
(p, q) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
B.reverse()
(e, f) = ([], [])
for i in range(p):
	e.append(A[i])
for i in range(q):
	f.append(B[i])
if min(f) > max(e):
	print('YES')
else:
	print('NO')


import sys, math
t = 1
for _ in range(t):
	(al, bl) = map(int, input().split())
	(k, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if a[k - 1] < b[bl - m]:
		print('YES')
	else:
		print('NO')


(n_a, n_b) = input().split()
(k, m) = input().split()
list_a = list(map(int, input().split()))
list_b = list(map(int, input().split()))
if int(list_a[int(k) - 1]) < int(list_b[-int(m)]):
	print('YES')
else:
	print('NO')


(a1, b1) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a1 < k or b1 < m:
	print('No')
elif a[k - 1] < b[b1 - m]:
	print('Yes')
else:
	print('No')


(n, r) = map(int, input().split())
(k, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
count = 0
for i in range(k):
	if l2[r - m] > l1[i]:
		count += 1
if count == k:
	print('YES')
else:
	print('NO')


__author__ = 'artyom'

def main():
	read(0)
	(k, m) = read(3)
	a = read(3)[k - 1]
	b = read(3)[-m]
	return 'YES' if a < b else 'NO'

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


n = input()
(a, b) = n.split(' ')
x = input()
(k, m) = x.split(' ')
ar1 = list(map(int, input().split(' ')))
ar2 = list(map(int, input().split(' ')))
a = int(a)
b = int(b)
k = int(k)
m = int(m)
z = 0
d = False
if a >= k:
	s = ar1[k - 1]
	for (j, i) in enumerate(ar2):
		if i > s:
			z = j
			d = True
			break
	if d == True:
		if b - z >= m:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
else:
	print('NO')


(n1, n2) = map(int, input().split())
(k, m) = map(int, input().split())
L1 = list(map(int, input().split()))
L2 = list(map(int, input().split()))
L = L1 + L2
if L1[k - 1] < L2[-m]:
	print('YES')
else:
	print('NO')


nanb = input().rstrip().split()
na = int(nanb[0])
nb = int(nanb[1])
km = input().rstrip().split()
k = int(km[0])
m = int(km[1])
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[-m]:
	print('YES')
else:
	print('NO')


s = input().split()
s2 = input().split()
a = int(s2[0])
b = int(s2[1])
l1 = input().split()
l2 = input().split()
point1 = 0
point2 = 0
minpoint = 100000
res = 0
for i in range(len(l1)):
	l1[i] = int(l1[i])
for i in range(len(l2)):
	l2[i] = int(l2[i])
l1 = sorted(l1)
l2 = sorted(l2)
for i in range(len(l2)):
	if i + 1 == b:
		minpoint = int(l2[len(l2) - 1 - i])
for i in l1:
	if i < minpoint:
		a -= 1
	else:
		break
if a > 0:
	print('NO')
else:
	print('YES')


x = input()
x = [int(x1) for x1 in input().split()]
y = [int(y1) for y1 in input().split()]
z = [int(z1) for z1 in input().split()]
comp = y[:x[0]]
if comp[-1] < z[-1 * x[1]]:
	print('YES')
else:
	print('NO')


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


l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
(k, m) = (l2[0], l2[1])
l3 = [int(x) for x in input().split()]
l4 = [int(x) for x in input().split()]
l4.reverse()
if l3[k - 1] < l4[m - 1]:
	print('Yes')
else:
	print('No')


__author__ = 'Rock'
(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
if list1[k - 1] < list2[-m]:
	print('YES')
else:
	print('NO')


line1 = input().split(' ')
line2 = input().split(' ')
line3 = input().split(' ')
line4 = input().split(' ')
na = int(line1[0])
nb = int(line1[1])
k = int(line2[0])
m = int(line2[1])
arrA = [int(i) for i in line3]
arrB = [int(i) for i in line4]
if all((arrB[-m] > item for item in arrA[:k])):
	print('YES')
else:
	print('NO')


def main():
	(s, k) = map(int, input().split())
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if a[n - 1] < b[-m]:
		print('YES')
	else:
		print('NO')
main()


from math import sqrt, pow, log, log2, log10, exp
from copy import deepcopy

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

def read_int():
	return read_ints()[0]

def read_floats():
	return list(map(float, input().split()))

def read_float():
	return read_floats()[0]

def one_dim_array(value, n):
	return [deepcopy(value) for x in range(n)]

def two_dim_array(value, n, m):
	return [[deepcopy(value) for x in range(m)] for x in range(n)]

def is_prime(n):
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	for i in range(3, sqrt(n) + 1):
		if n % i == 0:
			return False
	return True

def tf_to_yn(b):
	return 'YES' if b else 'NO'
(na, nb) = read_ints()
(ma, mb) = read_ints()
a = read_ints()
b = read_ints()
a.sort()
b.sort()
print(tf_to_yn(b[-mb] - a[ma - 1] > 0))


str = input()
(na, nb) = str.split(' ')
str = input()
(k, m) = str.split(' ')
str = input()
a = str.split(' ')
str = input()
b = str.split(' ')
if int(a[int(k) - 1]) < int(b[0 - int(m)]):
	print('YES\n')
else:
	print('NO\n')


(nA, nB) = [int(i) for i in input().split()]
(n, m) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
mojno = False
for i in range(len(B)):
	if A[n - 1] < B[i] and len(B) - i >= m:
		mojno = True
		break
if mojno == True:
	print('YES')
else:
	print('NO')


(lenA, lenB) = map(int, input().split())
(k, m) = map(int, input().split())
arrA = list(map(int, input().split()))
arrB = list(map(int, input().split()))
if arrB[lenB - m] > arrA[k - 1]:
	print('YES')
else:
	print('NO')


(fA, sA) = list(map(int, input().split()))
(fP, sP) = list(map(int, input().split()))
f = list(map(int, input().split()))
s = list(map(int, input().split()))
new = f + s
newFlags = []
b = s[sA - sP:][0]
a = f[:fP][fP - 1]
if b > a:
	print('YES')
else:
	print('NO')


(n_a, n_b) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
flag = True

def find_min(arr):
	min = arr[0]
	for i in range(len(arr)):
		if arr[i] < min:
			min = arr[i]
	return min

def find_max(arr):
	max = arr[0]
	for i in range(len(arr)):
		if arr[i] > max:
			max = arr[i]
	return max

def findMax(arr, k):
	lst = arr[-k:]
	return lst

def findMin(arr, k):
	lst = arr[:k]
	return lst
ans1 = findMin(A, k)
ans2 = findMax(B, m)
if find_max(ans1) >= find_min(ans2):
	flag = False
if flag == True:
	print('YES')
else:
	print('NO')


(a, b) = map(int, input().split())
(k, m) = map(int, input().split())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
if s1[k - 1] < s2[b - m]:
	print('YES')
else:
	print('NO')


str1 = list(map(int, input().split()))
na = str1[0]
nb = str1[1]
str2 = list(map(int, input().split()))
k = str2[0]
m = str2[1]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[k - 1] < b[nb - m]:
	print('YES')
else:
	print('NO')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
lA = list(map(int, input().split()))
lB = list(map(int, input().split()))
maxA = lA[k - 1]
minB = lB[len(lB) - m]
if maxA < minB:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
arrA = list(map(int, input().split()))
arrB = list(map(int, input().split()))
if arrA[k - 1] >= arrB[len(arrB) - m]:
	print('NO')
else:
	print('YES')


(na, mb) = map(int, input().split())
(k, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
note = len(l2)
for i in range(len(l2)):
	if l1[k - 1] < l2[i]:
		note = i
		break
if len(l2) - note + 1 > m:
	print('YES')
else:
	print('NO')


def translation():
	word_1 = input()
	word_2 = input()[::-1]
	print(['NO', 'YES'][word_1 == word_2])
	return

def anton_and_danik():
	games = int(input())
	wins = input()
	anton_wins = sum((i == 'A' for i in wins))
	if anton_wins * 2 > len(wins):
		print('Anton')
	elif anton_wins * 2 == len(wins):
		print('Friendship')
	else:
		print('Danik')
	return

def acoomodation():
	cnt = 0
	for _ in range(int(input())):
		(p, q) = map(int, input().split())
		if q - p >= 2:
			cnt += 1
	print(cnt)
	return

def juicer():
	(n, b, d) = map(int, input().split())
	sum_orange = 0
	cnt_empty = 0
	for orange in list(map(int, input().split())):
		if orange <= b:
			sum_orange += orange
			if sum_orange > d:
				cnt_empty += 1
				sum_orange = 0
	print(cnt_empty)
	return

def digit_game():
	for game in range(int(input())):
		breach_odd_cnt = 0
		breach_even_cnt = 0
		raze_odd_cnt = 0
		raze_even_cnt = 0
		n = int(input())
		number = input()
		breach_numbers = ''
		raze_numbers = ''
		len_number = len(number)
		idx = 1
		for digit in number:
			if idx % 2 == 0:
				breach_numbers += digit
				if digit in '13579':
					breach_odd_cnt += 1
				else:
					breach_even_cnt += 1
			else:
				raze_numbers += digit
				if digit in '13579':
					raze_odd_cnt += 1
				else:
					raze_even_cnt += 1
			idx += 1
		if len_number == 1:
			if int(number) % 2 == 0:
				print(2)
			else:
				print(1)
		elif len_number % 2 == 0:
			if breach_even_cnt >= 1:
				print(2)
			else:
				print(1)
		elif raze_odd_cnt >= 1:
			print(1)
		else:
			print(2)
	return

def modular_exponentiation():
	n = int(input())
	m = int(input())
	calc = m % int(1 << n)
	print(int(calc))
	return

def tricky_sum():
	for _ in range(int(input())):
		number = int(input())
		pow_two = 1
		while pow_two <= number:
			pow_two *= 2
			print(pow_two)
		sum_formula = number * (number + 1) // 2
		trick_sum = sum_formula - 2 * pow_two + 2
		print(trick_sum)
	return

def three_indices():
	for _ in range(int(input())):
		n = int(input())
		permutation = list(map(int, input().split()))
		(idx_i, idx_j, idx_k) = (1, 2, 3)
		(num_i, num_j, num_k) = (0, 0, 0)
		for idx in range(1, n - 1):
			if permutation[idx] > permutation[idx - 1] and permutation[idx] > permutation[idx + 1]:
				print('YES')
				print(idx, idx + 1, idx + 2)
				break
		else:
			print('NO')
	return

def three_friends():
	for test_cases in range(int(input())):
		coords = list(map(int, input().split()))
		coords_neu = sorted(coords)
		if coords_neu[2] - coords_neu[0] <= 2:
			print(0)
		else:
			print(2 * (coords_neu[2] - coords_neu[0]) - 4)
	return

def decoding():
	length = int(input())
	word = list(input())
	new_word = ''
	for i in range(1, length + 1, 1):
		if len(word) % 2 != 0:
			new_word = new_word + word[0]
		else:
			new_word = word[0] + new_word
		word.pop(0)
	print(new_word)
	return

def cookies():
	number_of_bags = int(input())
	bag_content = list(map(int, input().split()))
	sum_cookies = sum(bag_content)
	cnt_even = 0
	cnt_uneven = 0
	for bag in bag_content:
		if bag % 2 == 0:
			cnt_even += 1
		else:
			cnt_uneven += 1
	if sum_cookies % 2 == 0:
		if cnt_even > 0:
			print(cnt_even)
		else:
			print(0)
	elif cnt_uneven > 0:
		print(cnt_uneven)
	else:
		print(0)
	return

def holidays():
	days = int(input())
	a = days // 7 * 2
	if days % 7 == 6:
		a += 1
	b = (days - 2) // 7 * 2 + 2
	if (days - 2) % 7 == 6:
		b += 1
	print(a, b)
	return

def arrays():
	(A_size, B_size) = map(int, input().split())
	(k, m) = map(int, input().split())
	Array_A = list(map(int, input().split()))
	Array_B = list(map(int, input().split()))
	if Array_A[k - 1] < Array_B[-m]:
		print('YES')
	else:
		print('NO')
	return
arrays()


(sA, sB) = map(int, input().split())
(k, m) = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
print('YES' if A[k - 1] < B[len(B) - m] else 'NO')


S1 = input().split()
n1 = int(S1[0])
n2 = int(S1[1])
S2 = input().split()
m1 = int(S2[0])
m2 = int(S2[1])
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
if l1[m1 - 1] < l2[-m2]:
	print('YES')
else:
	print('NO')


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


(len1, len2) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = a[0:k]
b = b[-m:]
if a[-1] < b[0]:
	print('YES')
else:
	print('NO')


(nA, nB) = input().strip().split(' ')
nA = int(nA)
nB = int(nB)
(k, m) = input().strip().split(' ')
k = int(k)
m = int(m)
a = [int(item) for item in input().strip().split(' ')]
b = [int(item) for item in input().strip().split(' ')]
if a[k - 1] < b[nB - m]:
	print('YES')
else:
	print('NO')


(Na, Nb) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.reverse()
if a[k - 1] < b[m - 1]:
	print('YES')
else:
	print('NO')


i = lambda : [*map(int, input().split())]
(la, lb) = i()
(k, m) = i()
a = i()
b = i()
print('YES' if a[k - 1] < b[-m] else 'NO')


(na, nb) = map(int, input().split())
(ka, kb) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[ka - 1] < b[-kb]:
	print('YES')
else:
	print('NO')


def solve():
	(na, nb) = [int(s) for s in input().split()]
	(k, m) = [int(s) for s in input().split()]
	a = sorted([int(s) for s in input().split()])
	b = sorted([int(s) for s in input().split()])
	if a[k - 1] >= b[-m]:
		print('NO')
	else:
		print('YES')
solve()


input()
(n, m) = map(int, input().split())
a1 = list(map(int, input().split()))[:n]
a2 = list(map(int, input().split()))[-m:]
print('YES' if a1[-1] < a2[0] else 'NO')


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
n = sorted(map(int, input().split()))
m = sorted(map(int, input().split()))
m.reverse()
z = n[c - 1] + 1
for i in m:
	if i >= z:
		d -= 1
	if d == 0:
		break
if d == 0:
	print('YES')
else:
	print('NO')


(na, nb) = input().split()
na = int(na)
nb = int(nb)
(k, m) = input().split()
k = int(k)
m = int(m)
nalst = list(map(int, input().split()))
nblst = list(map(int, input().split()))
last = min(nblst[nb - m:])
count = 0
if m > len(nblst):
	print('NO')
else:
	for i in nalst:
		if i < last:
			count += 1
			if count == k:
				print('YES')
				break
	if count < k:
		print('NO')


def f():
	return [int(i) for i in input().split()]
([na, nb], [k, m], a, b, terminate) = (f(), f(), f(), f(), False)
(ax, bx) = (a[:k], b[-m:])
for x in ax:
	if x >= bx[0]:
		terminate = True
		print('NO')
		break
if not terminate:
	print('YES')


(n1, n2) = map(int, input().split())
(m1, m2) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
n1 = arr1[m1 - 1]
n2 = arr2[-m2]
if n2 > n1:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
(a, b) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
i = 0
j = 0
while i < n and j < m and (i < a):
	if arr1[i] < arr2[j]:
		i += 1
	else:
		j += 1
if i < a or m - j < b:
	print('NO')
else:
	print('YES')


_ = input()
(k, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()[:k]]
b = [int(i) for i in input().split()[-m:]]
if max(a) < min(b):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
(k, p) = map(int, input().split())
x = 0
y = 0
a = input().split()
x = int(a[k - 1])
b = input().split()
y = int(b[m - p])
if x < y:
	print('YES')
else:
	print('NO')


def arrays(lst1, lst2, k, m):
	if lst1[k - 1] < lst2[len(lst2) - m]:
		return 'YES'
	return 'NO'
(na, nb) = [int(i) for i in input().split()]
(K, M) = [int(j) for j in input().split()]
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
print(arrays(a, b, K, M))


(n_A, n_B) = map(int, input().split())
(k, m) = map(int, input().split())
array_a = [int(x) for x in input().split()]
array_b = [int(x) for x in input().split()]
highestOfLowestInArrayA = array_a[k - 1]
lowestOfHighestInArrayB = array_b[-m]
if highestOfLowestInArrayA < lowestOfHighestInArrayB:
	print('YES')
if highestOfLowestInArrayA >= lowestOfHighestInArrayB:
	print('NO')


(n1, n2) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
t1 = list(map(int, input().split()))
t2 = list(map(int, input().split()))
t1.sort()
t2.sort()
p = t2[::-1][:m]
q = t1[:k]
if max(q) < min(p):
	print('YES')
else:
	print('NO')


(nA, nB) = list(map(int, input().split()))
(k, m) = list(map(int, input().split()))
x1 = list(map(int, input().split()))
x2 = list(map(int, input().split()))
if x1[k - 1] < x2[-m:][0]:
	print('YES')
else:
	print('NO')


R = lambda : map(int, input().split())
(n, m) = R()
(k, l) = R()
a = list(R())
b = list(R())
if a[k - 1] < b[m - l]:
	print('YES')
else:
	print('NO')


read = lambda : map(int, input().split())
read()
(k, m) = read()
a = list(read())
b = list(read())
if a[k - 1] < b[len(b) - m]:
	print('YES')
else:
	print('NO')


__author__ = 'suvasish'
(size_a, size_b) = map(int, input().split(' '))
(k, m) = map(int, input().split(' '))
arr_a = list(map(int, input().split(' ')))
arr_b = list(map(int, input().split(' ')))
if arr_a[k - 1] < arr_b[-m]:
	print('YES')
else:
	print('NO')


(a, b) = tuple(map(int, input().split()))
(k, m) = tuple(map(int, input().split()))
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
print('YES' if arr1[k - 1] < arr2[b - m] else 'NO')


(na, nb) = map(int, input().split())
(ka, mb) = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
B.sort(reverse=True)
if A[ka - 1] < B[mb - 1]:
	print('YES')
else:
	print('NO')


(Na, Nb) = map(int, input().split())
(K, M) = map(int, input().split())
ArrA = list(map(int, input().split()))
ArrB = list(map(int, input().split()))
Maxx = ArrA[K - 1]
Minn = ArrB[-M]
if Maxx < Minn:
	print('YES')
else:
	print('NO')


sizes = input().split(' ')
chosen = input().split(' ')
a_chosen = int(chosen[0])
b_chosen = int(chosen[1])
array_a = input().split(' ')
array_b = input().split(' ')
b_value = int(array_b[len(array_b) - b_chosen])
count_under_b_value = 0
for value in array_a:
	if int(value) < b_value:
		count_under_b_value += 1
if count_under_b_value >= a_chosen:
	print('YES')
else:
	print('NO')


r = lambda : map(int, input().split())
r()
(k, m) = r()
(A, B) = (list(r()), list(r()))
print(('NO', 'YES')[A[k - 1] < B[-m]])


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
la = [int(x) for x in input().split()]
lb = [int(y) for y in input().split()]
la = la[:k]
lb = lb[len(lb) - m:]
if la[-1] < lb[0]:
	print('YES')
else:
	print('NO')


def solve():
	input()
	(k, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	bm = 0
	for n in b:
		if n > a[k - 1]:
			bm += 1
			if bm >= m:
				print('YES')
				return
	print('NO')
solve()


input()
km = input().split(' ')
(k, m) = (int(km[0]), int(km[1]))
ast = input().split(' ')[:k]
bst = input().split(' ')
bst = bst[len(bst) - m:]
(a, b) = (list(), list())
for s in ast:
	a.append(int(s))
for s in bst:
	b.append(int(s))
if a[len(a) - 1] < b[0]:
	print('YES')
else:
	print('NO')


(a, b) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
e = c[k - 1]
f = d[b - m]
if e < f:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
(a_k, b_l) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
numbers_a = a[0:a_k]
numbers_b = b[m - b_l:m]
if min(numbers_b) > max(numbers_a):
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = list(map(int, input().split()))
e = 0
f = b[1]
for i in range(len(c)):
	if d[-f] > c[i]:
		e += 1
if e >= b[0]:
	print('Yes')
else:
	print('NO')


(a, b) = map(int, input().split())
(x, y) = map(int, input().split())
p = list(map(int, input().split()))
k = list(map(int, input().split()))
if p[x - 1] < k[b - y]:
	print('YES')
else:
	print('NO')


(x, y) = [int(i) for i in input().split()]
(k, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
b.sort(reverse=True)
if b[m - 1] > a[k - 1]:
	print('YES')
else:
	print('NO')


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


def main():
	[na, nb] = [int(_) for _ in input().split()]
	[k, m] = [int(_) for _ in input().split()]
	a = [int(_) for _ in input().split()]
	b = [int(_) for _ in input().split()]
	max_a = a[k - 1]
	min_b = b[nb - m]
	print('YES' if max_a < min_b else 'NO')
main()


na_nb = input()
(na, nb) = na_nb.split()
na = int(na)
nb = int(nb)
k_m = input()
(k, m) = k_m.split()
k = int(k)
m = int(m)
A_str = input()
A = A_str.split()
B_str = input()
B = B_str.split()
if int(A[k - 1]) < int(B[-1 * m]):
	print('YES')
else:
	print('NO')


a = [int(b) for b in input().split(' ')]
(e, c) = [int(d) for d in input().split(' ')]
h = [int(f) for f in input().split(' ')]
g = sorted([int(h) for h in input().split(' ')], reverse=True)
found_in_first_array = False
found_in_second_array = False
if len(h) >= e:
	found_in_first_array = True
count = 0
for i in range(len(g)):
	if g[i] > h[e - 1]:
		count = count + 1
if count >= c:
	found_in_second_array = True
if found_in_first_array and found_in_second_array:
	print('YES')
else:
	print('NO')


(nA, nB) = (int(i) for i in input().split())
(k, m) = (int(i) for i in input().split())
Alist = [int(i) for i in input().split()]
Blist = [int(i) for i in input().split()]
if len(Alist) < k or len(Blist) < m:
	print('NO')
else:
	biggestA = Alist[k - 1]
	smallestB = Blist[-m]
	if biggestA < smallestB:
		print('YES')
	else:
		print('NO')


(havij, n) = map(int, input().split())
(k, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print('YES' if max(a[0:k]) < min(b[-m:n]) else 'NO')


(x, y) = map(int, input().split())
(k, m) = map(int, input().split())
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
array1 = a[:k]
array2 = b[len(b) - m:]
if max(array1) < min(array2):
	print('YES')
else:
	print('NO')


(s1, s2) = tuple(input().split())
s1 = int(s1)
s2 = int(s2)
(k, n) = tuple(input().split())
k = int(k)
n = int(n)
a = input().split()
b = input().split()
l = []
l1 = []
for i in a:
	l.append(int(i))
for i in b:
	l1.append(int(i))
if l[k - 1] < l1[s2 - n]:
	print('YES')
else:
	print('NO')


(na, nb) = [int(x) for x in input().split()]
(ka, kb) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
print('YES' if A[ka - 1] < B[-kb] else 'NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
t1 = a[k - 1]
t2 = b[-m]
print('YES' if t1 < t2 else 'NO')


(a, b) = map(int, input().split())
(m, k) = map(int, input().split())
mas1 = list(map(int, input().split()))
mas2 = list(map(int, input().split()))
if mas1[m - 1] >= mas2[-k]:
	print('NO')
else:
	print('YES')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A1 = A[:k]
B1 = B[-m:]
if max(A1) >= min(B1):
	print('NO')
else:
	print('YES')


read = lambda : [int(c) for c in input().split()]
(na, nb) = read()
(k, m) = read()
(a, b) = (read(), read())
print('YES' if a[k - 1] < b[nb - m] else 'NO')


(Na, Nb) = input().split(' ')
(k, m) = input().split(' ')
(k, m) = (int(k), int(m))
A = input().split(' ')
B = input().split(' ')
sA = list(map(lambda x: int(x), A[:k]))
sB = list(map(lambda x: int(x), B[-m:]))
if max(sA) < min(sB):
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split(' '))
(ma, mb) = map(int, input().split(' '))
LA = [int(x) for x in input().split()]
LA.sort()
LB = [int(x) for x in input().split()]
LB.sort()
if LA[ma - 1] < LB[nb - mb]:
	print('YES')
else:
	print('NO')


(a, b) = list(map(int, input().split()))
(m, n) = list(map(int, input().split()))
lista = list(map(int, input().split()))
lista2 = list(map(int, input().split()))
if lista[m - 1] < lista2[b - n]:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
(k, r) = map(int, input().split())
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
lst2.reverse()
ans1 = max(lst1[0:k])
ans2 = min(lst2[0:r])
if ans2 > ans1:
	print('YES')
else:
	print('NO')


(na, nb) = map(int, input().split())
(k, m) = map(int, input().split())
a = input().split()
b = input().split()
a = list(map(int, a))
b = list(map(int, b))
temp1 = a[:k]
temp2 = b[-m:]
if temp1[len(temp1) - 1] < temp2[0]:
	print('YES')
else:
	print('NO')


(nA, nB) = map(int, input().split())
(k, m) = map(int, input().split())
lsA = list(map(int, input().split()))
lsB = list(map(int, input().split()))
if lsA[k - 1] >= lsB[nB - m]:
	print('NO')
else:
	print('YES')


(na, nb) = input().split(' ')
(k, m) = input().split(' ')
a = input().split(' ')
b = input().split(' ')
if len(a) >= int(k) and len(b) >= int(m):
	if int(b[-1]) <= int(a[int(k) - 1]):
		print('NO')
	else:
		for i in range(len(b)):
			if int(a[int(k) - 1]) < int(b[i]):
				if len(b) - i >= int(m):
					print('YES')
					break
				else:
					print('NO')
					break
else:
	print('NO')