Jafar has n cans of cola. Each can is described by two integers: remaining volume of cola a_{i} and can's capacity b_{i} (a_{i}  ≤  b_{i}).

Jafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not!


-----Input-----

The first line of the input contains one integer n (2 ≤ n ≤ 100 000) — number of cola cans.

The second line contains n space-separated integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 10^9) — volume of remaining cola in cans.

The third line contains n space-separated integers that b_1, b_2, ..., b_{n} (a_{i} ≤ b_{i} ≤ 10^9) — capacities of the cans.


-----Output-----

Print "YES" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print "NO" (without quotes).

You can print each letter in any case (upper or lower).


-----Examples-----
Input
2
3 5
3 6

Output
YES

Input
3
6 8 9
6 10 12

Output
NO

Input
5
0 0 5 0 0
1 1 8 10 5

Output
YES

Input
4
4 1 0 3
5 2 2 3

Output
YES



-----Note-----

In the first sample, there are already 2 cans, so the answer is "YES".

Source: codeforces | Difficulty: EASY
Tags: Implementation

Greedy algorithms


Solutions:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
if sum(a) <= b[-1] + b[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split()
b = input().split()
if n == 2:
	print('YES')
else:
	max_cap = max2_cap = 0
	tot_cola = 0
	for i in range(n):
		ai = int(a[i])
		bi = int(b[i])
		if bi > max_cap:
			if max_cap > max2_cap:
				max2_cap = max_cap
			max_cap = bi
		elif bi > max2_cap:
			max2_cap = bi
		tot_cola += ai
	print('YES' if tot_cola <= max_cap + max2_cap else 'NO')


def main():
	_ = input()
	l = (int(i) for i in input().split(' '))
	s = [int(i) for i in input().split(' ')]
	s.sort()
	print('YES' if sum(s[-2:]) >= sum(l) else 'NO')
main()


number = int(input())
numerator = 0
denominator = 0
lst = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
if len(lst) == 2 and len(lst2) == 2:
	num = 0
	den = 0
	for item in lst:
		num = num + item
	for item in lst2:
		den = den + item
	if den == 0:
		print('YES')
	elif num / den <= 1:
		print('YES')
	else:
		print('NO')
else:
	numerator = 0
	for item in lst:
		numerator = numerator + item
	second = lst2[0]
	for i in range(2):
		for item in lst2:
			if item > second:
				second = item
		denominator = denominator + second
		lst2.remove(second)
		second = lst2[0]
	if denominator == 0:
		print('YES')
	elif numerator / denominator <= 1:
		print('YES')
	else:
		print('NO')


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


n = int(input())
s = sum(list(map(int, input().split())))
l = list(map(int, input().split()))
m = max(l)
l.remove(m)
m = m + max(l)
if m >= s:
	print('YES')
else:
	print('NO')


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


_ = input()
cola = list(map(int, input().split(' ')))
cap = list(map(int, input().split(' ')))
cap.sort()
print('YES' if cap[-1] + cap[-2] >= sum(cola) else 'NO')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l2.sort(reverse=True)
x = l2[0] + l2[1]
if sum(l1) <= x:
	print('YES')
else:
	print('NO')


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


def larg2(arr):
	first = None
	second = None
	for number in arr:
		if first is None:
			first = number
		elif number > first:
			second = first
			first = number
		elif second is None:
			second = number
		elif number > second:
			second = number
	return [first, second]
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r_a = sum(a)
l = larg2(b)
if sum(l) >= r_a:
	print('YES')
else:
	print('NO')


n = int(input())
can = list(map(int, input().split()))
capacity = list(map(int, input().split()))
vol = sum(can)
capacity.sort(reverse=True)
max_capacity = int(capacity[0]) + int(capacity[1])
if vol <= max_capacity:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(map(int, input().split()))
e = list(map(int, input().split()))
e.sort(reverse=True)
if e[0] + e[1] >= sum(s):
	print('YES')
else:
	print('NO')


n = input()
rem = sum(map(int, input().split()))
cap = list(map(int, input().split()))
cap = sorted(cap)
c = cap[-1] + cap[-2]
if c >= rem:
	print('YES')
else:
	print('NO')


n = int(input())
v1 = 0
v2 = 0
sum_ = 0
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
for i in range(n):
	a = list1[i]
	b = list2[i]
	sum_ += a
	if b > v1:
		v2 = v1
		v1 = b
	elif b > v2:
		v2 = b
if sum_ <= v1 + v2:
	print('YES')
else:
	print('NO')


n = int(input())
a = sum(map(int, input().split(' ')))
b = sum(sorted(map(int, input().split(' ')))[-2:])
if a <= b:
	print('YES')
else:
	print('NO')


from collections import Counter
n = int(input())
b = sum(list(map(int, input().split())))
a = list(map(int, input().split()))
a.sort()
if sum(a[-2:]) >= b:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(x, y) = sorted((b[i] for i in range(n)), reverse=True)[:2]
if sum(a) <= x + y:
	print('YES')
else:
	print('NO')


n = int(input())
a = sum(map(int, input().split()))
(max1, max2) = (-1, -2)
for x in list(map(int, input().split())):
	if x > max1:
		temp = max1
		max1 = x
		max2 = temp
	elif x >= max2:
		max2 = x
print('YES' if max1 + max2 >= a else 'NO')


n = int(input())
zdk = 0
for i in input().split():
	zdk += int(i)
onemax = 0
twomax = 0
for i in input().split():
	i = int(i)
	if i > onemax:
		(twomax, onemax) = (onemax, i)
	elif i > twomax:
		twomax = i
if onemax + twomax >= zdk:
	print('YES')
else:
	print('NO')


n = int(input())
v = [int(x) for x in input().split()]
vm = [int(x) for x in input().split()]
a = sum(v)
max_1 = max(vm)
vm.remove(max_1)
max_2 = max(vm)
if a > max_1 + max_2:
	print('NO')
else:
	print('YES')


n = int(input())
arrNow = list(map(int, input().split()))
arrFull = list(map(int, input().split()))

def LastTwo(arr):
	one = arr[len(arr) - 1]
	two = arr[len(arr) - 2]
	return [two, one]

def main():
	summNow = 0
	summFull = 0
	global arrFull
	for i in arrNow:
		summNow += i
	arrFull = sorted(arrFull)
	summFull += LastTwo(arrFull)[0]
	summFull += LastTwo(arrFull)[1]
	if summNow <= summFull:
		print('YES')
	else:
		print('NO')
main()


N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
B.sort()
if sum(A) <= B[-1] + B[-2]:
	print('YES')
else:
	print('NO')


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


z = int(input())
x = list(map(int, input().split()))
c = list(map(int, input().split()))
q = max(c)
c.remove(c[c.index(q)])
if sum(x) <= q + max(c):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = sorted(list(map(int, input().split())), reverse=True)
print(['NO', 'YES'][b[0] + b[1] >= sum(a)])


n = input()
a = list(map(int, input().split()))
d = list(map(int, input().split()))
b = max(d)
d.remove(b)
c = max(d)
summa = sum(a)
t = b + c
if summa <= t:
	print('YES')
else:
	print('NO')


def main():
	cans = int(input())
	vols = [int(i) for i in input().split(' ')]
	caps = [int(i) for i in input().split(' ')]
	if cans > 2:
		max1 = caps.pop(caps.index(max(caps)))
		max2 = max(caps)
		if max1 + max2 >= sum(vols):
			return 'YES'
		else:
			return 'NO'
	return 'YES'
print(main())


def main():
	n = lie()
	(a, b) = (array(), array())
	b.sort(reverse=True)
	cnt = sum(a)
	if cnt <= b[1] + b[0]:
		print('YES')
	else:
		print('NO')

def fun(m, n, s, k):
	return

def fun2(s):
	return
from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 5

def lie():
	return int(input())

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

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

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
dmain()


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l2.sort()
sum = 0
for item in l1:
	sum += item
lim = l2[n - 1] + l2[n - 2]
if sum <= lim:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
E = sum(a)
b = list(map(int, input().split()))
m1 = -1
m2 = -1
for i in range(n):
	if b[i] > m1:
		(m1, m2) = (b[i], m1)
	elif b[i] > m2:
		m2 = b[i]
if m1 + m2 >= E:
	print('YES')
else:
	print('NO')


n = int(input())
a = map(int, input().split())
b = map(int, input().split())
b = sorted(b)
max1 = b[-1]
max2 = b[-2]
total = sum(a)
if max1 + max2 >= total:
	print('YES')
else:
	print('NO')


def main():
	read = lambda : tuple(map(int, input().split()))
	n = read()[0]
	a = read()
	b = sorted(read())
	sm = sum(a)
	if sm <= b[-1] + b[-2]:
		print('YES')
	else:
		print('NO')
main()


cans = int(input())
vol = list(map(int, input().split()))
cap = list(map(int, input().split()))
cap.sort()
c = cap[-1] + cap[-2]
if sum(vol) <= c:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
b1 = max(b)
b.remove(b1)
b2 = max(b)
if sum(a) > b1 + b2:
	print('NO')
else:
	print('YES')


n = int(input())
ar = list(map(int, input().split()))
br = list(map(int, input().split()))
rez = br.pop(br.index(max(br)))
rez += max(br)
print('YES' if rez >= sum(ar) else 'NO')


ilePuszek = int(input())
ilePozostaloWPuszkach = input().split()
pojemnoscPuszek = input().split()
if len(pojemnoscPuszek) == ilePuszek and len(ilePozostaloWPuszkach) == ilePuszek:
	suma = 0
	for x in range(len(ilePozostaloWPuszkach)):
		suma += int(ilePozostaloWPuszkach[x])
	pojemnosc = []
	for y in range(len(pojemnoscPuszek)):
		pojemnosc.append(int(pojemnoscPuszek[y]))
	pojemnosc.sort(reverse=True)
	wDwochPuszkach = int(pojemnosc[0]) + int(pojemnosc[1])
	if suma <= wDwochPuszkach:
		print('YES')
	else:
		print('NO')


n = int(input())
a = []
s1 = 0
x = list(map(int, input().split()))
y = list(map(int, input().split()))
s1 = sum(x)
y.sort(reverse=True)
s2 = y[0] + y[1]
if s1 <= s2:
	print('YES')
else:
	print('NO')


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


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


a = int(input())
b = sum(list(map(int, input().split())))
d = sum(sorted(list(map(int, input().split())))[-2:])
if d >= b:
	print('YES')
else:
	print('NO')


n = int(input())
r = sum([int(num) for num in input().strip().split()])
can = [int(num) for num in input().strip().split()]
can.sort(reverse=True)
if r <= can[0] + can[1]:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	rems = [int(i) for i in input().split()]
	tots = [int(i) for i in input().split()]
	tots.sort()
	if sum(rems) > tots[-1] + tots[-2]:
		print('NO')
		return
	print('YES')
main()


n = int(input())
vol_in_can = list(map(int, input().split()))
total_vol = sorted(list(map(int, input().split())))
s = sum(vol_in_can)
(mx1, mx2) = (total_vol[-1], total_vol[-2])
if s <= mx1 + mx2:
	print('YES')
else:
	print('NO')


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	B.sort(reverse=True)
	if sum(A) <= B[0] + B[1]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 2 or a.count(0) >= len(a) - 2:
	print('yes')
	exit()
b = list(reversed(sorted(b)))
if sum(a) <= sum(b[0:2]):
	print('yes')
else:
	print('no')


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
tot = 0
for x in b:
	tot += x
g = c[len(c) - 1] + c[len(c) - 2]
if tot <= g:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ma1 = -float('inf')
ma2 = -float('inf')
for i in range(n):
	if b[i] > ma1:
		ma2 = ma1
		ma1 = b[i]
	elif b[i] > ma2:
		ma2 = b[i]
su = sum(a)
if su <= ma1 + ma2:
	print('YES')
else:
	print('NO')


n = int(input())
v = list(map(int, input().split()))
vol = list(map(int, input().split()))
q = vol.index(max(vol))
a = vol[q]
del vol[q]
q2 = vol.index(max(vol))
b = vol[q2]
print('YES' if a + b >= sum(v) else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
A = sum(a)
B = sum(sorted(b)[-2:])
print(('NO', 'YES')[A <= B])


n = int(input())
s = sum(map(int, input().split()))
(a, b) = (0, 0)
for i in map(int, input().split()):
	if i > a:
		(a, i) = (i, a)
	if i > b:
		(b, i) = (i, b)
if s <= a + b:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(sum, max_capacity, second_max_capacity) = (0, 0, 0)
for i in range(n):
	sum += a[i]
for i in range(n):
	if b[i] > max_capacity:
		second_max_capacity = max_capacity
		max_capacity = b[i]
	elif b[i] > second_max_capacity:
		second_max_capacity = b[i]
if max_capacity + second_max_capacity >= sum:
	print('YES')
else:
	print('NO')


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
if sum(v) <= c[-1] + c[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
l1 = sorted(l1)
if l1[-1] + l1[-2] < sum(l):
	print('No')
else:
	print('yEs')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum = 0
for i in a:
	sum += i
b.sort(reverse=True)
if b[0] + b[1] >= sum:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
from random import randrange
n = int(stdin.readline())
challengers = []
cnt = 0
(a1, b1) = (list(map(int, stdin.readline().split())), list(map(int, stdin.readline().split())))
for i in range(n):
	(a, b) = (a1[i], b1[i])
	challengers.append((a, b))
	cnt += a
challengers.sort(key=lambda x: x[1], reverse=True)
if cnt <= challengers[0][1] + challengers[1][1]:
	stdout.write('YES')
else:
	stdout.write('NO')


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


import heapq
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l2.sort()
try:
	if sum(l1) <= l2[-1] + l2[-2]:
		print('YES')
	else:
		print('NO')
except:
	print('NO')


n = int(input())
current = list(map(int, input().split()))
planned = list(map(int, input().split()))
total_size = sum(current)
two_big_bottles = sum(sorted(planned)[-2:])
if total_size <= two_big_bottles:
	print('YES')
else:
	print('NO')


input()
_1_ = sorted(list(map(int, input().split())), reverse=True)
_2_ = sorted(list(map(int, input().split())), reverse=True)
print('YES' if sum([_2_[0], _2_[1]]) >= sum(_1_) else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kol = sum(a)
m1 = [b[0], 0]
for u in range(1, n):
	if b[u] > m1[0]:
		m1 = [b[u], u]
del b[m1[1]]
m2 = [b[0], 0]
for u in range(1, n - 1):
	if b[u] > m2[0]:
		m2 = [b[u], u]
if kol <= m1[0] + m2[0]:
	print('YES')
else:
	print('NO')


n = int(input())
if 2 <= n <= 100000:
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	if 0 <= max(a) <= 10 ** 9 and 0 <= max(b) <= 10 ** 9:
		i = max(b)
		b.remove(max(b))
		j = max(b)
		if i + j >= sum(a):
			print('YES')
		else:
			print('NO')


n = int(input())
mat = sum(list(map(int, input().split())))
sat = sum(sorted(list(map(int, input().split())))[-2:])
print('YES' if mat <= sat else 'NO')


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
space = []
for i in range(n):
	space.append(B[i])
space.sort()
capacity = space[-1] + space[-2]
totalCola = sum(A)
if totalCola <= capacity or n <= 2:
	print('YES')
else:
	print('NO')


n = int(input())
t = list(map(int, input().split()))
y = list(map(int, input().split()))
y.sort()
p = sum(t)
w = y[::-1]
q = 0
for i in range(n - 1):
	if y[i] + y[i + 1] >= p:
		print('YES')
		q += 1
		break
if q == 0:
	print('NO')


q = input('')
cola = input('').strip().split()
cola = list(map(int, cola))
can = input('').strip().split()
can = list(map(int, can))
a = sum(cola)
max1 = 0
max2 = 0
for i in can:
	if max1 <= i:
		max2 = max1
		max1 = i
	elif max2 < i:
		max2 = i
if max1 + max2 >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = sum(a)
mn = max(b)
b.remove(mn)
mn += max(b)
if mn >= s:
	print('YES')
else:
	print('NO')


read = lambda : map(int, input().split())
n = int(input())
a = sum(read())
b = sorted(read())
if b[-1] + b[-2] >= a:
	print('YES')
else:
	print('NO')


def greedy(lst1, lst2):
	s = sum(lst1)
	if s <= sorted(lst2)[len(lst1) - 1] + sorted(lst2)[len(lst1) - 2]:
		return 'YES'
	return 'NO'
n = int(input())
a = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
print(greedy(a, b))


n = int(input())
v = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
z = 0
for j in v:
	z += j
(x, y) = (0, 1)
for i in range(n):
	if b[x] < b[i]:
		y = x
		x = i
	if b[y] < b[i] and i != x:
		y = i
if b[x] + b[y] < z:
	print('NO')
else:
	print('YES')


n = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n1 = 0
n2 = 0
if len(list(b)) == 2:
	print('YES')
	exit()
else:
	n1 = max(list(b))
	b.remove(max(b))
	n2 = max(list(b))
if sum(list(a)) <= n1 + n2:
	print('YES')
else:
	print('NO')


from array import array
n = input()
Sa = sum(map(int, input().split()))
b = array('I', map(int, input().split()))
m = max(b)
b.remove(m)
V = m + max(b)
if Sa <= V:
	print('YES')
else:
	print('NO')


num = int(input())
rem = sum(map(int, input().split()))
vol = sum(sorted(map(int, input().split()))[-2:])
if rem <= vol:
	print('YES')
else:
	print('NO')


import sys
line = sys.stdin.readlines()
cans = int(line[0].strip())
volumes = [int(x) for x in line[1].strip().split()]
caps = [int(x) for x in line[2].strip().split()]
caps = sorted(caps)
if caps[-1] + caps[len(caps) - 2] >= sum(volumes):
	print('YES')
else:
	print('NO')


N = int(input())
A = sum(list(map(int, input().split())))
B = list(map(int, input().split()))
B.sort()
B.reverse()
if A <= B[0] + B[1]:
	print('YES')
else:
	print('NO')


sum = 0
b = []
n = int(input())
line1 = input().split()
line2 = input().split()
for i in range(n):
	sum += int(line1[i])
	b.append(int(line2[i]))
	continue
b.sort()
cap = b[n - 1] + b[n - 2]
if sum > cap:
	print('NO')
else:
	print('YES')


n = int(input())
a = sum(map(int, input().split()))
b = sorted(list(map(int, input().split())))
print(['NO', 'YES'][a <= b[-1] + b[-2]])


k = int(input())
s = sum(list(map(int, input().split())))
a = list(map(int, input().split()))
max1 = max(a)
a.pop(a.index(max1))
max2 = max(a)
if max1 + max2 >= s:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
s = sum(a)
f = False
b.sort()
b.reverse()
for i in range(1, n):
	if b[i] + b[i - 1] >= s:
		f = True
		break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
l2.sort(reverse=True)
if sum(l1) > l2[0] + l2[1]:
	print('NO')
else:
	print('YES')


def find_max_capacity(_capacity_):
	maximum = int(_capacity_[0])
	for elem in _capacity_:
		maximum = elem if elem > maximum else maximum
	return maximum
number_of_cans = int(input())
volume = list(map(int, input().split()))
capacity = list(map(int, input().split()))
volume_of_all = 0
for volume_N in volume:
	volume_of_all += volume_N
max_capacity = find_max_capacity(capacity)
capacity.remove(max_capacity)
max_capacity2 = find_max_capacity(capacity)
if volume_of_all <= max_capacity + max_capacity2:
	print('YES')
else:
	print('NO')


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
fill = sum(a)
b.sort()
if fill <= b[len(b) - 1] + b[len(b) - 2]:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
o = [int(i) for i in input().split()]
k = sum(l)
o.sort(reverse=True)
p = o[0] + o[1]
if p >= k:
	print('YES')
else:
	print('NO')


input()
print('YES' if sum([int(i) for i in input().split()]) <= sum(sorted([int(i) for i in input().split()], reverse=True)[:2]) else 'NO')


n = int(input())
A = sum(map(int, input().split()))
B = list(map(int, input().split()))

def max2(X):
	(m0, m1) = (0, 0)
	for x in X:
		if x >= m0:
			(m0, m1) = (x, m0)
		elif x > m1:
			m1 = x
	return (m0, m1)
b = sum(max2(B))
print('YES' if b >= A else 'NO')


n = int(input())
A = sum(list(map(int, input().split())))
b = list(map(int, input().split()))
flag = 0
b.sort()
if b[-1] + b[-2] >= A:
	flag = 1
if flag:
	print('YES')
else:
	print('NO')


input()
v = sum(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
s = max(c)
c.remove(s)
s += max(c)
print('YES' if s - v >= 0 else 'NO')


n = int(input())
am = list(map(int, input().split()))
sp = list(map(int, input().split()))
fs_1 = max(sp)
sp.remove(max(sp))
fs_2 = max(sp)
alls = sum(am)
if alls <= fs_1 + fs_2:
	print('YES')
else:
	print('NO')


cans_nr = int(input())
can_idx___coke_vol = [int(x) for x in input().split()]
can_idx___vol = [int(x) for x in input().split()]
top_2_vol = sum(sorted(can_idx___vol, reverse=True)[:2])
coke_vol = sum(can_idx___coke_vol)
if top_2_vol >= coke_vol:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = max(b)
b.remove(x)
y = max(b)
if sum(a) <= x + y:
	print('YES')
else:
	print('NO')


t = int(input())
l = list(map(int, input().split()))
z = sum(l)
arr = list(map(int, input().split()))
arr.sort()
if arr[-1] + arr[-2] >= z:
	print('YES')
else:
	print('NO')


n = int(input())
l = sum(list(map(int, input().split())))
n = sorted(list(map(int, input().split())), reverse=True)
print(['NO', 'YES'][sum(n[:2]) >= l])


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


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mx1 = max(b[0], b[1])
mx2 = min(b[0], b[1])
sum = a[0] + a[1]
for i in range(2, n):
	if b[i] > mx1:
		mx2 = mx1
		mx1 = b[i]
	elif b[i] > mx2:
		mx2 = b[i]
	sum += a[i]
if sum <= mx1 + mx2:
	print('YES')
else:
	print('NO')


n = input()
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b.sort()
sum = b[len(b) - 1] + b[len(b) - 2]
for i in range(int(n)):
	sum -= a[i]
	if sum < 0:
		print('No')
		quit()
print('Yes')


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


n = int(input())
remaining = input().strip().split(' ')
total = input().strip().split(' ')
total_re = sum((int(x) for x in remaining))
total = [int(x) for x in total]
total = sorted(total, reverse=True)
sum_to = int(total[0]) + int(total[1])
if total_re <= sum_to:
	print('YES')
else:
	print('NO')


n = input('')
n = int(n)
str = input('')
a = str.split(' ')
a = [int(i) for i in a]
str = input('')
b = str.split(' ')
b = [int(i) for i in b]
sum = 0
for i in range(0, n):
	sum = sum + a[i]
b.sort(reverse=True)
if sum <= b[0] + b[1]:
	print('YES')
else:
	print('NO')


n = int(input())
r = list(map(int, input().split()))
l = list(map(int, input().split()))
a = sum(r)
ma = max(l)
ma1 = max(l[0], l[1])
ma2 = min(l[1], l[0])
for i in range(len(l)):
	if l[i] > ma1:
		ma2 = ma1
		ma1 = l[i]
	elif l[i] < ma1 and l[i] > ma2:
		ma2 = l[i]
	elif l[i] < ma2:
		continue
d = ma + ma2
if d >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = []
m = -10 ** 9
t = 0
for j in range(2):
	for i in range(n):
		if b[i] > m:
			m = b[i]
			t = i
	ans.append(b[t])
	b[t] = 0
	m = -10 ** 9
	t = 0
if sum(a) <= sum(ans):
	print('YES')
else:
	print('NO')


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


n = int(input())
arr = list(map(int, input().strip().split(' ')))
arr1 = list(map(int, input().strip().split(' ')))
a = sum(arr)
arr1 = sorted(arr1)
if arr1[n - 1] + arr1[n - 2] >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
sa = sum(a)
b.sort(reverse=True)
if sa <= b[0] + b[1]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max1 = max(b)
b.remove(max1)
max2 = max(b)
if max1 + max2 >= sum(a):
	print('YES')
else:
	print('NO')


n = int(input())
t1 = list(map(int, input().split()))
t2 = list(map(int, input().split()))
m = max(t2)
t2.remove(m)
m += max(t2)
nb = 0
for i in range(len(t1)):
	nb += t1[i]
if nb <= m:
	print('YES')
else:
	print('NO')


n = int(input())
a0 = 0
a1 = 0
B = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
for a in A:
	if a >= a0:
		a1 = a0
		a0 = a
	elif a >= a1:
		a1 = a
if a1 + a0 >= sum(B):
	print('YES')
else:
	print('NO')


n = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
x = y = -1
for z in B:
	if x <= y <= z:
		(x, y) = (y, z)
	elif x <= z < y:
		(x, y) = (z, y)
	else:
		(x, y) = (x, y)
print('YES' if x + y >= sum(A) else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aS = sum(a)
bsort = b.sort(reverse=True)
bS = b[0] + b[1]
if aS <= bS:
	print('YES')
else:
	print('NO')


n = int(input())
b = list(map(int, input().split()))
a = list(map(int, input().split()))
summ = sum(b)
a.sort(key=lambda x: -x)
print('YES' if a[0] + a[1] >= summ else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = sorted(list(map(int, input().split())))
s = sum(a)
st = b[n - 1] + b[n - 2]
if s > st:
	print('NO')
else:
	print('YES')


T = int(input())
Sum = sum(map(int, input().split()))
ls = list(map(int, input().split()))
ls.sort()
if Sum <= ls[-1] + ls[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
rem = []
b = sorted(b)
b = b[::-1]
cap = b[0] + b[1]
total = 0
for ele in a:
	total += ele
if cap >= total:
	print('YES')
else:
	print('NO')


n = int(input())
rem = [int(x) for x in input().split()]
cap = [int(x) for x in input().split()]
rems = 0
cap2 = [0, 0]
for i in range(n):
	rems += rem[i]
	if cap[i] > cap2[0]:
		cap2[1] = cap2[0]
		cap2[0] = cap[i]
	elif cap[i] > cap2[1]:
		cap2[1] = cap[i]
caps = cap2[0] + cap2[1]
if caps >= rems:
	print('YES')
else:
	print('NO')


def solution(vol, full):
	full.sort()
	max_full = full.pop() + full.pop()
	if sum(vol) <= max_full:
		return 'YES'
	return 'NO'

def main():
	num = int(input())
	volume = list(map(int, input().split()))
	full = list(map(int, input().split()))
	print(solution(volume, full))
main()


i = int(input())
t = sum(map(int, input().split()))
v = sum(sorted(map(int, input().split()))[-2:])
print('YES' if v >= t else 'NO')


nos_of_cans = int(input())
left_overs = [int(x) for x in input().split()]
capacities = [int(x) for x in input().split()]
sum_left_overs = sum(left_overs)
sorted_capacities = sorted(capacities)
if sum(sorted_capacities[-2:]) >= sum_left_overs:
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m1 = 0
m2 = 0
s = 0
for i in range(n):
	if b[i] > m1:
		m2 = m1
		m1 = b[i]
	elif b[i] > m2:
		m2 = b[i]
	s += a[i]
if m1 + m2 >= s:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
ans = list(map(int, input().split()))
s = sum(arr)
lo = 0
hi = n - 1
ans.sort()
while lo < hi:
	if ans[lo] + ans[hi] >= s:
		print('YES')
		exit()
	lo += 1
print('NO')


n = input()
array = list(map(int, input().split(' ')))
array1 = list(map(int, input().split(' ')))
array1.sort()
num = 0
for _ in range(int(n)):
	num += array.__getitem__(_)
num2 = array1.__getitem__(len(array1) - 1) + array1.__getitem__(len(array1) - 2)
if num2 >= num:
	print('YES')
else:
	print('NO')


n = eval(input())
num1 = []
num2 = []
for i in input().split():
	num1.append(int(i))
for u in input().split():
	num2.append(int(u))
vs = sum(num1)
num3 = sorted(num2)
max0 = num3[-1] + num3[-2]
if max0 >= vs:
	print('YES')
else:
	print('NO')


def second_largest(numbers):
	count = 0
	m1 = m2 = float('-inf')
	for x in numbers:
		count += 1
		if x > m2:
			if x >= m1:
				(m1, m2) = (x, m1)
			else:
				m2 = x
	return m2 if count >= 2 else None
n = int(input())
data = []
for i in range(2):
	data.append(list(map(int, input().split())))
s = sum(data[0])
m1 = max(data[1])
m2 = second_largest(data[1])
if m1 + m2 < s:
	print('NO')
else:
	print('YES')


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


input()
x = sum(map(int, input().split()))
l = sorted([int(x) for x in input().split()], reverse=True)
if x <= l[0] + l[1]:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
s1 = sum(a)
b = [int(i) for i in input().split()]
b.sort(reverse=True)
s2 = b[0] + b[1]
print('YES' if s1 <= s2 else 'NO')


x = input()
y = input()
z = input()
n = x.split()
can = y.split()
size = z.split()
cans = []
sizes = []
for i in can:
	cans.append(int(i))
for i in size:
	sizes.append(int(i))
sizes = sorted(sizes)
if sizes[-1] + sizes[-2] >= sum(cans):
	print('Yes')
else:
	print('No')


n = int(input())
max_heap = [-1, -1]
sum_remain = sum([int(r) for r in input().split(' ')])
cap = [int(c) for c in input().split(' ')]
max_heap = [-1, -1]
for c in cap:
	if c > max_heap[0]:
		tmp = max_heap[0]
		max_heap[0] = c
		max_heap[1] = tmp
	elif c > max_heap[1]:
		max_heap[1] = c
if sum_remain > sum(max_heap):
	print('No')
else:
	print('Yes')


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


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


n = int(input())
rm = [int(x) for x in input().split()]
cp = [int(x) for x in input().split()]
cp.sort(reverse=True)
sumcp = cp[0] + cp[1]
sumrm = sum(rm)
if sumcp >= sumrm:
	print('YES')
else:
	print('NO')


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
m1 = -1
m2 = -1
for i in B:
	if i > m1:
		m2 = m1
		m1 = i
	elif i > m2:
		m2 = i
if sum(A) <= m1 + m2:
	print('YES')
else:
	print('NO')


from sys import stdin

def two_largest_volume(numbers):
	count = 0
	m1 = m2 = int(0)
	for x in numbers:
		count += 1
		if x > m2:
			if x >= m1:
				(m1, m2) = (x, m1)
			else:
				m2 = x
	return m1 + m2
n = int(stdin.readline())
volumes = [int(elem) for elem in stdin.readline().split()]
capacities = [int(elem) for elem in stdin.readline().split()]
if n <= 1:
	print('NO')
elif n == 2:
	print('YES')
elif two_largest_volume(capacities) >= sum(volumes):
	print('YES')
else:
	print('NO')


n = int(input())
drink = list(map(int, input().split()))
capacity = list(map(int, input().split()))
capacity.sort(reverse=True)
if capacity[0] + capacity[1] < sum(drink):
	print('NO')
else:
	print('YES')


import math, functools as ft, itertools as it
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
q = b[-1] + b[-2]
print('YES' if sum(a) <= q else 'NO')


q = int(input())
w = list(map(int, input().split()))
e = list(map(int, input().split()))
z = -1
r = max(e)
for i in range(q):
	if e[i] == r:
		z = i
del e[z]
k = max(e)
if k + r < sum(w):
	print('NO')
else:
	print('YES')


n = int(input())
r = sum(list([int(x) for x in input().split()]))
c = list([int(y) for y in input().split()])
c.sort(reverse=True)
if c[0] + c[1] >= r:
	print('YES')
else:
	print('NO')


import sys
import math
bottles = int(input())
rem = [int(x) for x in input().strip().split(' ')]
caps = [int(x) for x in input().strip().split(' ')]
b1 = -sys.maxsize
b2 = -sys.maxsize
b = {}
caps = sorted(caps, reverse=True)
if sum(rem) <= caps[0] + caps[1]:
	print('YES')
else:
	print('NO')


def II():
	return int(SI())

def MI():
	return map(int, SI().split())

def LI():
	return list(MI())

def SI():
	return input()
T = II()
A = LI()
B = LI()
c1 = max(B)
B.remove(c1)
c2 = max(B)
if sum(A) <= c1 + c2:
	print('YES')
else:
	print('NO')


n = int(input())
cola = [int(i) for i in input().split()]
lata = [int(i) for i in input().split()]
lata.sort()
lata.reverse()
total = lata[0] + lata[1]
if sum(cola) <= total:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().strip().split()))
t = list(map(int, input().strip().split()))
s = sum(l)
t.sort(reverse=True)
p = t[0] + t[1]
if p >= s:
	print('YES')
else:
	print('NO')


while True:
	try:
		n = int(input())
	except:
		break
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b.sort()
	c = b[-1] + b[-2]
	for i in a:
		c -= i
		if c < 0:
			break
	if c >= 0:
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(q) for q in input().strip().split()]
b = [int(q) for q in input().strip().split()]
b.sort()
b = b[::-1]
if sum(a) > b[0] + b[1]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = max(b)
del b[b.index(max(b))]
if sum(a) <= x + max(b):
	print('YES')
else:
	print('NO')


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

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

def li():
	return list(mi())
n = ii()
volume = li()
capac = li()
s = sum(volume)
capac = sorted(capac, reverse=True)
if capac[0] + capac[1] < s:
	print('NO')
else:
	print('YES')


n = int(input())
A = [int(i) for i in input().split(' ')]
B = [int(i) for i in input().split(' ')]
x = sum(A)
B.sort()
if n == 1:
	print('NO')
elif B[n - 1] + B[n - 2] >= x:
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split()
b = input().split()
a_int = list(map(int, a))
b_int = list(map(int, b))
a_int = sorted(a_int, key=lambda x: x)
b_int = sorted(b_int, key=lambda x: x)
q = 0
x = b_int[n - 1] + b_int[n - 2]
for i in a_int:
	q += i
if q <= x:
	print('YES')
else:
	print('NO')


n = int(input())
av = list(map(int, input().strip().split(' ')))
bv = list(map(int, input().strip().split(' ')))
if sum(av) <= sum(sorted(bv)[-2:]):
	print('YES')
else:
	print('NO')


n = int(input())
x = input()
a = x.split()
x = input()
b = x.split()
s = 0
for i in a:
	s += int(i)
for i in range(0, n):
	b[i] = int(b[i])
b.sort()
b.reverse()
g = b[0] + b[1]
if g >= s:
	print('YES')
else:
	print('NO')


R = lambda : list(map(int, input().split(' ')))
input()
a = R()
b = R()
b.sort()
print(['NO', 'YES'][int(sum(a) <= sum(b[-2:]))])


n = int(input())
cans = []
cola = [int(x) for x in input().split()]
cans = sorted([int(x) for x in input().split()])
c = sum(cola)
if c <= cans[-1] + cans[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
vc = map(int, input().split())
vb = list(map(int, input().split()))
Vc = sum(vc)
mx1 = max(vb)
vb.remove(mx1)
mx2 = max(vb)
if mx1 + mx2 >= Vc:
	print('YES')
else:
	print('NO')


import heapq

def main():
	N = int(input())
	r = sum(map(int, input().split()))
	hq = []
	for b in map(int, input().split()):
		heapq.heappush(hq, -b)
	room = heapq.heappop(hq) + heapq.heappop(hq)
	if -room >= r:
		return 'YES'
	return 'NO'
print(main())


n = int(input())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
x = max(m)
m.remove(x)
y = max(m)
z = x + y
d = sum(l)
if d <= z:
	print('YES')
else:
	print('NO')


n = int(input())
remain_volume_list = list(map(int, input().split()))
total_volume_list = list(map(int, input().split()))
total_volume_list.sort()
if sum(remain_volume_list) <= total_volume_list[n - 1] + total_volume_list[n - 2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
x = sum(a)
f = 1
for i in range(n):
	p = sum(b[i:i + 2])
	if x <= p:
		print('YES')
		f = 0
		break
if f:
	print('NO')


import math
import sys
n = int(input())
sum = sum(list(map(int, input().split())))
li = sorted(list(map(int, input().split())))
cap = li[n - 1] + li[n - 2]
print('YES' if sum <= cap else 'NO')


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


n = int(input())
amount = sum(map(int, input().split()))
max_can = sum(sorted(map(int, input().split()))[-2:])
print('No') if max_can < amount else print('Yes')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxi = max(b)
b.remove(maxi)
maxi += max(b)
sum1 = sum(a)
if sum1 <= maxi:
	print('YES')
else:
	print('NO')


sum_a = 0
n = int(input())
a = input().split()
b = input().split()
for i in range(n):
	a[i] = int(a[i])
	sum_a += a[i]
	b[i] = int(b[i])
maximum = max(b)
del b[b.index(max(b))]
maximum += max(b)
if n == 2 or maximum >= sum_a:
	print('YES')
else:
	print('NO')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
sm = sum(l1)
mx1 = max(l2)
l2.remove(mx1)
mx2 = max(l2)
if sm <= mx1 + mx2:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
b.sort()
tv = b[-1] + b[-2]
rv = 0
for i in a:
	rv += i
if tv >= rv:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
v = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += l[i]
v.sort()
if sum <= v[n - 1] + v[n - 2]:
	print('YES')
else:
	print('NO')


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
z = c[-1] + c[-2]
if sum(b) <= z:
	print('YES')
else:
	print('NO')


n = int(input())
s = 0
for i in list(map(int, input().split())):
	s += i
mx1 = 0
mx2 = 0
for i in list(map(int, input().split())):
	if i > mx1:
		mx2 = mx1
		mx1 = i
		continue
	if i > mx2:
		mx2 = i
if s <= mx1 + mx2:
	print('YES')
else:
	print('NO')


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


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
aa = sum(a)
b2 = b[0] + b[1]
if aa <= b2:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	re = list(map(int, input().split()))
	ca = list(map(int, input().split()))
	ca.sort()
	if sum(re) <= ca[-1] + ca[-2]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
if n < 2:
	print('NO')
	exit()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
if b[0] + b[1] >= sum(a):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
v = sum(a)
b.sort()
bnk = b[len(b) - 2] + b[len(b) - 1]
if bnk >= v:
	print('yes')
else:
	print('no')


r = lambda : list(map(int, input().split()))
n = r()[0]
a = r()
b = sorted(r())
print('YES') if b[-1] + b[-2] >= sum(a) else print('NO')


N = int(input())
arr = map(int, input().split())
vols = sum(arr)
cans = sorted(list(map(int, input().split())))
max_can = cans[-1] + cans[-2]
if vols <= max_can:
	print('YES')
else:
	print('NO')


t = eval(input())
y = input().split()
c = input().split()
z = sum([int(x) for x in y])
x = [int(x) for x in c]
w = sorted(x)
yc = sum(w[t - 2:])
if yc >= z:
	print('YES')
else:
	print('NO')


can = int(input())
rem = input().split()
cap = input().split()
rem = list(map(int, rem))
cap = list(map(int, cap))
f = max(cap)
cap.pop(cap.index(f))
g = max(cap)
maxc = f + g
if sum(rem) <= maxc:
	print('YES')
else:
	print('NO')


import sys

def main():
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	b = list(map(int, sys.stdin.readline().split()))
	total = sum(a)
	capacity = sum(sorted(b, reverse=True)[0:2])
	if total <= capacity:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
arr = []
r = lambda : list(map(int, input().split()))
a = r()
b = r()
arr = [[i, j] for (i, j) in zip(a, b)]
arr.sort(key=lambda x: x[1])
cap = arr[-2][1] + arr[-1][1]
c = 0
for i in arr:
	c += i[0]
if c > cap:
	print('NO')
else:
	print('YES')


n = int(input())
ost = [int(i) for i in input().split()]
vmest = [int(i) for i in input().split()]
summy = sum(ost)
vmest.sort(reverse=True)
if vmest[0] + vmest[1] >= summy:
	print('YES')
else:
	print('NO')


n = int(input())
v1 = list(map(int, input().split()))
v2 = list(map(int, input().split()))
zh = sum(v1)
v2.sort()
k = v2[-1] + v2[-2]
if k >= zh:
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split()
b = input().split()
x = []
y = []
ans = 0
pd = 0
for i in range(0, n):
	x.append(int(a[i]))
	y.append(int(b[i]))
y.sort()
y.reverse()
ans = sum(x)
if len(y) < 2:
	print('NO')
else:
	pd = y[0] + y[1]
	if pd >= ans:
		print('YES')
	else:
		print('NO')


q = int(input())
R = lambda : map(int, input().split())
a = sum(list(R()))
b = sorted(list(R()), reverse=True)
if sum(b[:2]) >= a:
	print('YES')
else:
	print('NO')


input()
v = sum(map(int, input().split()))
c = list(sorted(map(int, input().split())))
x = len(c)
c = sum(c[x - 2:x])
if c >= v:
	print('YES')
else:
	print('NO')


n = int(input())
n1 = list(map(int, input().split()))
n2 = list(map(int, input().split()))
c_c = 0
for i in range(len(n1)):
	c_c += n1[i]
s = max(n2)
n2.remove(s)
p = max(n2)
if p + s >= c_c:
	print('YES')
else:
	print('NO')


n = int(input())
s = sum(map(int, input().split()))
b = list(map(int, input().split()))
m = max(b)
del b[b.index(m)]
m += max(b)
if s > m:
	print('NO')
else:
	print('YES')


n = eval(input())
(a, b) = ([], [])
for i in input().split():
	a.append(eval(i))
for h in input().split():
	b.append(eval(h))
b.sort()
if sum(a) > b[-1] + b[-2]:
	print('NO')
else:
	print('Yes')


n = int(input())
cola = [int(x) for x in input().strip().split()]
capacity = [int(x) for x in input().strip().split()]
allcola = sum(cola)
m1 = max(capacity)
capacity.remove(m1)
m2 = max(capacity)
if m1 + m2 >= allcola:
	print('YES')
else:
	print('NO')


t = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b.sort()
c = b[-1] + b[-2]
if sum(a) <= c:
	print('YES')
else:
	print('NO')


a = int(input())
if a == 1:
	x = int(input())
	y = int(input())
	if x > y:
		print('NO')
	else:
		print('YES')
else:
	vol = map(int, str(input()).split())
	can = map(int, str(input()).split())
	can = sorted(can, reverse=True)
	y = can[0] + can[1]
	x = sum(vol)
	if x > y:
		print('NO')
	else:
		print('YES')


n = int(input())
vols = list(map(int, input().split()))
caps = map(int, input().split())
max = list(sorted(caps))[-2:]
if sum(vols) <= sum(max):
	print('YES')
else:
	print('NO')


n = int(input())
mas = list(map(int, input().split()))
gas = list(map(int, input().split()))
f = max(gas)
del gas[gas.index(f)]
s = max(gas)
if sum(mas) <= s + f:
	print('YES')
else:
	print('NO')


n = int(input())
rem = [int(x) for x in input().split()][:n]
cap = [int(x) for x in input().split()][:n]
max1 = cap.pop(cap.index(max(cap)))
max2 = cap.pop(cap.index(max(cap)))
if sum(rem) <= max1 + max2:
	print('YES')
else:
	print('NO')


n = int(input())
aa = input().split()
sum = 0
for i in range(0, n):
	aa[i] = int(aa[i])
	sum = sum + aa[i]
bb = input().split()
for q in range(0, n):
	bb[q] = int(bb[q])
bb.sort()
v = bb[n - 1] + bb[n - 2]
if sum <= v:
	print('YES')
else:
	print('NO')


n = int(input())
r = lambda : map(int, input().split())
v = list(r())
c = list(r())
sm = sum(v)
cn1 = max(c)
i = c.index(cn1)
c.pop(i)
cn2 = max(c)
if sm <= cn1 + cn2:
	print('YES')
else:
	print('NO')


k = int(input())
a = lambda : list(map(int, input().split()))
print('YES' if sum(a()) <= sum(sorted(a(), reverse=True)[:2]) else 'NO')


import heapq
n = int(input())
rem_vol = sum([int(x) for x in input().split()])
can_cap = []
for x in input().split():
	heapq.heappush(can_cap, int(x))
great_2 = heapq.nlargest(2, can_cap)
if rem_vol > sum(great_2):
	print('NO')
else:
	print('YES')


n = int(input())
l = list(map(int, input().split()))
b = list(map(int, input().split()))
a = []
b.sort()
a.append(b[-1])
a.append(b[-2])
s = sum(l)
ans = sum(a)
if s > ans:
	print('NO')
else:
	print('YES')


n = int(input())
Remaining = [*map(int, input().split())]
Capacity = [*map(int, input().split())]
Capacity.sort()
if sum(Remaining) <= Capacity[n - 1] + Capacity[n - 2]:
	print('YES')
else:
	print('NO')


n = int(input())
rest = input()
capa = input()
rest = rest.split()
capa = capa.split()
total = 0
for i in range(n):
	total = total + int(rest[i])
	capa[i] = int(capa[i])
capa.sort(reverse=True)
if total > capa[0] + capa[1]:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(input().split(' '))
for i in range(0, n):
	a[i] = int(a[i])
b = list(input().split(' '))
for i in range(0, n):
	b[i] = int(b[i])
c = max(b)
b.remove(c)
f = b[:]
d = max(f)
e = sum(a)
if e <= c + d:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
m = max(b)
b.remove(m)
c = max(b)
p = sum(a)
if m + c >= p:
	print('yes')
else:
	print('no')


n = int(input())
l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
l2.sort()
if sum(l1) <= l2[-1] + l2[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
n2 = input()
n2 += ' '
n3 = input()
n3 += ' '
kol = ''
n4 = 0
n5 = []
for i in range(0, len(n2)):
	if n2[i] != ' ':
		kol += n2[i]
	if n2[i] == ' ':
		n4 += int(kol)
		kol = ''
for i in range(0, len(n3)):
	if n3[i] != ' ':
		kol += n3[i]
	if n3[i] == ' ':
		n5.append(int(kol))
		kol = ''
kol = 0
max = 0
elim = 0
for i in range(0, 2):
	for i in range(0, n):
		if n5[i] > max:
			max = n5[i]
			elim = i
	kol += max
	max = 0
	n5.pop(elim)
	n -= 1
if kol >= n4:
	print('YES')
elif kol < n4:
	print('NO')


i = int(input())
t = sum((int(x) for x in input().split()))
v = sum(sorted((int(x) for x in input().split()))[-2:])
print('YES' if v >= t else 'NO')


(n, Sum, Max) = (input(), sum(map(int, input().split())), sorted(list(map(int, input().split()))))
Max = Max[-1] + Max[-2]
print('YES' if Sum <= Max else 'NO')


q = int(input())
a = list(map(int, input().split()))
s = list(map(int, input().split()))
s.sort()
d = sum(a)
print('YES' if d <= s[-1] + s[-2] else 'NO')


s = 0
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(0, len(a)):
	s = s + a[i]
b.sort()
t = b[-1] + b[-2]
if s <= t:
	print('YES')
else:
	print('NO')


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


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
k = sum(a)
b = sorted(b, reverse=True)
s = b[0] + b[1]
if k <= s:
	print('YES')
else:
	print('NO')


n = int(input())
a = sum(list(map(int, input().split())))
(q1, q2) = (0, 0)
k = list(map(int, input().split()))
for i in range(n):
	if k[i] > q1:
		q2 = q1
		q1 = k[i]
	elif k[i] > q2:
		q2 = k[i]
if q1 + q2 >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
SUM = sum(a)
cap = b[0] + b[1]
if cap >= SUM:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
m = max(l2)
l2.remove(m)
m = m + max(l2)
if sum(l) <= m:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
bMax = max(b)
b.remove(bMax)
print('YES' if sum(a) <= bMax + max(b) else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
n = iinp()
a = llinp()
b = llinp()
s = sum(a)
b.sort()
if s <= b[-1] + b[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
if b[-1] + b[-2] >= sum(a):
	print('Yes')
else:
	print('No')


import sys
sys.setrecursionlimit(100000000)

def iin():
	return int(input())

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

def irrin():
	return [int(x) for x in input().split()]

def imrin(n):
	return [int(input()) for _ in range(n)]
n = iin()
arr = irrin()
brr = irrin()
brr.sort(reverse=True)
if sum(arr) <= brr[0] + brr[1]:
	print('YES')
else:
	print('NO')


n = int(input())
volume = [0] * n
remaining = [0] * n
remainingSum = 0
inputs = input()
array = inputs.split()
for i in range(n):
	remaining[i] = int(array[i])
	remainingSum += remaining[i]
inputs = input()
array = inputs.split()
for i in range(n):
	volume[i] = int(array[i])
max = volume[0]
if volume[1] > max:
	max = volume[1]
	max2 = volume[0]
else:
	max2 = volume[1]
for i in range(2, n):
	if volume[i] > max:
		max2 = max
		max = volume[i]
	elif volume[i] > max2:
		max2 = volume[i]
if remainingSum <= max + max2:
	print('YES')
else:
	print('NO')


input()
v = sum(map(int, input().split(' ')))
c = sum(sorted(map(int, input().split(' ')))[-2:])
print('YES' if c - v >= 0 else 'NO')


n = int(input())
a = []
b = []
temp1 = [int(i) for i in input().split()]
temp2 = [int(i) for i in input().split()]
total = sum(temp1)
temp2.sort(reverse=True)
volume = temp2[0] + temp2[1]
if volume >= total:
	print('YES')
else:
	print('NO')


n = int(input())
A = input().split()
B = input().split()
A = [int(i) for i in A]
B = [int(i) for i in B]
vol = sum(A)
B.sort()
tot = B[n - 1]
if n != 1:
	tot = tot + B[n - 2]
if tot >= vol:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b1 = max(b)
b.remove(b1)
b2 = max(b)
if b1 + b2 >= sum(a):
	print('YES')
else:
	print('NO')


n = int(input())
v = sum(list(map(int, input().split())))
s = sorted(list(map(int, input().split())))
if s[n - 2] + s[n - 1] >= v:
	print('YES')
else:
	print('NO')


t = int(input())
x = [int(q) for q in input().split()]
y = [int(w) for w in input().split()]
r = sorted(y)
if sum(x) <= r[-1] + r[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
total_left = sum(map(int, input().split()))
volumes = list(map(int, input().split()))
print('YES' if sum(sorted(volumes)[-2:]) >= total_left else 'NO')


def list_output(s):
	print(' '.join(map(str, s)))

def list_input():
	return list(map(int, input().split()))
n = int(input())
a = list_input()
b = list_input()
b.sort(reverse=True)
cap = b[0] + b[1]
tot = sum(a)
if cap >= tot:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max1 = -1
max2 = -1
summ = sum(a)
for i in range(n):
	if b[i] > max1:
		max2 = max1
		max1 = b[i]
	elif b[i] > max2:
		max2 = b[i]
if max1 + max2 >= summ:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
m = 0
mb = 0
b.sort(reverse=True)
m = b[0]
mb = b[1]
for i in range(n):
	s += a[i]
if s <= m + mb:
	print('YES')
else:
	print('NO')


n = int(input())
sa = input()
a = sa.split()
aa = []

def mx1(l):
	mx = 0
	md = 0
	for i in l:
		if i[1] >= mx:
			mx = i[1]
			md = i[0]
	return [md, mx]

def mx2(l, a):
	mx = 0
	md = 0
	for i in l:
		if i[1] >= mx and i[0] != a[0]:
			mx = i[1]
			md = i[0]
	return [md, mx]
for i in a:
	aa.append(int(i))
ba = input()
b = ba.split()
bb = []
for i in range(n):
	bb.append([i, int(b[i])])
d = 0
for i in aa:
	d += i
t = mx1(bb)
w = mx2(bb, t)
if t[1] + w[1] >= d:
	print('YES')
else:
	print('NO')


input()
sum_a = sum(map(int, input().split()))
sum_b = sum(sorted(map(int, input().split()))[-2:])
print('YES' if sum_b >= sum_a else 'NO')


n = int(input())
v = sum(map(int, input().split()))
two_max = sum(sorted(list(map(int, input().split())))[-2:])
print('YES' if two_max >= v else 'NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n == 2:
	print('YES')
else:
	tot = sum(a)
	m1 = max(b)
	b.remove(m1)
	m2 = max(b)
	if tot > m1 + m2:
		print('NO')
	else:
		print('YES')


class Cola:

	def __init__(self, cur_cap, max_cap):
		self.max_capacity = max_cap
		self.current_capacity = cur_cap
		self.isOverflowed = False

	def can_be_filled(self, num):
		return self.current_capacity + num <= self.max_capacity

	def fill(self, num):
		if self.can_be_filled(num):
			self.current_capacity += num
			return 0
		elif self.current_capacity < self.max_capacity:
			temp = self.current_capacity
			self.current_capacity = self.max_capacity
			return temp + num - self.max_capacity
		else:
			return num

	def get_cur(self):
		return self.current_capacity

	def set_cur(self, num):
		self.current_capacity = num

	def __str__(self):
		return str(self.current_capacity) + ' ' + str(self.max_capacity)
number_of_cans = int(input())
cans = input()
capacities = input()
if number_of_cans == 2:
	print('YES')
	raise SystemExit(0)
cans_array = []
for elem in cans.split(' '):
	cans_array.append(int(elem))
capacities_array = []
for elem in capacities.split(' '):
	capacities_array.append(int(elem))
cola_array = []
for can in range(number_of_cans):
	cola_array.append(Cola(cans_array[can], capacities_array[can]))
cola_array.sort(key=lambda x: x.max_capacity, reverse=True)
for can in range(1, number_of_cans):
	cola_array[can].set_cur(cola_array[0].fill(cola_array[can].get_cur()))
for can in range(2, number_of_cans):
	cola_array[can].set_cur(cola_array[1].fill(cola_array[can].get_cur()))
counter = 0
for can in cola_array:
	if can.current_capacity > 0:
		counter += 1
if counter <= 2:
	print('YES')
else:
	print('NO')


n = int(input())
v = 0
for i in input().split(' '):
	v += int(i)
(a, b, c) = (0, 0, 0)
for i in input().split(' '):
	c = int(i)
	if c >= a:
		b = a
		a = c
	elif c > b:
		b = c
if v <= a + b:
	print('YES')
else:
	print('NO')


import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	n = int(inp())
	a = sum(read())
	b = sum(sorted(read())[-2:])
	print('YNEOS'[a > b::2])
solve()


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


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
import heapq
print('YES' if sum(a) <= sum(heapq.nlargest(2, b)) else 'NO')


n = int(input())
filled = list(map(int, input().split()))
capacity = list(map(int, input().split()))
arr = [x for (x, y) in sorted(zip(capacity, filled))]
if sum(filled) <= sum(arr[len(arr) - 2:]):
	print('YES')
else:
	print('NO')


def read1():
	ent = input()
	line = input().split()
	b = input().split()
	return (list(map(int, line)), list(map(int, b)))

def f1(a, b):
	(m1, m2) = (0, 0)
	ind = -1
	for i in range(len(b)):
		if m1 <= b[i]:
			m1 = b[i]
			ind = i
	b[ind] = -1
	if max(b) + m1 >= sum(a):
		return 'YES'
	return 'NO'
a = [1, 1, 1, 2]
b = [3, 1, 1, 2]
print(f1(*read1()))


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


n = int(input())
l = list(map(int, input().split()))
li = sorted(list(map(int, input().split())))
if li[0] + li[1] >= sum(l) or li[n - 1] + li[n - 2] >= sum(l):
	print('YES')
else:
	print('NO')


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
left = sum(A)
B.sort(reverse=True)
if left <= B[0] + B[1]:
	print('YES')
else:
	print('NO')


i = lambda : map(int, input().split())
i()
a = sum(i())
(*_, b, c) = sorted(i())
print('YNEOS'[a > b + c::2])


n = int(input())
(cola, can) = (list(map(int, input().split())), list(map(int, input().split())))
can.sort(reverse=True)
if sum(cola) <= can[0] + can[1]:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
sm = sum(l)
l1.sort(reverse=1)
if l1[0] + l1[1] >= sm:
	print('YES')
else:
	print('NO')


R = lambda : map(int, input().split())
(n,) = R()
cola = list(R())
cans = sorted(R(), reverse=True)
cola_sum = sum(cola)
cap_sum = cans[0] + cans[1]
if cap_sum >= cola_sum:
	print('YES')
else:
	print('NO')


input()
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
(x, y) = (sum(sorted(b, reverse=True)[:2]), sum(a))
print('YES' if x >= y else 'NO')


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


n = int(input())
amt = list(map(int, input().split()))
cap = list(map(int, input().split()))
sum_amt = sum(amt)
cap.sort(reverse=True)
if sum_amt <= cap[0] + cap[1]:
	print('yes')
else:
	print('no')


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


n = int(input())
volumeCola = [int(x) for x in input().split()][:n]
capacityCola = [int(x) for x in input().split()][:n]
list1 = []
totalVolume = sum(volumeCola)
for x in range(0, 2):
	m = max(capacityCola)
	list1.append(m)
	capacityCola.remove(m)
capacityOfTwoCans = sum(list1)
if capacityOfTwoCans >= totalVolume:
	print('YES')
else:
	print('NO')


n = int(input())
ara = list(map(int, input().split()))
ara2 = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += ara[i]
ara2.sort(reverse=True)
print('YES' if ara2[0] + ara2[1] >= sum else 'NO')


t = int(input())
l1 = sum(map(int, input().split()))
l2 = list(map(int, input().split()))
m = max(l2)
l2.remove(m)
m2 = max(l2)
if m2 + m >= l1:
	print('Yes')
else:
	print('No')


def main():
	n = int(input())
	remains = [int(x) for x in input().split()]
	caps = [int(x) for x in input().split()]
	total = sum(remains)
	left = sum(sorted(caps, reverse=True)[:2])
	if total > left:
		print('NO')
	else:
		print('YES')
main()


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
total = sum(V)
C.sort()
if C[-1] + C[-2] >= total:
	print('YES')
else:
	print('NO')


n = int(input())
cans = list(map(int, input().split()))
bottles = list(map(int, input().split()))
bottles.sort()
if sum(cans) <= bottles[-1] + bottles[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cola = sum(a)
b = sorted(b)
v = sum(b[-2:])
if cola <= v:
	print('YES')
else:
	print('NO')


amount_of_cola = []
amount_of_cans = []
num_of_cans = int(input())
k = input().split()
for i in k:
	if num_of_cans >= 0:
		amount_of_cola.append(int(i))
		num_of_cans -= 1
for i in input().split():
	amount_of_cans.append(int(i))
full_cola_amount = sum(amount_of_cola)
first_max_can = max(amount_of_cans)
amount_of_cans.remove(first_max_can)
second_max_can = max(amount_of_cans)
if num_of_cans == 2:
	print('YES')
elif full_cola_amount <= first_max_can + second_max_can:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = 0
for i in a:
	m = m + i
l = max(b)
k = b[0]
for i in b:
	if k < i and i != l:
		k = i
if m > k + l:
	print('No')
else:
	print('Yes')


n = int(input())
ar = [int(x) for x in input().split()]
ar1 = [int(x) for x in input().split()]
res = sum(ar)
ar1.sort()
one = ar1[n - 1]
two = ar1[n - 2]
sum = one + two
if res <= sum:
	print('YES')
else:
	print('NO')


n = int(input())
lr = list(map(int, input().split()))
lc = list(map(int, input().split()))
sr = sum(lr)
m1 = max(lc)
lc.remove(m1)
m2 = max(lc)
mc = m1 + m2
if mc >= sr:
	print('YES')
else:
	print('NO')


input()
amount = sum((int(x) for x in input().split()))
containers = sorted((int(x) for x in input().split()))
print('YES' if containers[-1] + containers[-2] >= amount else 'NO')


n = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
w = sum(a)
p = max(b)
b.remove(max(b))
if w <= p + max(b):
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
s = sum(a)
b.sort(reverse=True)
m = 0
m += sum(b[0:2])
if m >= s:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
brr.sort()
sm = sum(arr)
if sm <= brr[n - 2] + brr[n - 1]:
	print('YES')
else:
	print('NO')


def main():
	input()
	print(('NO', 'YES')[sum(map(int, input().split())) <= sum(sorted(map(int, input().split()), reverse=True)[:2])])
main()


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


n = int(input())
s = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
s.sort()
d.sort()
if sum(s) <= d[-1] + d[-2]:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
if n == 2:
	print('YES')
	sys.exit()
a = list(map(int, input().split()))
b = sorted(list(map(int, input().split())))
if sum(a) <= b[n - 1] + b[n - 2]:
	print('YES')
else:
	print('NO')


from operator import itemgetter
n = int(input())
ai = list(map(int, input().split()))
bi = list(map(int, input().split()))
bi.sort()
num = bi[-1] + bi[-2]
num2 = sum(ai)
ans = int(num >= num2)
print('YES' * ans + 'NO' * (1 - ans))


def main():
	input()
	remainings = [int(_) for _ in input().split()]
	capacities = [int(_) for _ in input().split()]
	capacities.sort(reverse=True)
	sum_remaining = sum(remainings)
	capacity_2_max_cans = sum(capacities[:2])
	print('YES' if sum_remaining <= capacity_2_max_cans else 'NO')
main()


n = int(input())
cola = sum([int(i) for i in input().split()])
can = [int(i) for i in input().split()]
can.sort()
if cola <= can[-1] + can[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
r = input()
t = input()
b = []
x = 0
for e in r.split(' '):
	x = x + int(e)
for e in t.split(' '):
	b.append(int(e))
b.sort()
k = b[n - 1] + b[n - 2]
if k >= x:
	print('YES')
else:
	print('NO')


a = int(input())
cola = input().split()
colatotal = int(0)
V = input().split()
Vtotal = int(0)
for i in range(a):
	cola[i] = int(cola[i])
	V[i] = int(V[i])
for j in range(a):
	colatotal += int(cola[j])
V.sort()
V.reverse()
Vtotal += int(V[0])
Vtotal += int(V[1])
if Vtotal >= colatotal:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
s = 0
max1 = max(b[0], b[1])
max2 = min(b[0], b[1])
for i in range(n):
	s += a[i]
	if i > 1:
		if b[i] > max1:
			max2 = max1
			max1 = b[i]
		elif b[i] > max2:
			max2 = b[i]
if s <= max1 + max2:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
su1 = sum(a)
su2 = b[0] + b[1]
if su2 >= su1:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = sum(a)
(m1, m2) = (0, 0)
for i in range(len(b)):
	if b[i] > m2:
		m2 = b[i]
		if m2 > m1:
			(m1, m2) = (m2, m1)
if x <= m1 + m2:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
asum = sum(a)
b.sort()
bsum = b[-1] + b[-2]
if asum <= bsum:
	print('yes')
else:
	print('no')


n = int(input())
cola = list(map(int, input().split(' ')))
cans = list(map(int, input().split(' ')))
a = sum(cola)
c = b = i = 0
k = n
while k:
	if cans[i] == cans[-1]:
		b = cans[i] + cans[0]
		if b < a:
			c += 1
	else:
		b = cans[i] + cans[i + 1]
		if b < a:
			c += 1
	i += 1
	k -= 1
if c != n:
	print('Yes')
else:
	print('No')


a = int(input())

def ls(spis):
	length = len(spis)
	i = 0
	im = 0
	mx = int(spis[i])
	while i < length:
		if mx < int(spis[i]):
			mx = int(spis[i])
			im = i
		i += 1
	return im
if a != 2:
	b = input().split()
	c = input().split()
	length = len(b)
	sum = 0
	i = 0
	while i < length:
		sum += int(b[i])
		i += 1
	i = 0
	sum2 = 0
	f = int(c[ls(c)])
	sum2 += f
	c.remove(str(f))
	f = int(c[ls(c)])
	sum2 += f
	if sum2 >= sum:
		print('Yes')
	else:
		print('No')
else:
	print('Yes')


n = int(input())
now = list(map(int, input().split()))
al = list(map(int, input().split()))
sum_now = 0
for i in now:
	sum_now = sum_now + i
al_max_big = 0
al_max_small = 0
for botle in al:
	if botle > al_max_big:
		al_max_small = al_max_big
		al_max_big = botle
	elif botle > al_max_small:
		al_max_small = botle
two_botle = al_max_small + al_max_big
if two_botle >= sum_now:
	print('YES')
else:
	print('NO')


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

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

def li():
	return list(mi())
n = ii()
a = li()
b = li()
b.sort()
print('YES' if sum(a) <= b[-1] + b[-2] else 'NO')


n = int(input())
s = sum([int(_) for _ in input().split()])
a = sorted([int(_) for _ in input().split()])
if a[n - 1] + a[n - 2] >= s:
	print('YES')
else:
	print('NO')


input()
totvolume = sum([int(x) for x in input().split()])
totcap = sum(sorted([int(x) for x in input().split()])[-2:])
print(('YES', 'NO')[totcap < totvolume])


n = int(input())
a = lambda : map(int, input().split())
b = lambda : map(int, input().split())
l1 = list(a())
l2 = sorted(list(b()))
if sum(l1) <= l2[n - 1] + l2[n - 2]:
	print('YES')
else:
	print('NO')


n = int(input())
c = []
c1 = []
c2 = []
b = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
	khali = a[i] - b[i]
	c.append(khali)
kol_khali = sum(c)
kol_cola = sum(b)
k = max(a)
a.remove(max(a))
o = max(a)
if kol_cola <= k + o:
	print('yes')
else:
	print('no')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = []
l5 = []
l6 = []
if n == 2:
	print('YES')
else:
	x = max(l2)
	l2.remove(x)
	y = max(l2)
	z = x + y
	if z >= sum(l1):
		print('YES')
	else:
		print('NO')


n = int(input())
sum1 = 0
num = list(map(int, input().split()))
lst = list(map(int, input().split()))
max1 = max(lst)
lst.pop(lst.index(max1))
max2 = max(lst)
a = max1 + max2
for i in range(len(num)):
	sum1 += num[i]
if sum1 <= a:
	print('YES')
else:
	print('NO')


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


num_cans = int(input())
if num_cans <= 2:
	print('YES')
else:
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	total_vol = sum(a)
	sorted_cans = sorted(b)
	two_big_cans = sorted_cans[-2:]
	vol_available = sum(two_big_cans)
	if total_vol <= vol_available:
		print('YES')
	else:
		print('NO')


n = int(input())
lst1 = [int(x) for x in input().split()]
lst2 = [int(x) for x in input().split()]
lst2 = sorted(lst2)
summa = lst2[-1] + lst2[-2]
if summa >= sum(lst1):
	print('YES')
else:
	print('NO')


n = int(input())
vol = list(map(int, input().split()))
can = list(map(int, input().split()))
can.sort()
if sum(vol) <= can[-1] + can[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
drink = [int(x) for x in input().split(' ')]
cap = [int(x) for x in input().split(' ')]
drink = sum(drink)
cap.sort()
if cap[-1] + cap[-2] >= drink:
	print('YES')
else:
	print('NO')


n = int(input())
vol = list(map(int, input().split()))
cap = list(map(int, input().split()))
ma1 = max(cap)
cap.remove(ma1)
ma2 = max(cap)
if sum(vol) <= ma1 + ma2:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
max1 = max(b)
b.remove(max1)
max2 = max(b)
suma = max1 + max2
s = 0
for i in a:
	s += i
if s <= suma:
	print('YES')
else:
	print('NO')


inp = lambda : list(map(int, input().split()))
n = int(input())
a = sum(inp())
b = inp()
mxind1 = mxind2 = 0
mx1 = mx2 = -1
for i in range(n):
	if b[i] > mx1:
		mx1 = b[i]
		mxind1 = i
for i in range(n):
	if i == mxind1:
		continue
	if b[i] > mx2:
		mx2 = b[i]
		mxind2 = i
if b[mxind1] + b[mxind2] >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b1 = max(b)
ind = b.index(b1)
b.pop(ind)
b2 = max(b)
vse = sum(a)
if vse <= b1 + b2:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
M = max(b)
b.remove(M)
m = max(b)
if M + m >= sum(a):
	print('YES')
else:
	print('NO')


a = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
count = 0
for i in l1:
	count += i
b = max(l2)
x = l2.pop(l2.index(b))
c = max(l2)
if b + c >= count:
	print('YES')
else:
	print('NO')


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

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

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

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

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

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

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

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

def S():
	return input()

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

def main():
	n = I()
	a = LI()
	b = LI()
	s = sum(a)
	t = sorted(b)
	if t[-1] + t[-2] >= s:
		return 'YES'
	return 'NO'
print(main())


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
v = sorted(b)
print(['NO', 'YES'][sum(a) <= v[-1] + v[-2]])


n = int(input())
rem = list(map(int, input().split()))
total = list(map(int, input().split()))
if n == 2:
	ans = 'YES'
else:
	total.sort()
	sum1 = total[-1] + total[-2]
	if sum(rem) <= sum1:
		ans = 'YES'
	else:
		ans = 'NO'
print(ans)


def solve(a, b, n):
	if n == 2:
		return 'YES'
	a = sorted(a, reverse=True)
	b = sorted(b, reverse=True)
	empty = b[0] - a[0] + b[1] - a[1]
	if sum(a[2:]) > empty:
		return 'NO'
	return 'YES'

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	print(solve(a, b, n))
main()


import sys
data = sys.stdin.readlines()
cola = [int(i) for i in data[1].split()]
banks = [int(i) for i in data[2].split()]
allcola = sum(cola)
a = max(banks)
banks.remove(a)
b = max(banks)
c = a + b
if allcola <= c:
	print('YES')
else:
	print('NO')


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


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
two = sum(b[:2])
if sum(a) <= two:
	print('yes')
else:
	print('no')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
total = sum(a)
idx = 0
mx = 0
for i in range(n):
	if b[i] > mx:
		idx = i
		mx = b[i]
total -= mx
mx = 0
for i in range(n):
	if b[i] > mx and i != idx:
		mx = b[i]
total -= mx
if total > 0:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s1 = sum(a)
t = max(b)
s2 = t
b.remove(t)
s2 += max(b)
if s2 >= s1:
	print('YES')
else:
	print('NO')


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort(reverse=True)
print('yes' if sum(a) <= b[0] + b[1] else 'no')


import sys
line = [int(x) for x in sys.stdin.read().strip().split()]
canNum = int(line[0])
if canNum == 2:
	print('YES')
elif canNum < 2 or canNum > 100000:
	print('NO')
else:
	remain = []
	for i in range(1, canNum + 1):
		remain.append(int(line[i]))
	max1 = -1
	max2 = -1
	ind1 = -1
	ind2 = -1
	k = 0
	for j in range(canNum + 1, canNum * 2 + 1):
		if int(line[j]) >= max1:
			max2 = max1
			max1 = int(line[j])
			ind2 = ind1
			ind1 = k
			k += 1
			continue
		if int(line[j]) > max2:
			max2 = int(line[j])
			ind2 = k
		k += 1
	possible = True
	for i in range(0, len(remain)):
		if i == ind1 or i == ind2:
			continue
		if remain[ind1] + remain[i] <= max1:
			remain[ind1] += remain[i]
		elif remain[ind1] + remain[i] > max1:
			fin = (remain[ind1] + remain[i]) % max1
			if fin != 0:
				if fin + remain[ind2] <= max2:
					remain[ind2] += fin
					remain[ind1] = max1
				else:
					possible = False
			else:
				possible = False
	if possible:
		print('YES')
	else:
		print('NO')
sys.exit(0)


cans = int(input())
volume = list(map(int, input().split()))
capacity = list(map(int, input().split()))
total_volume = sum(volume)
capacity = sorted(capacity, reverse=True)
cap_sum = capacity[0] + capacity[1]
if cap_sum >= total_volume:
	print('YES')
else:
	print('NO')


input()
s = sum(map(int, input().split()))
print('YES' if sum(list(sorted(map(int, input().split())))[-2:]) >= s else 'NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(l1, l2) = (-1, -1)
t = sum(a)
for i in b:
	if i > l2:
		l2 = i
	if l2 > l1:
		(l1, l2) = (l2, l1)
if t <= l1 + l2:
	print('YES')
else:
	print('NO')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
max1 = max(l2)
l2.remove(max1)
max2 = max(l2)
l2.remove(max2)
sum1 = sum(l1)
if sum1 <= max1 + max2:
	print('YES')
else:
	print('NO')


n = int(input())
vol = [int(i) for i in input().split()]
cap = sorted([int(i) for i in input().split()])
if sum(vol) <= cap[-1] + cap[-2]:
	print('YES')
else:
	print('NO')


n = int(input())
cap = list(map(int, input().split()))
jor = list(map(int, input().split()))
summ = sum(cap)
max1 = max(jor)
jor.remove(max1)
max2 = max(jor)
if max1 + max2 - summ >= 0:
	print('YES')
else:
	print('NO')


input()
list1 = [*map(int, input().split())]
list2 = [*map(int, input().split())]
sum = 0
for a in list1:
	sum += a
m2 = 0
m = 0
for a in list2:
	if a >= m:
		(m, m2) = (a, m)
	elif a <= m and a > m2:
		m2 = a
if sum <= m + m2:
	print('YES')
else:
	print('NO')


N = int(input())
s = input()
t = input()
S = [int(m) for m in s.split()]
T = [int(m) for m in t.split()]
if N > 1:
	x = []
	x.append(max(T))
	T.remove(max(T))
	x.append(max(T))
	T.remove(max(T))
	if sum(x) >= sum(S):
		print('YES')
	else:
		print('NO')
elif sum(T) > sum(S):
	print('YES')
else:
	print('NO')


input()
print('YES' if sum(list(map(int, input().split()))) <= sum(sorted(list(map(int, input().split())), reverse=True)[0:2]) else 'NO')


n = int(input())
cola = list(map(int, input().split()))
vmestimost = list(map(int, input().split()))
x = sum(cola)
vmestimost.sort()
if vmestimost[-1] + vmestimost[-2] >= x:
	print('YES')
else:
	print('NO')


n = int(input())
s = sum([int(k) for k in input().split(' ') if k])
d = [int(k) for k in input().split(' ') if k]
first = max(d)
del d[d.index(first)]
second = max(d)
if s <= first + second:
	print('YES')
else:
	print('NO')


import random
import re
import sys
n = int(input())
ar = list(map(int, input().split()))
br = list(map(int, input().split()))
sum = 0
br.sort()
for i in range(0, n):
	sum = sum + ar[i]
if br[n - 1] + br[n - 2] >= sum:
	print('YES')
else:
	print('NO')


n = int(input())
if n == 2:
	print('YES')
	exit(0)
total = sum(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
max2 = 0 if arr[0] > arr[1] else 1
max1 = 1 - max2
for i in range(2, n):
	if arr[i] > arr[max1]:
		if arr[i] > arr[max2]:
			(max2, max1) = (i, max2)
		else:
			max1 = i
print('YES' if arr[max1] + arr[max2] >= total else 'NO')


input()
print('NO' if sum((a for a in map(int, input().split()))) > sum(sorted(map(int, input().split()))[-2:]) else 'YES')


def solve(n, a, b):
	r = sum(a)
	b.sort()
	return 'YES' if r <= sum(b[-2:]) else 'NO'

def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solve(n, a, b))
main()


n = int(input())
a = list(map(int, input().strip().split()[:n]))
b = list(map(int, input().strip().split()[:n]))
k = sum(a)
a1 = max(b)
b.remove(a1)
a2 = max(b)
if a1 + a2 >= k:
	print('YES')
else:
	print('NO')


x = int(input())
a = list(map(int, input().split()))
t = list(map(int, input().split()))
t.sort(reverse=True)
if t[0] + t[1] >= sum(a):
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b = sorted(b)
c = b[n - 1]
m = b[n - 2]
p = sum(a)
if m + c >= p:
	print('yes')
else:
	print('no')


n = int(input())
s = sum([int(x) for x in input().split()])
j = [int(x) for x in input().split()]
max1 = max(j)
j.remove(max1)
max2 = max(j)
if s <= max1 + max2:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
cola = sum(a)
b.sort()
b.reverse()
b0 = b[0]
b1 = b[1]
if b0 + b1 >= cola:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m1 = max(b)
b.remove(m1)
m2 = max(b)
r = 0
for i in a:
	r += i
if r <= m1 + m2:
	print('YES')
else:
	print('NO')


def solve(a, b):
	total = sum(a)
	largest = max(b)
	b.remove(largest)
	second_largest = max(b)
	return total <= largest + second_largest
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
print('YES' if solve(a, b) else 'NO')


n = int(input())
r = list(map(int, input().split()))
c = list(map(int, input().split()))
sr = sum(r)
z = sorted(c)
if z[n - 1] + z[n - 2] >= sr:
	print('YES')
else:
	print('NO')


n = int(input())
c = [int(x) for x in input().split()]
l = [int(y) for y in input().split()]
l.sort()
if l[-1] + l[-2] >= sum(c):
	print('YES')
else:
	print('NO')


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


bank = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
if sum(v) <= sum(sorted(c)[-2:]):
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
vol = 0
for i in range(n):
	vol = vol + a[i]
b.sort(reverse=True)
tot = b[0] + b[1]
if tot >= vol:
	print('YES')
else:
	print('NO')


r = lambda : map(int, input().split())
input()
v = sum(r())
cans = sum(sorted(list(r()))[-2:])
print(('NO', 'YES')[cans >= v])


n = int(input())

def solve():
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	v = max(b)
	b.remove(v)
	v += max(b)
	if sum(a) <= v:
		print('yes')
	else:
		print('no')
solve()


input()
c = list(map(int, input().split()))
b = list(map(int, input().split()))
bb = max(b)
b.remove(bb)
bb += max(b)
if sum(c) <= bb:
	print('YES')
else:
	print('NO')


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
c = sum(arr1)
cc = sorted(arr2, reverse=True)[:2]
if sum(cc) >= c:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
b = []
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m1 = max(b)
index = b.index(m1)
b[index] = 0
m2 = max(b)
s = sum(a)
if s <= m1 + m2:
	print('YES')
else:
	print('NO')


import itertools
from math import sqrt

def main():
	n = input()
	col = [int(v) for v in input().split()]
	vol = [int(v) for v in input().split()]
	if sum(col) <= sum(list(sorted(vol, reverse=True))[:2]):
		print('YES')
	else:
		print('NO')
main()


n = int(input())
ls1 = list(map(int, input().split()))
ls2 = list(map(int, input().split()))
sm = sum(ls1)
ls2.sort(reverse=True)
cap = ls2[0] + ls2[1]
if cap < sm:
	print('NO')
else:
	print('YES')


input()
a = lambda : list(map(int, input().split()))
print('YES' if sum(a()) <= sum(sorted(a())[-2:]) else 'NO')


n = int(input())
ans = 0
temp = n
q = input().split()
for obj in q:
	ans = ans + int(obj)
temp = n
maxx = maxxx = -999999999999
q = input().split()
for obj in q:
	test = int(obj)
	if maxx < test:
		if maxxx < maxx:
			maxxx = maxx
		maxx = test
	elif maxxx < test:
		maxxx = test
if ans <= maxx + maxxx:
	print('yes')
else:
	print('no')


n = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
a = sum(A)
(b1, b2) = (0, 0)
for b in B:
	if b > b1:
		b2 = b1
		b1 = b
	elif b > b2:
		b2 = b
if b1 + b2 >= a:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b = sorted(b)
d = b.pop()
e = b.pop()
c = [d, e]
print('YES' if sum(c) >= sum(a) else 'NO')


from heapq import nlargest
n = int(input())
s = sum(map(int, input().split()))
li = list(map(int, input().split()))
(m1, m2) = nlargest(2, li)
if m1 + m2 >= s:
	print('yes')
else:
	print('no')


n = int(input())
if n <= 2:
	print('YES')
else:
	listKola = list(map(int, input().split()))
	listMaks = list(map(int, input().split()))
	maksBanka1 = 0
	maksBanka2 = 0
	vsegoKoli = 0
	for i in range(0, n):
		vsegoKoli += listKola[i]
		if listMaks[i] > maksBanka2:
			if listMaks[i] > maksBanka1:
				maksBanka2 = maksBanka1
				maksBanka1 = listMaks[i]
			elif listMaks[i] <= maksBanka1:
				maksBanka2 = listMaks[i]
	if vsegoKoli <= maksBanka1 + maksBanka2:
		print('YES')
	else:
		print('NO')


kolvo_banok = input()
obiem_koly = input()
obiem_banok = input()

def search_max(a):
	maxx = int(a[0])
	index = 0
	for i in range(len(a)):
		if maxx < int(a[i]):
			maxx = int(a[i])
			index = i
	return index
obiem_banok = obiem_banok.split(' ')
obiem_koly = obiem_koly.split(' ')
index = search_max(obiem_banok)
max1 = int(obiem_banok[index])
del obiem_banok[index]
index = search_max(obiem_banok)
max2 = int(obiem_banok[index])
v = 0
for i in range(len(obiem_koly)):
	v = v + int(obiem_koly[i])
if max1 + max2 < v:
	print('NO')
else:
	print('YES')


n = int(input())
aa = list(map(int, input().split(' ')))
bb = list(map(int, input().split(' ')))
bb.sort()
bb.reverse()
if sum(aa) <= bb[0] + bb[1]:
	print('YES')
else:
	print('NO')


n = int(input())
if n <= 2:
	print('YES')
else:
	k = [int(x) for x in input().split(' ')]
	l = [int(x) for x in input().split(' ')]
	u = max(l)
	l.remove(u)
	w = max(l) + u
	v = sum(k)
	if w >= v:
		print('YES')
	else:
		print('NO')


n = int(input())
(volume, bs, bm) = (0, 0, 0)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for lol in range(n):
	volume += a[lol]
for lol in range(n):
	if b[lol] >= bm:
		bs = bm
		bm = b[lol]
	elif b[lol] >= bs:
		bs = b[lol]
if volume <= bs + bm:
	print('YES')
else:
	print('NO')


n = int(input())
if n == 2:
	print('YES')
	exit(0)
ain = input()
bin = input()
ain = [int(can) for can in ain.split()]
bin = [int(can) for can in bin.split()]
maxcpct = max(bin)
bin.remove(maxcpct)
maxcpct2 = max(bin)
bin.remove(maxcpct2)
if sum(ain) > maxcpct + maxcpct2:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m1 = max(b)
t = 0
c = []
for i in range(n):
	if b[i] == m1:
		t = i
		break
	else:
		c.append(b[i])
for j in range(t + 1, n):
	c.append(b[j])
m2 = max(c)
if sum(a) > m1 + m2:
	print('NO')
else:
	print('YES')


def canFill(cola_volumes, can_capacities):
	total_volume = sum(cola_volumes)
	can_capacities.sort()
	if total_volume <= can_capacities[-1] + can_capacities[-2]:
		return 'YES'
	return 'NO'
no_of_cans = int(input())
cola_volumes = list(map(int, input().split()))
can_capacities = list(map(int, input().split()))
print(canFill(cola_volumes, can_capacities))


from sys import stdin
n = int(stdin.readline())
A = [int(i) for i in stdin.readline().split(' ')]
B = [int(i) for i in stdin.readline().split(' ')]
ult = 0
pentult = 0
soda = 0
for i in range(0, n):
	soda += A[i]
	(ult, pentult) = [max(ult, pentult, B[i]), ult + pentult + B[i] - max(ult, pentult, B[i]) - min(ult, pentult, B[i])]
if ult + pentult >= soda:
	print('YES')
else:
	print('NO')


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


def main():
	n = int(input())
	volumes = list(map(int, input().split()))
	totalvolume = sum(volumes)
	capacities = list(map(int, input().split()))
	scapacities = sorted(capacities, reverse=True)
	if totalvolume <= scapacities[0] + scapacities[1]:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cola_total = sum(a)
espacios_ordenados = sorted(b)
espace_max = espacios_ordenados[-1] + espacios_ordenados[-2]
if cola_total <= espace_max:
	print('YES')
else:
	print('NO')