Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a_1 × b_1 rectangle, the paintings have shape of a a_2 × b_2 and a_3 × b_3 rectangles.

Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?


-----Input-----

The first line contains two space-separated numbers a_1 and b_1 — the sides of the board. Next two lines contain numbers a_2, b_2, a_3 and b_3 — the sides of the paintings. All numbers a_{i}, b_{i} in the input are integers and fit into the range from 1 to 1000.


-----Output-----

If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).


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

Output
YES

Input
5 5
3 3
3 3

Output
NO

Input
4 2
2 3
1 2

Output
YES



-----Note-----

That's how we can place the pictures in the first test:

[Image]

And that's how we can do it in the third one.

[Image]

Difficulty: EASY
Tags: Implementation

Constructive algorithms

Starter code:

Solutions:
(n, m) = map(int, input().split())

def f(r1, c1, r2, c2):
	return r1 + r2 <= n and max(c1, c2) <= m or (max(r1, r2) <= n and c1 + c2 <= m)
(r1, c1) = map(int, input().split())
(r2, c2) = map(int, input().split())
print('YES' if f(r1, c1, r2, c2) or f(r1, c1, c2, r2) or f(c1, r1, r2, c2) or f(c1, r1, c2, r2) else 'NO')


(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
for (A1, B1) in [(a1, b1), (b1, a1)]:
	for (A2, B2) in [(a2, b2), (b2, a2)]:
		for (A3, B3) in [(a3, b3), (b3, a3)]:
			if A2 + A3 <= A1 and max(B2, B3) <= B1:
				print('YES')
				exit()
print('NO')


import sys

def is_ok(a1, b1, a2, b2, a3, b3, step):
	if step == 1:
		return is_ok(a1, b1, a2, b2, a3, b3, step + 1) or is_ok(a1, b1, a2, b2, b3, a3, step + 1)
	elif step == 2:
		return is_ok(a1, b1, a2, b2, a3, b3, step + 1) or is_ok(a1, b1, b2, a2, a3, b3, step + 1)
	if a1 >= a2 + a3 and b1 >= max(b2, b3):
		return True
	if b1 >= b2 + b3 and a1 >= max(a2, a3):
		return True
	return False
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
print('YES' if is_ok(a1, b1, a2, b2, a3, b3, 1) else 'NO')


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
q1 = max(c, e)
q2 = d + f
q3 = max(d, f)
q4 = c + e
q5 = c + f
q6 = max(d, e)
q7 = d + e
q8 = max(c, f)
if q1 <= a and q2 <= b or (q2 <= a and q1 <= b) or (q3 <= a and q4 <= b) or (q4 <= a and q3 <= b) or (q7 <= a and q8 <= b) or (q8 <= a and q7 <= b) or (q5 <= a and q6 <= b) or (q6 <= a and q5 <= b):
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
for i in range(2):
	for j in range(2):
		if min(b[i] + c[j], max(b[1 - i], c[1 - j])) <= a[0] and max((b[i] + c[j], max(b[1 - i], c[1 - j]))) <= a[1]:
			print('YES')
			return
print('NO')


from sys import stdin
from collections import deque
import sys
from copy import deepcopy
import math
(a1, b1) = list(map(int, stdin.readline().split()))
if a1 > b1:
	(a1, b1) = (b1, a1)
(a2, b2) = list(map(int, stdin.readline().split()))
if a2 > b2:
	(a2, b2) = (b2, a2)
(a3, b3) = list(map(int, stdin.readline().split()))
if a3 > b3:
	(a3, b3) = (b3, a3)
if a2 <= a1 and b2 <= b1:
	(a11, b11) = (a1 - a2, b1)
	(a12, b12) = (a1, b1 - b2)
	if a3 <= a11 and b3 <= b11 or (a3 <= a12 and b3 <= b12):
		print('YES')
		exit()
	(a3, b3) = (b3, a3)
	if a3 <= a11 and b3 <= b11 or (a3 <= a12 and b3 <= b12):
		print('YES')
		exit()
	(a3, b3) = (b3, a3)
(a2, b2) = (b2, a2)
if a2 <= a1 and b2 <= b1:
	(a11, b11) = (a1 - a2, b1)
	(a12, b12) = (a1, b1 - b2)
	if a3 <= a11 and b3 <= b11 or (a3 <= a12 and b3 <= b12):
		print('YES')
		exit()
	(a3, b3) = (b3, a3)
	if a3 <= a11 and b3 <= b11 or (a3 <= a12 and b3 <= b12):
		print('YES')
		exit()
	(a3, b3) = (b3, a3)
print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
for a in [a2, b2]:
	b = a2 + b2 - a
	for c in [a3, b3]:
		d = a3 + b3 - c
		for x in [a1, b1]:
			y = a1 + b1 - x
			if a + c <= x and max(b, d) <= y:
				print('YES')
				exit()
print('NO')


check = lambda aX, aY, bX, bY, cX, cY: bX + cX <= aX and max(bY, cY) <= aY
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if check(x1, y1, x2, y2, x3, y3) or check(y1, x1, x2, y2, x3, y3) or check(x1, y1, y2, x2, x3, y3) or check(y1, x1, y2, x2, x3, y3) or check(x1, y1, x2, y2, y3, x3) or check(y1, x1, x2, y2, y3, x3) or check(x1, y1, y2, x2, y3, x3) or check(y1, x1, y2, x2, y3, x3):
	print('YES')
else:
	print('NO')


a = [0, 0]
b = [0, 0]
x = 0
y = 0
(x, y) = map(int, input().split())
(a[0], a[1]) = map(int, input().split())
(b[0], b[1]) = map(int, input().split())
flag = False
for i in range(0, 2):
	for j in range(0, 2):
		x1 = a[i] + b[j]
		y1 = max(a[1 - i], b[1 - j])
		if x1 <= x and y1 <= y or (x1 <= y and y1 <= x):
			flag = True
			break
	if flag:
		break
if flag:
	print('YES')
else:
	print('NO')


def fitVertical(A, B):
	if B[0] <= A[0] and B[1] <= A[1]:
		return [A[0] - B[0], A[1] - B[1]]
	return [-1, -1]

def fitHorizontal(A, B):
	if B[1] <= A[0] and B[0] <= A[1]:
		return [A[0] - B[1], A[1] - B[0]]
	return [-1, -1]
A = input().split()
B = input().split()
C = input().split()
A = [int(x) for x in A]
B = [int(x) for x in B]
C = [int(x) for x in C]
D = fitVertical(A, B)
if D[0] != -1:
	if fitVertical([D[0], A[1]], C)[0] != -1 or fitHorizontal([D[0], A[1]], C)[0] != -1:
		print('YES')
		return
	if fitVertical([D[1], A[0]], C)[0] != -1 or fitHorizontal([D[1], A[0]], C)[0] != -1:
		print('YES')
		return
D = fitHorizontal(A, B)
if D[0] != -1:
	if fitVertical([D[0], A[1]], C)[0] != -1 or fitHorizontal([D[0], A[1]], C)[0] != -1:
		print('YES')
		return
	if fitVertical([D[1], A[0]], C)[0] != -1 or fitHorizontal([D[1], A[0]], C)[0] != -1:
		print('YES')
		return
print('NO')


(x, y) = map(int, input().split())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
if a + c <= x and max(b, d) <= y:
	print('YES')
	exit(0)
elif b + d <= y and max(a, c) <= x:
	print('YES')
	exit(0)
(a, b) = (b, a)
if a + c <= x and max(b, d) <= y:
	print('YES')
	exit(0)
elif b + d <= y and max(a, c) <= x:
	print('YES')
	exit(0)
(a, b) = (b, a)
(c, d) = (d, c)
if a + c <= x and max(b, d) <= y:
	print('YES')
	exit(0)
elif b + d <= y and max(a, c) <= x:
	print('YES')
	exit(0)
(a, b) = (b, a)
if a + c <= x and max(b, d) <= y:
	print('YES')
	exit(0)
elif b + d <= y and max(a, c) <= x:
	print('YES')
	exit(0)
else:
	print('NO')
	exit(0)


(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
if a1 >= a2 + a3 and b1 >= max(b2, b3):
	print('YES')
elif a1 >= a2 + b3 and b1 >= max(b2, a3):
	print('YES')
elif a1 >= b2 + a3 and b1 >= max(a2, b3):
	print('YES')
elif a1 >= b2 + b3 and b1 >= max(a2, a3):
	print('YES')
elif b1 >= a2 + a3 and a1 >= max(b2, b3):
	print('YES')
elif b1 >= a2 + b3 and a1 >= max(b2, a3):
	print('YES')
elif b1 >= b2 + a3 and a1 >= max(a2, b3):
	print('YES')
elif b1 >= b2 + b3 and a1 >= max(a2, a3):
	print('YES')
else:
	print('NO')


A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
flag = False
for i in A:
	for j in B:
		for x in C:
			if j + x <= i and sum(B) - j <= sum(A) - i and (sum(C) - x <= sum(A) - i):
				flag = True
print('YES' if flag else 'NO')


def solve(cnt, f1, f2, f3, nowx, nowy, cur):
	if nowx < 0 or nowy < 0 or cur < 0:
		return False
	if f1 == 1 and f2 == 1 and (f3 == 1):
		return True
	else:
		if f1 != 1:
			return solve(cnt + 1, 1, 0, 0, a, b, cur) or solve(cnt + 1, 1, 0, 0, b, a, cur)
		if f2 != 1:
			return solve(cnt + 1, 1, 1, 0, nowx - a1, nowy, nowy - b1) or solve(cnt + 1, 1, 1, 0, nowx - b1, nowy, nowy - a1)
		if f3 != 1:
			return solve(cnt + 1, 1, 1, 1, nowx - a2, nowy, nowy - b2) or solve(cnt + 1, 1, 1, 1, nowx - b2, nowy, nowy - a2)
(a, b) = map(int, input().split())
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
if solve(0, 0, 0, 0, 0, 0, 0):
	print('YES')
else:
	print('NO')


from sys import stdin
(a1, b1) = map(int, stdin.readline().split())
(a2, b2) = map(int, stdin.readline().split())
(a3, b3) = map(int, stdin.readline().split())
a = []
a.append((a2 + b3, max(a3, b2)))
a.append((b2 + b3, max(a2, a3)))
a.append((a3 + a2, max(b2, b3)))
a.append((a3 + b2, max(a2, b3)))
for i in a:
	if max(a1, b1) >= max(i[0], i[1]) and min(a1, b1) >= min(i[0], i[1]):
		print('YES')
		exit()
print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
if a1 > b1:
	a1 = a1 + b1
	b1 = a1 - b1
	a1 = a1 - b1
if a2 > b2:
	a2 = a2 + b2
	b2 = a2 - b2
	a2 = a2 - b2
if a3 > b3:
	a3 = a3 + b3
	b3 = a3 - b3
	a3 = a3 - b3
if b2 > b1 or b3 > b1:
	print('No')
elif a2 + a3 <= a1:
	print('Yes')
elif a2 <= a1 and a3 <= a1 and (b2 + b3 <= b1):
	print('Yes')
elif a3 <= a1 and b2 <= a1 and (a2 + b3 <= b1):
	print('Yes')
elif a2 <= a1 and b3 <= a1 and (b2 + a3 <= b1):
	print('Yes')
elif b2 <= a1 and b3 <= a1 and (a2 + a3 <= b1):
	print('Yes')
else:
	print('No')


(x, y) = map(int, input().split())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())

def solve():
	for (X, Y) in [(x, y), (y, x)]:
		for (A, B) in [(a, b), (b, a)]:
			for (C, D) in [(c, d), (d, c)]:
				if A + C <= X and max(B, D) <= Y:
					return 'YES'
	return 'NO'
print(solve())


I = lambda : list(map(int, input().split()))
q = I()
w = I()
e = I()
print(['NO', 'YES'][any((a + c <= x and y >= max(b, d) for (x, y) in (q, q[::-1]) for (a, b) in (w, w[::-1]) for (c, d) in (e, e[::-1])))])


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))

def fn(x, y, p, q):
	if y + q <= b and max(x, p) <= l:
		return True
	if x + p <= l and max(y, q) <= b:
		return True
	return False
for _ in range(1):
	(l, b) = lst()
	(l1, b1) = lst()
	(l2, b2) = lst()
	if fn(l1, b1, l2, b2) or fn(b1, l1, l2, b2) or fn(l1, b1, b2, l2) or fn(b1, l1, b2, l2):
		print('YES')
	else:
		print('NO')


(a, b) = [int(i) for i in input().split(' ')]
(p1, p2) = [int(i) for i in input().split(' ')]
(q1, q2) = [int(i) for i in input().split(' ')]
(pp1, qq1) = (p1 + q1, max(p2, q2))
(pp2, qq2) = (p1 + q2, max(p2, q1))
(pp3, qq3) = (p2 + q1, max(p1, q2))
(pp4, qq4) = (p2 + q2, max(p1, q1))
(pp1, qq1) = (min(pp1, qq1), max(pp1, qq1))
(pp2, qq2) = (min(pp2, qq2), max(pp2, qq2))
(pp3, qq3) = (min(pp3, qq3), max(pp3, qq3))
(pp4, qq4) = (min(pp4, qq4), max(pp4, qq4))
(a, b) = (min(a, b), max(a, b))
if a - pp1 >= 0 and b - qq1 >= 0 or (a - pp2 >= 0 and b - qq2 >= 0) or (a - pp3 >= 0 and b - qq3 >= 0) or (a - pp4 >= 0 and b - qq4 >= 0):
	print('YES')
else:
	print('NO')


import os, io
from sys import stdout
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def binomial_coefficient(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def powerOfK(k, max):
	if k == 1:
		return [1]
	if k == -1:
		return [-1, 1]
	result = []
	n = 1
	while n <= max:
		result.append(n)
		n *= k
	return result

def divisors(n):
	i = 1
	result = []
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				result.append(i)
			else:
				result.append(i)
				result.append(n / i)
		i += 1
	return result

def digitsSum(n):
	if n == 0:
		return 0
	r = 0
	while n > 0:
		r += n % 10
		n //= 10
	return r

def isValid(i, j, n, m):
	return i >= 0 and i < n and (j >= 0) and (j < m)

def print_grid(grid):
	for line in grid:
		print(' '.join(map(str, line)))

def kadane(a, size):
	max_so_far = 0
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def prefixSum(arr):
	for i in range(1, len(arr)):
		arr[i] = arr[i] + arr[i - 1]
	return arr

def ceil(n, d):
	if n % d == 0:
		return n // d
	else:
		return n // d + 1

def getnumb(target):
	r = set()
	for i in range(1, target // 2 + 1):
		r.add(i)
		r.add(target - i)
	return r
(a, b) = list(map(int, input().split()))
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
if min(x1, y1) + min(x2, y2) > max(a, b):
	print('NO')
else:
	if x1 + x2 <= min(a, b):
		if max(y1, y2) <= max(a, b):
			print('YES')
			exit()
	if x1 + x2 <= max(a, b):
		if max(y1, y2) <= min(a, b):
			print('YES')
			exit()
	if x1 + y2 <= min(a, b):
		if max(y1, x2) <= max(a, b):
			print('YES')
			exit()
	if x1 + y2 <= max(a, b):
		if max(y1, x2) <= min(a, b):
			print('YES')
			exit()
	if y1 + x2 <= min(a, b):
		if max(x1, y2) <= max(a, b):
			print('YES')
			exit()
	if y1 + x2 <= max(a, b):
		if max(x1, y2) <= min(a, b):
			print('YES')
			exit()
	if y1 + y2 <= min(a, b):
		if max(x1, x2) <= max(a, b):
			print('YES')
			exit()
	if y1 + y2 <= max(a, b):
		if max(x1, x2) <= min(a, b):
			print('YES')
			exit()
	print('NO')


(a, b) = map(int, input().split())
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
flag = False
x = a1 + a2
bigger = max([b1, b2])
if x <= a:
	if bigger <= b:
		flag = True
if x <= b:
	if bigger <= a:
		flag = True
x = a1 + b2
bigger = max([b1, a1])
if x <= a:
	if bigger <= b:
		flag = True
if x <= b:
	if bigger <= a:
		flag = True
x = b1 + b2
bigger = max([a1, a2])
if x <= a:
	if bigger <= b:
		flag = True
if x <= b:
	if bigger <= a:
		flag = True
x = b1 + a2
bigger = max([a1, b2])
if x <= a:
	if bigger <= b:
		flag = True
if x <= b:
	if bigger <= a:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
c1 = a1 - a2
c2 = b1 - b2
if c1 >= 0 and c2 >= 0:
	ans = [0, 0, 0, 0]
	ans[0] = 1 if c1 - a3 >= 0 and b1 - b3 >= 0 else 0
	ans[1] = 1 if c1 - b3 >= 0 and b1 - a3 >= 0 else 0
	ans[2] = 1 if a1 - a3 >= 0 and c2 - b3 >= 0 else 0
	ans[3] = 1 if a1 - b3 >= 0 and c2 - a3 >= 0 else 0
	if sum(ans) > 0:
		print('YES')
		exit(0)
d1 = a1 - b2
d2 = b1 - a2
if d1 >= 0 and d2 >= 0:
	ans = [0, 0, 0, 0]
	ans[0] = 1 if d1 - a3 >= 0 and b1 - b3 >= 0 else 0
	ans[1] = 1 if d1 - b3 >= 0 and b1 - a3 >= 0 else 0
	ans[2] = 1 if a1 - a3 >= 0 and d2 - b3 >= 0 else 0
	ans[3] = 1 if a1 - b3 >= 0 and d2 - a3 >= 0 else 0
	if sum(ans) > 0:
		print('YES')
		exit(0)
print('NO')


(a, b) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
check = 0
if a >= a2 and b >= b2:
	h1 = a - a2
	h2 = b - b2
	if h2 >= b3 and a >= a3 or (h2 >= a3 and a >= b3) or (h1 >= a3 and b >= b3) or (h1 >= b3 and b >= a3):
		check = 1
if a >= b2 and b >= a2:
	h1 = a - b2
	h2 = b - a2
	if h2 >= b3 and a >= a3 or (h2 >= a3 and a >= b3) or (h1 >= a3 and b >= b3) or (h1 >= b3 and b >= a3):
		check = 1
if check == 1:
	print('YES')
else:
	print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
good = 0
if a2 + a3 <= a1:
	if b1 >= b2 and b1 >= b3:
		good = 1
if a2 + b3 <= a1:
	if b1 >= a3 and b1 >= b2:
		good = 1
if b2 + a3 <= a1:
	if b1 >= b3 and b1 >= a2:
		good = 1
if b2 + b3 <= a1:
	if b1 >= a2 and b1 >= a3:
		good = 1
if a2 + a3 <= b1:
	if a1 >= b2 and a1 >= b3:
		good = 1
if a2 + b3 <= b1:
	if a1 >= a3 and a1 >= b2:
		good = 1
if b2 + a3 <= b1:
	if a1 >= b3 and a1 >= a2:
		good = 1
if b2 + b3 <= b1:
	if a1 >= a2 and a1 >= a3:
		good = 1
print('YES' if good else 'NO')


def check1(l1: list, l2: list, l3: list) -> bool:
	if l2[0] + l3[0] <= min(l1):
		if max(l2[1], l3[1]) <= max(l1):
			return True
		else:
			return False
	elif min(l1) < l2[0] + l3[0] <= max(l1):
		if max(l2[1], l3[1]) <= min(l1):
			return True
		else:
			return False
	return False

def check2(l1: list, l2: list, l3: list) -> bool:
	if l2[0] + l3[1] <= min(l1):
		if max(l2[1], l3[0]) <= max(l1):
			return True
		else:
			return False
	elif min(l1) < l2[0] + l3[1] <= max(l1):
		if max(l2[1], l3[0]) <= min(l1):
			return True
		else:
			return False
	return False

def check3(l1: list, l2: list, l3: list) -> bool:
	if l2[1] + l3[0] <= min(l1):
		if max(l2[0], l3[1]) <= max(l1):
			return True
		else:
			return False
	elif min(l1) < l2[1] + l3[0] <= max(l1):
		if max(l2[0], l3[1]) <= min(l1):
			return True
		else:
			return False
	return False

def check4(l1: list, l2: list, l3: list) -> bool:
	if l2[1] + l3[1] <= min(l1):
		if max(l2[0], l3[0]) <= max(l1):
			return True
		else:
			return False
	elif min(l1) < l2[1] + l3[1] <= max(l1):
		if max(l2[0], l3[0]) <= min(l1):
			return True
		else:
			return False
	return False
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
if a[0] * a[1] < b[0] * b[1] + c[0] * c[1]:
	print('NO')
elif check1(a, b, c) or check2(a, b, c) or check3(a, b, c) or check4(a, b, c):
	print('YES')
else:
	print('NO')


def Check(a2, b2, a3, b3):
	if a1 >= a2 + a3 and b1 >= max(b2, b3) or (a1 >= max(a2, a3) and b1 >= b2 + b3):
		return True
	else:
		return False
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
(a1, b1) = (min(a1, b1), max(a1, b1))
(a2, b2) = (min(a2, b2), max(a2, b2))
(a3, b3) = (min(a3, b3), max(a3, b3))
r = Check(a2, b2, a3, b3) or Check(a2, b2, b3, a3) or Check(b2, a2, a3, b3) or Check(b2, a2, b3, a3)
if r:
	print('YES')
else:
	print('NO')


def other(arr, a):
	return arr[(a + 1) % 2]
main = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
case = False
m = 1
for i in range(2):
	if m:
		for j in range(2):
			for k in range(2):
				if a[j] + b[k] <= main[i] and other(a, j) <= other(main, i) and (other(b, k) <= other(main, i)):
					case = True
					m = 0
					break
if case:
	print('YES')
else:
	print('NO')


l = []
for i in range(3):
	l += input().split(' ')
for i in range(len(l)):
	l[i] = int(l[i])
left = [l[i] + l[j] for i in (2, 3) for j in (4, 5)]
right = [max(l[i], l[j]) for i in (3, 2) for j in (5, 4)]
tuples = []
for i in range(4):
	tuples.append((left[i], right[i]))
for t in tuples:
	if t[0] <= l[0] and t[1] <= l[1] or (t[0] <= l[1] and t[1] <= l[0]):
		print('YES')
		exit()
print('NO')


I = lambda : [*map(int, input().split())]
(z, u, v) = (I(), I(), I())
r = 0
for (x, y) in (z, z[::-1]):
	for (a, b) in (u, u[::-1]):
		for (c, d) in (v, v[::-1]):
			r |= a + c <= x and max(b, d) <= y
print('YNEOS'[1 - r::2])


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

def fn(a, b, c):
	flag = False
	for i in range(2):
		for j in range(2):
			for k in range(2):
				if a[i] >= b[j] + c[k] and max(b[1 - j], c[1 - k]) <= a[1 - i]:
					flag = True
					return 'YES'
	if flag == False:
		return 'NO'
print(fn(a, b, c))


(x, y) = map(int, input().split(' '))
(a2, b2) = map(int, input().split(' '))
(a3, b3) = map(int, input().split(' '))
if x >= a2 + a3 and y >= b2 and (y >= b3) or (x >= b2 + b3 and y >= a2 and (y >= a3)) or (x >= a2 + b3 and y >= a3 and (y >= b2)) or (x >= a3 + b2 and y >= a2 and (y >= b3)) or (y >= a2 + a3 and x >= b2 and (x >= b3)) or (y >= b2 + b3 and x >= a2 and (x >= a3)) or (y >= a2 + b3 and x >= a3 and (x >= b2)) or (y >= a3 + b2 and x >= a2 and (x >= b3)):
	print('YES')
else:
	print('NO')


c = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
s = False
for i in range(2):
	for j in range(2):
		for k in range(2):
			if c[i] >= a[j] + b[k] and c[i - 1] >= a[j - 1] and (c[i - 1] >= b[k - 1]):
				s = True
				print('YES')
				break
		if s == True:
			break
	if s == True:
		break
if s == False:
	print('NO')


board = input().split()
for i in range(len(board)):
	board[i] = int(board[i])
boardmin = min(board)
boardmax = max(board)
dimone = input().split()
for i in range(len(dimone)):
	dimone[i] = int(dimone[i])
dimtwo = input().split()
for i in range(len(dimtwo)):
	dimtwo[i] = int(dimtwo[i])
minone = min(dimone)
maxone = max(dimone)
mintwo = min(dimtwo)
maxtwo = max(dimtwo)
tempone = minone + mintwo
temptwo = max(maxone, maxtwo)
ansmin = min(tempone, temptwo)
ansmax = max(tempone, temptwo)
if boardmin >= ansmin and boardmax >= ansmax:
	print('YES')
else:
	tempone = minone + maxtwo
	temptwo = max(maxone, mintwo)
	ansmin = min(tempone, temptwo)
	ansmax = max(tempone, temptwo)
	if boardmin >= ansmin and boardmax >= ansmax:
		print('YES')
	else:
		tempone = maxone + mintwo
		temptwo = max(minone, maxtwo)
		ansmin = min(tempone, temptwo)
		ansmax = max(tempone, temptwo)
		if boardmin >= ansmin and boardmax >= ansmax:
			print('YES')
		else:
			tempone = maxone + maxtwo
			temptwo = max(minone, mintwo)
			ansmin = min(tempone, temptwo)
			ansmax = max(tempone, temptwo)
			if boardmin >= ansmin and boardmax >= ansmax:
				print('YES')
			else:
				print('NO')


(n, m) = map(int, input().split())
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
ar1 = n * m
ar2 = a1 * b1 + a2 * b2
a = a1 + a2
b = a1 + b2
c = a2 + b1
d = b1 + b2
t = 1

def fu(su, q, w, n, m):
	t = 1
	mi = min(n, m)
	ma = max(n, m)
	if su <= mi:
		if q <= ma and w <= ma:
			return t
		else:
			t = 0
			return t
	elif su <= ma:
		if q <= mi and w <= mi:
			return t
		else:
			t = 0
			return t
	else:
		t = 0
		return t
z1 = fu(a, b1, b2, n, m)
z2 = fu(b, b1, a2, n, m)
z3 = fu(c, a1, b2, n, m)
z4 = fu(d, a1, a2, n, m)
if (z1 == 1 or z2 == 1 or z3 == 1 or (z4 == 1)) and ar1 >= ar2:
	print('YES')
else:
	print('NO')


import unittest
import sys

class Art:

	def __init__(self, args):
		(self.numa, self.numb) = args
		self.r = self.rect(self.numa[0], self.numb[0])
		self.rmax = self.rect(self.numa[1], self.numb[1])
		self.rmin = self.rect(self.numa[2], self.numb[2])
		if self.rmax[0] < self.rmax[1]:
			(self.rmax, self.rmin) = (self.rmin, self.rmax)
		self.remain = []
		if self.rmax[0] < self.r[0] and self.rmax[1] <= self.r[1]:
			self.remain.append((self.r[0] - self.rmax[0], self.r[1]))
		if self.rmax[1] < self.r[1] and self.rmax[0] <= self.r[0]:
			self.remain.append((self.r[0], self.r[1] - self.rmax[1]))
		if self.rmax[1] < self.r[0] and self.rmax[0] <= self.r[1]:
			self.remain.append((self.r[0] - self.rmax[1], self.r[1]))
		if self.rmax[0] < self.r[1] and self.rmax[1] <= self.r[0]:
			self.remain.append((self.r[0], self.r[1] - self.rmax[0]))

	def rect(self, a, b):
		if a > b:
			return (a, b)
		else:
			return (b, a)

	def calculate(self):
		for rec in self.remain:
			if self.rmin[0] <= rec[0] and self.rmin[1] <= rec[1]:
				return 'YES'
			if self.rmin[1] <= rec[0] and self.rmin[0] <= rec[1]:
				return 'YES'
		return 'NO'

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

	def uinput():
		if it:
			return next(it)
		else:
			return sys.stdin.readline()
	imax = 3
	numnums = list(map(int, ' '.join((uinput() for i in range(imax))).split()))
	numa = []
	numb = []
	for i in range(0, 2 * imax, 2):
		numa.append(numnums[i])
		numb.append(numnums[i + 1])
	return [numa, numb]

def calculate(test_inputs=None):
	return Art(get_inputs(test_inputs)).calculate()

class unitTests(unittest.TestCase):

	def test_Art_class__basic_functions(self):
		d = Art([[3, 1, 2], [2, 3, 1]])
		self.assertEqual(d.numa[0], 3)
		self.assertEqual(d.r, (3, 2))
		self.assertEqual(d.rmax, (3, 1))
		self.assertEqual(d.rmin, (2, 1))
		self.assertEqual(d.remain, [(3, 1)])

	def test_sample_tests(self):
		test = '3 2\n1 3\n2 1'
		self.assertEqual(calculate(test), 'YES')
		self.assertEqual(list(get_inputs(test)[0]), [3, 1, 2])
		self.assertEqual(list(get_inputs(test)[1]), [2, 3, 1])
		test = '5 5\n3 3\n3 3'
		self.assertEqual(calculate(test), 'NO')
		test = '4 2\n2 3\n1 2'
		self.assertEqual(calculate(test), 'YES')
		test = '5 5\n1 5\n1 5'
		self.assertEqual(calculate(test), 'YES')

	def test_time_limit_test(self):
		import random
		test = '1000 1000'
		test += '\n900 900'
		test += '\n50 50'
		import timeit
		start = timeit.default_timer()
		args = get_inputs(test)
		init = timeit.default_timer()
		d = Art(args)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTime Test: ' + '{0:.3f}s (inp {1:.3f}s init {2:.3f}s calc {3:.3f}s)'.format(stop - start, init - start, calc - init, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(calculate())


import sys

def perm(x, y):
	yield (x, y)
	yield (y, x)

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

def solve(a1, b1, a2, b2, a3, b3):
	for (side1, rem1) in perm(a1, b1):
		for (side2, rem2) in perm(a2, b2):
			for (side3, rem3) in perm(a3, b3):
				if side1 >= side2 + side3 and rem1 >= rem2 and (rem1 >= rem3):
					return True
	return False

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

def main():
	xs = [int(s) for _ in range(3) for s in input().strip().split()]
	result = tf_to_yn(solve(*xs))
	print(result)
main()


(a, b) = (int(x) for x in input().split())
(a1, b1) = (int(x) for x in input().split())
(a2, b2) = (int(x) for x in input().split())
if max(a1, a2) <= a and b1 + b2 <= b or (max(a1, a2) <= b and b1 + b2 <= a) or (max(b1, b2) <= a and a1 + a2 <= b) or (max(b1, b2) <= b and a1 + a2 <= a) or (max(b1, a2) <= a and b2 + a1 <= b) or (max(b1, a2) <= b and b2 + a1 <= a) or (max(b2, a1) <= a and b1 + a2 <= b) or (max(b2, a1) <= b and b1 + a2 <= a):
	print('YES')
else:
	print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
n2 = [a2, b2]
n3 = [a3, b3]
l = []
for d2 in range(2):
	for d3 in range(2):
		l.append([n2[d2] + n3[d3], max(n2[d2 - 1], n3[d3 - 1])])

def c(l, a1, b1):
	a = False
	for i in l:
		if a1 >= i[0] and b1 >= i[1]:
			a = True
	return a
z = c(l, a1, b1) or c(l, b1, a1)
print('YES' if z else 'NO')


(a, b) = map(int, input().split())
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
if x1 * y1 + x2 * y2 > a * b:
	print('NO')
elif x1 + x2 <= a and max(y1, y2) <= b or (y1 + y2 <= a and max(x1, x2) <= b):
	print('YES')
elif x1 + x2 <= b and max(y1, y2) <= a or (y1 + y2 <= b and max(x1, x2) <= a):
	print('YES')
elif x1 + y2 <= a and max(x2, y1) <= b or (x2 + y1 <= a and max(x1, y2) <= b):
	print('YES')
elif x1 + y2 <= b and max(x2, y1) <= a or (x2 + y1 <= b and max(x1, y2) <= a):
	print('YES')
else:
	print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
if a2 + b3 <= b1:
	if max(a3, b2) <= a1:
		print('YES')
		exit()
if a2 + b3 <= a1:
	if max(a3, b2) <= b1:
		print('YES')
		exit()
if a2 + a3 <= b1:
	if max(b2, b3) <= a1:
		print('YES')
		exit()
if a2 + a3 <= a1:
	if max(b2, b3) <= b1:
		print('YES')
		exit()
if b2 + a3 <= a1:
	if max(a2, b3) <= b1:
		print('YES')
		exit()
if b2 + a3 <= b1:
	if max(a2, b3) <= a1:
		print('YES')
		exit()
if b2 + b3 <= a1:
	if max(a2, a3) <= b1:
		print('YES')
		exit()
if b2 + b3 <= b1:
	if max(a2, a3) <= a1:
		print('YES')
		exit()
print('NO')


(n, m) = [int(x) for x in input().split()]
(n, m) = sorted([n, m])
(x1, y1) = [int(x) for x in input().split()]
(x2, y2) = [int(x) for x in input().split()]
if y1 + y2 <= m and max(x1, x2) <= n:
	print('YES')
elif max(y1, y2) <= m and x1 + x2 <= n:
	print('YES')
elif y1 + x2 <= m and max(x1, y2) <= n:
	print('YES')
elif max(y1, x2) <= m and x1 + y2 <= n:
	print('YES')
elif x1 + y2 <= m and max(y1, x2) <= n:
	print('YES')
elif max(x1, y2) <= m and y1 + x2 <= n:
	print('YES')
elif y1 + y2 <= n and max(x1, x2) <= m:
	print('YES')
elif max(y1, y2) <= n and x1 + x2 <= m:
	print('YES')
else:
	print('NO')


(a, b) = [int(i) for i in input().split()]
(c, d) = [int(i) for i in input().split()]
(e, f) = [int(i) for i in input().split()]
if c + e <= a and max(d, f) <= b:
	print('YES')
elif c + e <= b and max(d, f) <= a:
	print('YES')
elif c + f <= a and max(d, e) <= b:
	print('YES')
elif c + f <= b and max(d, e) <= a:
	print('YES')
elif d + e <= a and max(c, f) <= b:
	print('YES')
elif d + e <= b and max(c, f) <= a:
	print('YES')
elif d + f <= a and max(c, e) <= b:
	print('YES')
elif d + f <= b and max(c, e) <= a:
	print('YES')
else:
	print('NO')


b = [int(x) for x in input().split()]
d1 = [int(x) for x in input().split()]
d2 = [int(x) for x in input().split()]

def check(a1, a2):
	if max(d1[0], d2[0]) <= a1 and d1[1] + d2[1] <= a2:
		return 1
	if max(d1[1], d2[0]) <= a1 and d1[0] + d2[1] <= a2:
		return 1
	if max(d1[1], d2[1]) <= a1 and d1[0] + d2[0] <= a2:
		return 1
	if max(d1[0], d2[1]) <= a1 and d1[1] + d2[0] <= a2:
		return 1
	return 0
if check(b[0], b[1]) or check(b[1], b[0]):
	print('YES')
else:
	print('NO')


def check(a1, b1, a2, b2, a3, b3):
	if a2 + a3 <= a1 and b2 <= b1 and (b3 <= b1):
		return True
	if b2 + b3 <= b1 and a2 <= a1 and (a3 <= a1):
		return True
	return False

def __starting_point():
	(a1, b1) = map(int, input().split())
	(a2, b2) = map(int, input().split())
	(a3, b3) = map(int, input().split())
	if check(a1, b1, a2, b2, a3, b3) or check(a1, b1, b2, a2, a3, b3) or check(a1, b1, a2, b2, b3, a3) or check(a1, b1, b2, a2, b3, a3):
		print('YES')
	else:
		print('NO')
__starting_point()


(n, m) = [int(i) for i in input().split()]
(a, b) = [int(i) for i in input().split()]
(c, d) = [int(i) for i in input().split()]
if a + c <= n and max(b, d) <= m:
	print('YES')
elif a + c <= m and max(b, d) <= n:
	print('YES')
elif a + d <= m and max(b, c) <= n:
	print('YES')
elif a + d <= n and max(b, c) <= m:
	print('YES')
elif b + c <= m and max(a, d) <= n:
	print('YES')
elif b + c <= n and max(a, d) <= m:
	print('YES')
elif b + d <= m and max(a, c) <= n:
	print('YES')
elif b + d <= n and max(a, c) <= m:
	print('YES')
else:
	print('NO')


def check(x, y, a, b):
	return x - a >= 0 and y - b >= 0
(a1, b1) = [int(x) for x in input().split()]
(a2, b2) = [int(x) for x in input().split()]
(a3, b3) = [int(x) for x in input().split()]
if check(a1, b1, a3, b3):
	if check(a1 - a3, b1, a2, b2) or check(a1 - a3, b1, b2, a2) or check(a1, b1 - b3, a2, b2) or check(a1, b1 - b3, b2, a2):
		print('YES')
	elif check(a1, b1, b3, a3):
		if check(a1, b1 - a3, a2, b2) or check(a1, b1 - a3, b2, a2) or check(a1 - b3, b1, a2, b2) or check(a1 - b3, b1, b2, a2):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
elif check(a1, b1, b3, a3):
	if check(a1, b1 - a3, a2, b2) or check(a1, b1 - a3, b2, a2) or check(a1 - b3, b1, a2, b2) or check(a1 - b3, b1, b2, a2):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def main():
	liste = []
	(a, b) = map(int, input().split())
	(a1, b1) = map(int, input().split())
	(a2, b2) = map(int, input().split())
	if max(a1, a2) <= a and b1 + b2 <= b or (max(b1, a2) <= a and a1 + b2 <= b) or (max(a1, b2) <= a and b1 + a2 <= b) or (max(b1, b2) <= a and a1 + a2 <= b):
		return 'YES'
	if max(a1, a2) <= b and b1 + b2 <= a or (max(b1, a2) <= b and a1 + b2 <= a) or (max(a1, b2) <= b and b1 + a2 <= a) or (max(b1, b2) <= b and a1 + a2 <= a):
		return 'YES'
	return 'NO'
print(main())


def main():

	def fits(a, b, a2, b2, a3, b3):
		if a2 + a3 <= a and max(b2, b3) <= b:
			return True
		if max(a2, a3) <= a and b2 + b3 <= b:
			return True
		return False
	(a1, b1) = map(int, input().split(' '))
	(a2, b2) = map(int, input().split(' '))
	(a3, b3) = map(int, input().split(' '))
	if a2 * b2 + a3 * b3 > a1 * b1:
		return False
	if fits(a1, b1, a2, b2, a3, b3) or fits(b1, a1, a2, b2, a3, b3):
		return True
	if fits(a1, b1, b2, a2, a3, b3) or fits(b1, a1, b2, a2, a3, b3):
		return True
	if fits(a1, b1, a3, b3, a2, b2) or fits(b1, a1, a3, b3, a2, b2):
		return True
	if fits(a1, b1, b3, a3, a2, b2) or fits(b1, a1, b3, a3, a2, b2):
		return True
	return False
print('YES' if main() else 'NO')


r = lambda : input()
ri = lambda : int(r())
rr = lambda : map(int, r().split())
rl = lambda : list(rr())
(a1, b1) = rr()
(a2, b2) = rr()
(a3, b3) = rr()

def f(x, y):
	fa = x <= a1 and y <= b1
	fb = x <= b1 and y <= a1
	return fa or fb
f1 = f(max(b2, b3), a2 + a3)
f2 = f(max(a2, a3), b2 + b3)
f3 = f(max(a2, b3), b2 + a3)
f4 = f(max(b2, a3), a2 + b3)
ans = f1 or f2 or f3 or f4
print('YES' if ans else 'NO')


def b_f(l_a, i, l_r):
	if i == 2:
		return True
	for j in range(2):
		if l_a[i][0] <= l_r[j] and l_a[i][1] <= l_r[(j + 1) % 2]:
			if b_f(l_a, i + 1, [l_r[j], l_r[(j + 1) % 2] - l_a[i][1]]):
				return True
		if l_a[i][1] <= l_r[j] and l_a[i][0] <= l_r[(j + 1) % 2]:
			if b_f(l_a, i + 1, [l_r[j], l_r[(j + 1) % 2] - l_a[i][0]]):
				return True
	return False
(a1, a2) = map(int, input().split())
l_s = list()
l_s.append(list(map(int, input().split())))
l_s.append(list(map(int, input().split())))
if b_f(l_s, 0, [a1, a2]):
	print('YES')
else:
	print('NO')


def solve(b, p1, p2) -> bool:
	large = max(b)
	small = min(b)
	min_p1 = min(p1)
	min_p2 = min(p2)
	max_p1 = max(p1)
	max_p2 = max(p2)
	if min_p1 + min_p2 <= small and max(max_p1, max_p2) <= large:
		return True
	elif max(max_p1, min_p2) <= small and min_p1 + max_p2 <= large:
		return True
	elif max(max_p2, min_p1) <= small and min_p2 + max_p1 <= large:
		return True
	elif max(min_p1, min_p2) <= small and max_p1 + max_p2 <= large:
		return True
	elif max(max_p1, max_p2) <= small and min_p1 + min_p2 <= large:
		return True
	else:
		return False

def getinput():

	def getints_line():
		return list(map(int, input().split(' ')))
	b = getints_line()
	p1 = getints_line()
	p2 = getints_line()
	return (b, p1, p2)

def test():
	art = Assert()
	art.equal(solve((3, 2), (1, 3), (2, 1)), True)
	art.equal(solve((5, 5), (3, 3), (3, 3)), False)
	art.equal(solve((4, 2), (2, 3), (1, 2)), True)
	art.equal(solve((2, 9), (5, 1), (3, 2)), True)

def main():
	print('YES' if solve(*getinput()) else 'NO')
import unittest

class Assert(unittest.TestCase):

	def equal(self, a, b):
		self.assertEqual(a, b)
main()


def max(a, b):
	if a > b:
		return a
	else:
		return b

def f(a1, a2, a3, b1, b2, b3):
	if a1 * b1 < a2 * b2 + a3 * b3:
		print('NO')
		return
	elif a2 + a3 <= a1 and max(b2, b3) <= b1:
		print('YES')
	elif a2 + b3 <= a1 and max(b2, a3) <= b1:
		print('YES')
	elif b2 + a3 <= a1 and max(a2, b3) <= b1:
		print('YES')
	elif b2 + b3 <= a1 and max(a2, a3) <= b1:
		print('YES')
	elif b2 + b3 <= b1 and max(a2, a3) <= a1:
		print('YES')
	elif a2 + b3 <= b1 and max(b2, a3) <= a1:
		print('YES')
	elif b2 + a3 <= b1 and max(a2, b3) <= a1:
		print('YES')
	elif a2 + a3 <= b1 and max(b2, b3) <= a1:
		print('YES')
	else:
		print('NO')
	return
(a1, b1) = input().split(' ')
a1 = int(a1)
b1 = int(b1)
(a2, b2) = input().split(' ')
a2 = int(a2)
b2 = int(b2)
(a3, b3) = input().split(' ')
a3 = int(a3)
b3 = int(b3)
f(a1, a2, a3, b1, b2, b3)


def f(a, b, x, y, z, q):
	res = 0
	if x + z <= a and max(y, q) <= b:
		res += 1
	if max(x, z) <= a and y + q <= b:
		res += 1
	return res
(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
res = f(a1, b1, a2, b2, a3, b3) + f(a1, b1, a2, b2, b3, a3) + f(a1, b1, b2, a2, a3, b3) + f(a1, b1, b2, a2, b3, a3) + f(b1, a1, a2, b2, b3, a3) + f(b1, a1, b2, a2, a3, b3) + f(b1, a1, b2, a2, b3, a3) + f(b1, a1, a2, b2, a3, b3)
if res > 0:
	print('YES')
else:
	print('NO')


y = lambda : list(map(int, input().split()))
k = lambda c: ord(c) - ord('0')
z1 = y()
z2 = y()
z3 = y()
for i in range(8):
	t = bin(i)[2:].zfill(3)
	bw = z1[k(t[0])]
	bh = z1[1 - k(t[0])]
	w = z2[k(t[2])] + z3[k(t[1])]
	h = max(z2[1 - k(t[2])], z3[1 - k(t[1])])
	if h <= bh and w <= bw:
		print('YES')
		break
else:
	print('NO')


from math import ceil

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

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def printlist(l):
	print(' '.join([str(x) for x in l]))
(a1, b1) = mp()
(a2, b2) = mp()
(a3, b3) = mp()
if max(a1 - a2, b1) >= max(a3, b3) and b1 >= b2 and (min(a1 - a2, b1) >= min(a3, b3)):
	print('YES')
elif max(a1, b1 - b2) >= max(a3, b3) and a1 >= a2 and (min(a1, b1 - b2) >= min(a3, b3)):
	print('YES')
elif max(a1, b1 - a2) >= max(a3, b3) and a1 >= b2 and (min(a1, b1 - a2) >= min(a3, b3)):
	print('YES')
elif max(a1 - b2, b1) >= max(a3, b3) and b1 >= a2 and (min(a1 - b2, b1) >= min(a3, b3)):
	print('YES')
else:
	print('NO')


(rows, cols) = list(map(int, input().split()))
(arows, acols) = list(map(int, input().split()))
(brows, bcols) = list(map(int, input().split()))

def fit(arows, acols, brows, bcols):
	if arows + brows <= rows:
		if max(acols, bcols) <= cols:
			return 'YES'
	if acols + bcols <= cols:
		if max(arows, brows) <= rows:
			return 'YES'
	return 'NO'
opts = set([])
opts.add(fit(arows, acols, brows, bcols))
(rows, cols) = (cols, rows)
opts.add(fit(arows, acols, brows, bcols))
(arows, acols) = (acols, arows)
opts.add(fit(arows, acols, brows, bcols))
(rows, cols) = (cols, rows)
opts.add(fit(arows, acols, brows, bcols))
print('YES' if 'YES' in opts else 'NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
(h1, w1) = (a1, b1) if a1 < b1 else (b1, a1)
(h2, w2) = (a2, b2) if a2 < b2 else (b2, a2)
(h3, w3) = (a3, b3) if a3 < b3 else (b3, a3)
if h1 >= h2 and h1 >= h3 and (w1 >= w2 + w3):
	print('YES')
elif h1 >= w2 and h1 >= h3 and (w1 >= h2 + w3):
	print('YES')
elif h1 >= h2 and h1 >= w3 and (w1 >= w2 + h3):
	print('YES')
elif h1 >= w2 and h1 >= w3 and (w1 >= h2 + h3):
	print('YES')
elif w1 >= h2 and w1 >= h3 and (h1 >= w2 + w3):
	print('YES')
elif w1 >= w2 and w1 >= h3 and (h1 >= h2 + w3):
	print('YES')
elif w1 >= h2 and w1 >= w3 and (h1 >= w2 + h3):
	print('YES')
elif w1 >= w2 and w1 >= w3 and (h1 >= h2 + h3):
	print('YES')
else:
	print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
cn1 = a1 >= a2 + a3 and max(b2, b3) <= b1
cn2 = a1 >= b2 + b3 and max(a2, a3) <= b1
cn3 = a1 >= a2 + b3 and max(b2, a3) <= b1
cn4 = a1 >= b2 + a3 and max(a2, b3) <= b1
cn5 = b1 >= a2 + a3 and max(b2, b3) <= a1
cn6 = b1 >= b2 + b3 and max(a2, a3) <= a1
cn7 = b1 >= a2 + b3 and max(b2, a3) <= a1
cn8 = b1 >= b2 + a3 and max(a2, b3) <= a1
if a1 * b1 >= a2 * b2 + a3 * b3 and (cn1 or cn2 or cn3 or cn4 or cn5 or cn6 or cn7 or cn8):
	print('YES')
else:
	print('NO')


r = lambda : map(int, input().split())
(a1, b1) = r()
(a2, b2) = r()
(a3, b3) = r()
f = lambda x1, y1, x2, y2: a1 >= x1 + x2 and b1 >= max(y1, y2) or (b1 >= y1 + y2 and a1 >= max(x1, x2))
print('YES' if f(a2, b2, a3, b3) or f(a2, b2, b3, a3) or f(b2, a2, a3, b3) or f(b2, a2, b3, a3) else 'NO')


def val(a, b, c, d, u, v):
	return a + b <= u and max(c, d) <= v or (c + d <= u and max(a, b) <= v)
(a1, b1) = [int(x) for x in input().split()]
(a2, b2) = [int(x) for x in input().split()]
(a3, b3) = [int(x) for x in input().split()]
if val(a2, a3, b3, b2, a1, b1) or val(a2, b3, a3, b2, a1, b1) or val(a2, a3, b3, b2, b1, a1) or val(a2, b3, a3, b2, b1, a1):
	print('YES')
else:
	print('NO')


(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
if a1 >= a2 and b1 >= b2:
	aa = a1 - a2
	bb = b1 - b2
	if aa >= a3 and b1 >= b3 or (aa >= b3 and b1 >= a3) or (bb >= a3 and a1 >= b3) or (bb >= b3 and a1 >= a3):
		print('YES')
		exit()
(a1, b1) = (b1, a1)
if a1 >= a2 and b1 >= b2:
	aa = a1 - a2
	bb = b1 - b2
	if aa >= a3 and b1 >= b3 or (aa >= b3 and b1 >= a3) or (bb >= a3 and a1 >= b3) or (bb >= b3 and a1 >= a3):
		print('YES')
		exit()
print('NO')


(a, b) = list(map(int, input().split()))
(k1, k2) = list(map(int, input().split()))
(k3, k4) = list(map(int, input().split()))
if k1 + k3 <= a and (k2 <= b and k4 <= b) or (k1 + k3 <= b and (k2 <= a and k4 <= a)) or (k1 + k4 <= a and (k2 <= b and k4 <= b)) or (k1 + k4 <= b and (k2 <= a and k4 <= a)) or (k2 + k4 <= a and (k1 <= b and k3 <= b)) or (k2 + k4 <= b and (k1 <= a and k3 <= a)) or (k1 + k4 <= a and (k2 <= b and k3 <= b)) or (k1 + k4 <= b and (k2 <= a and k3 <= a)) or (k2 + k3 <= a and (k1 <= b and k4 <= b)) or (k2 + k3 <= b and (k1 <= a and k4 <= a)):
	print('YES')
else:
	print('NO')


(x, y) = tuple((int(i) for i in input().split()))
(a, b) = tuple((int(i) for i in input().split()))
(c, d) = tuple((int(i) for i in input().split()))

def config(a, b, c, d):
	global x, y
	dx = max(a, b)
	dy = c + d
	return dx <= x and dy <= y
ans = config(a, c, b, d) or config(b, c, a, d) or config(a, d, b, c) or config(b, d, a, c)
t = x
x = y
y = t
ans = ans or config(a, c, b, d) or config(b, c, a, d) or config(a, d, b, c) or config(b, d, a, c)
if ans:
	print('YES')
else:
	print('NO')


def ok(x1, y1, x2, y2, x3, y3):
	if max(x2, x3) <= x1 and y2 + y3 <= y1:
		return True
	if max(y2, y3) <= y1 and x2 + x3 <= x1:
		return True
	return False

def okay(x1, y1, x2, y2, x3, y3):
	if ok(x1, y1, x2, y2, x3, y3):
		return True
	if ok(x1, y1, x2, y2, y3, x3):
		return True
	if ok(x1, y1, y2, x2, x3, y3):
		return True
	if ok(x1, y1, y2, x2, y3, x3):
		return True
	return False
(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
print('YES' if okay(a1, b1, a2, b2, a3, b3) else 'NO')


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
(ax, bx) = IL()
p1 = IL()
p2 = IL()
ans = False
for rot1 in [-1, 1]:
	s11 = p1[::rot1][0]
	s21 = p1[::rot1][1]
	for rot2 in [-1, 1]:
		s12 = s11 + p2[::rot2][0]
		s22 = max(s21, p2[::rot2][1])
		if s12 <= ax and s22 <= bx:
			ans = True
	for rot2 in [-1, 1]:
		s12 = max(s11, p2[::rot2][0])
		s22 = s21 + p2[::rot2][1]
		if s12 <= ax and s22 <= bx:
			ans = True
print('YES' if ans else 'NO')


def fit(a1, b1, a2, b2, a3, b3):
	if a2 + a3 <= a1 and b2 <= b1 and (b3 <= b1) or (b2 + b3 <= b1 and a2 <= a1 and (a3 <= a1)):
		return True
	else:
		return False
s1 = input()
a1 = int(s1.split()[0])
b1 = int(s1.split()[1])
s2 = input()
a2 = int(s2.split()[0])
b2 = int(s2.split()[1])
s3 = input()
a3 = int(s3.split()[0])
b3 = int(s3.split()[1])
ans = 'NO'
if fit(a1, b1, a2, b2, a3, b3):
	ans = 'YES'
if fit(a1, b1, a2, b2, b3, a3):
	ans = 'YES'
if fit(a1, b1, b2, a2, a3, b3):
	ans = 'YES'
if fit(a1, b1, b2, a2, b3, a3):
	ans = 'YES'
print(ans)


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def fits(s_a, s_b, a_1, b_1):
	return a_1 <= s_a and b_1 <= s_b

def rotations(a, b):
	return ((a, b), (b, a))

def cuts(a, b, a_1, b_1):
	return ((a - a_1, b), (a, b - b_1), (a - a_1, b - b_1))

def solve():
	(stand_a, stand_b) = read_tuple(int)
	pic_1 = tuple(read_tuple(int))
	pic_2 = tuple(read_tuple(int))
	for (s_a, s_b) in rotations(stand_a, stand_b):
		for (a_1, b_1) in rotations(pic_1[0], pic_1[1]):
			for (a_2, b_2) in rotations(pic_2[0], pic_2[1]):
				if fits(s_a, s_b, a_1, b_1):
					for (left_a, left_b) in cuts(s_a, s_b, a_1, b_1):
						if fits(left_a, left_b, a_2, b_2):
							return 'YES'
	return 'NO'
print(solve())


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
for (A, B) in [(a, b), (b, a)]:
	for (C, D) in [(c, d), (d, c)]:
		for (E, F) in [(e, f), (f, e)]:
			if C + E <= A and max(D, F) <= B:
				print('YES')
				exit()
print('NO')


def ok(a, b, A, B):
	return a <= A and b <= B or (a <= B and b <= A)

def __starting_point():
	(A, B) = [int(x) for x in input().split()]
	(a1, b1) = [int(x) for x in input().split()]
	(a2, b2) = [int(x) for x in input().split()]
	if ok(a1 + a2, max(b1, b2), A, B):
		print('YES')
	elif ok(a1 + b2, max(b1, a2), A, B):
		print('YES')
	elif ok(b1 + a2, max(a1, b2), A, B):
		print('YES')
	elif ok(b1 + b2, max(a1, a2), A, B):
		print('YES')
	else:
		print('NO')
__starting_point()


x = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
(x, y) = (x[0], x[1])
(a, b) = (a[0], a[1])
(c, d) = (c[0], c[1])
possibilities = []
possibilities.append([b + d, max(a, c)])
possibilities.append([a + d, max(b, c)])
possibilities.append([b + c, max(a, d)])
possibilities.append([a + c, max(b, d)])
possibilities.append([max(b, d), a + c])
possibilities.append([max(b, c), a + d])
possibilities.append([max(a, d), b + c])
possibilities.append([max(a, c), b + d])
for i in possibilities:
	if i[0] <= x and i[1] <= y:
		print('YES')
		break
else:
	print('NO')


def main():
	(a1, b1) = map(int, input().split())
	(a2, b2) = map(int, input().split())
	(a3, b3) = map(int, input().split())
	if a2 + a3 <= a1 and max(b2, b3) <= b1:
		print('YES')
	elif a2 + a3 <= b1 and max(b2, b3) <= a1:
		print('YES')
	elif b2 + b3 <= b1 and max(a2, a3) <= a1:
		print('YES')
	elif b2 + b3 <= a1 and max(a2, a3) <= b1:
		print('YES')
	elif a2 + b3 <= a1 and max(b2, a3) <= b1:
		print('YES')
	elif a2 + b3 <= b1 and max(b2, a3) <= a1:
		print('YES')
	elif b2 + a3 <= b1 and max(a2, b3) <= a1:
		print('YES')
	elif b2 + a3 <= a1 and max(a2, b3) <= b1:
		print('YES')
	else:
		print('NO')
	return 1
main()


ab = list(map(int, input().split()))
ab1 = list(map(int, input().split()))
ab2 = list(map(int, input().split()))
if ab1[0] + ab2[0] <= ab[0] and max(ab1[1], ab2[1]) <= ab[1] or (ab1[0] + ab2[1] <= ab[0] and max(ab1[1], ab2[0]) <= ab[1]) or (ab1[1] + ab2[0] <= ab[0] and max(ab1[0], ab2[1]) <= ab[1]) or (ab1[1] + ab2[1] <= ab[0] and max(ab1[0], ab2[0]) <= ab[1]) or (ab1[0] + ab2[0] <= ab[1] and max(ab1[1], ab2[1]) <= ab[0]) or (ab1[0] + ab2[1] <= ab[1] and max(ab1[1], ab2[0]) <= ab[0]) or (ab1[1] + ab2[0] <= ab[1] and max(ab1[0], ab2[1]) <= ab[0]) or (ab1[1] + ab2[1] <= ab[1] and max(ab1[0], ab2[0]) <= ab[0]):
	print('YES')
else:
	print('NO')


__author__ = 'tka4a'

def isCorrect(x, y, a, b):
	if min(x, y) >= min(a, b) and max(x, y) >= max(a, b) and (x > 0) and (y > 0):
		return True
	else:
		return False
(x, y) = map(int, input().split())
(a, b) = map(int, input().split())
(m, n) = map(int, input().split())
if m * n + a * b > x * y:
	print('No')
elif isCorrect(x, y, a, b):
	if isCorrect(x - a, y, m, n) or isCorrect(x, y - a, m, n) or isCorrect(x - b, y, m, n) or isCorrect(x, y - b, m, n):
		print('Yes')
	else:
		print('No')
else:
	print('No')


(x, y) = map(int, input().split())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
ans = False
if a1 + b2 <= x and max(b1, a2) <= y or (a1 + b2 <= y and max(b1, a2) <= x):
	ans = True
if a1 + b1 <= x and max(a2, b2) <= y or (a1 + b1 <= y and max(a2, b2) <= x):
	ans = True
if a2 + b1 <= x and max(a1, b2) <= y or (a2 + b1 <= y and max(a1, b2) <= x):
	ans = True
if a2 + b2 <= x and max(a1, b1) <= y or (a2 + b2 <= y and max(a1, b1) <= x):
	ans = True
print('YES' if ans else 'NO')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
can = False
for bi in range(2):
	for ci in range(2):
		ax = b[bi] + c[ci]
		ay = max(b[1 - bi], c[1 - ci])
		for ai in range(2):
			if a[ai] >= ax and a[1 - ai] >= ay:
				can = True
if can:
	print('YES')
else:
	print('NO')


((a1, b1), (a2, b2), (a3, b3)) = (map(int, input().split()) for i in range(3))

def canDoIt():
	if a1 >= a2 + a3 and b1 >= max(b2, b3) or (a1 >= max(a2, a3) and b1 >= b2 + b3):
		return True
	return False

def work():
	global a1, b1, a2, b2, a3, b3
	for i in range(2):
		(a2, b2) = (b2, a2)
		for j in range(2):
			(a3, b3) = (b3, a3)
			if canDoIt():
				return 'YES'
	return 'NO'
print(work())


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())

def f(a, b, c, d):
	return min(a, b) <= min(c, d) and max(a, b) <= max(c, d)
if f(a2 + a3, max(b2, b3), a1, b1):
	print('YES')
elif f(b2 + b3, max(a2, a3), a1, b1):
	print('YES')
elif f(a2 + b3, max(b2, a3), a1, b1):
	print('YES')
elif f(a3 + b2, max(b3, a2), a1, b1):
	print('YES')
else:
	print('NO')


class art:
	w = 0
	l = 0

	def __init__(self, A):
		self.w = int(A[0])
		self.l = int(A[1])

def func():
	a = input()
	sp = a.index(' ')
	arg1 = int(a[:sp])
	arg2 = int(a[sp + 1:])
	return (arg1, arg2)
manag = [(1, 1), (1, 0), (0, 1), (0, 0)]
ramka = art(func())
art1 = art(func())
art2 = art(func())

def right(w1, l1, w2, l2):
	if max(w1, w2) <= ramka.w and l1 + l2 <= ramka.l:
		return True
	else:
		return False

def bottom(w1, l1, w2, l2):
	if max(l1, l2) <= ramka.l and w1 + w2 <= ramka.w:
		return True
	else:
		return False
YES = False
for i in range(0, 4):
	w1 = art1.w
	w2 = art2.w
	l1 = art1.l
	l2 = art2.l
	if manag[i][0] == 0:
		(w1, l1) = (l1, w1)
	if manag[i][1] == 0:
		(w2, l2) = (l2, w2)
	if right(w1, l1, w2, l2) == True:
		YES = True
		break
	if bottom(w1, l1, w2, l2) == True:
		YES = True
		break
if YES == True:
	print('YES')
else:
	print('NO')


import math
import itertools
import os
import sys
(a, b) = ([None] * 3, [None] * 3)
(a[0], b[0]) = map(int, input().split())
(a[1], b[1]) = map(int, input().split())
(a[2], b[2]) = map(int, input().split())
for i in range(4):
	if i < 3:
		(a[i], b[i]) = (b[i], a[i])
	if a[1] + a[2] <= a[0] and max(b[1], b[2]) <= b[0]:
		print('YES')
		quit()
	if b[1] + b[2] <= b[0] and max(a[1], a[2]) <= a[0]:
		print('YES')
		quit()
	if i < 3:
		(a[i], b[i]) = (b[i], a[i])
print('NO')


(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
x = a
y = b
if c + e <= max(a, b) and max(d, f) <= min(a, b) or (c + f <= max(a, b) and max(d, e) <= min(a, b)) or (d + e <= max(a, b) and max(c, f) <= min(a, b)) or (d + f <= max(a, b) and max(c, e) <= min(a, b)):
	print('YES')
elif c + e <= min(a, b) and max(d, f) <= max(a, b) or (c + f <= min(a, b) and max(d, e) <= max(a, b)) or (d + e <= min(a, b) and max(c, f) <= max(a, b)) or (d + f <= min(a, b) and max(c, e) <= max(a, b)):
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
for i in range(2):
	for j in range(2):
		if b[i] + c[j] <= a[0] and max(b[i ^ 1], c[j ^ 1]) <= a[1]:
			print('YES')
			exit()
		if b[i] + c[j] <= a[1] and max(b[i ^ 1], c[j ^ 1]) <= a[0]:
			print('YES')
			exit()
print('NO')


def main():
	(a, b) = list(map(int, input().split()))
	obj = [None, None]
	obj[0] = list(map(int, input().split()))
	obj[1] = list(map(int, input().split()))

	def vlezet(a, b, i, j, sx, sy):
		return i + sx <= a and j + sy <= b
	if vlezet(a, b, 0, 0, *obj[0]):
		x = obj[0][0]
		y = obj[0][1]
		if vlezet(a, b, x, 0, *obj[1]) or vlezet(a, b, x, 0, obj[1][1], obj[1][0]):
			print('YES')
			return 0
		elif vlezet(a, b, 0, y, *obj[1]) or vlezet(a, b, 0, y, obj[1][1], obj[1][0]):
			print('YES')
			return 0
	(obj[0][1], obj[0][0]) = (obj[0][0], obj[0][1])
	if vlezet(a, b, 0, 0, *obj[0]):
		x = obj[0][0]
		y = obj[0][1]
		if vlezet(a, b, x, 0, *obj[1]) or vlezet(a, b, x, 0, obj[1][1], obj[1][0]):
			print('YES')
			return 0
		elif vlezet(a, b, 0, y, *obj[1]) or vlezet(a, b, 0, y, obj[1][1], obj[1][0]):
			print('YES')
			return 0
	print('NO')
	return 0
main()


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import *
from itertools import accumulate
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(a, b) = r()
arr = rr()
brr = rr()
x = sum(arr)
y = sum(brr)
for i in arr:
	for j in brr:
		if i + j <= a and b >= max(x - i, y - j) or (i + j <= b and a >= max(x - i, y - j)):
			print('YES')
			exit()
for i in arr[::-1]:
	for j in brr[::-1]:
		if i + j <= a and b >= max(x - i, y - j) or (i + j <= b and a >= max(x - i, y - j)):
			print('YES')
			exit()
print('NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
for (a, b) in [(a2 + a3, max(b2, b3)), (a2 + b3, max(b2, a3)), (b2 + a3, max(a2, b3)), (b2 + b3, max(a2, a3))]:
	if a <= a1 and b <= b1 or (a <= b1 and b <= a1):
		print('YES')
		exit()
print('NO')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
fg = 0
(x, y) = f()
(a1, b1) = f()
(a2, b2) = f()
if a1 + a2 <= x and max(b1, b2) <= y or (a1 + a2 <= y and max(b1, b2) <= x):
	fg = 1
if a1 + b2 <= x and max(b1, a2) <= y or (a1 + b2 <= y and max(b1, a2) <= x):
	fg = 1
if a2 + b1 <= x and max(a1, b2) <= y or (a2 + b1 <= y and max(a1, b2) <= x):
	fg = 1
if b1 + b2 <= x and max(a1, a2) <= y or (b1 + b2 <= y and max(a1, a2) <= x):
	fg = 1
print('YNEOS'[fg != 1::2])


def painting_fit(a1, b1, a2, b2, a3, b3):
	if a2 <= max(a1, b1) and b2 <= max(a1, b1) and (min(a1, b1) >= a2 or min(a1, b1) >= b2):
		r1 = max(a1, b1) - max(a2, b2)
		r2 = min(a1, b1) - min(a2, b2)
		m1 = max(a3, b3)
		m2 = min(a3, b3)
		if m1 <= max(min(a1, b1), r1) and m2 <= min(min(a1, b1), r1) or (m1 <= max(max(a1, b1), r2) and m2 <= min(max(a1, b1), r2)):
			return 'YES'
	if a2 <= max(a1, b1) and b2 <= max(a1, b1) and (min(a1, b1) >= a2 or min(a1, b1) >= b2):
		r1 = max(a1, b1) - min(a2, b2)
		if min(a1, b1) >= max(a2, b2):
			r2 = min(a1, b1) - max(a2, b2)
		else:
			return 'NO'
		m1 = max(a3, b3)
		m2 = min(a3, b3)
		if m1 <= max(min(a1, b1), r1) and m2 <= min(min(a1, b1), r1) or (m1 <= max(max(a1, b1), r2) and m2 <= min(max(a1, b1), r2)):
			return 'YES'
	return 'NO'
ab1 = input().split()
a1 = int(ab1[0])
b1 = int(ab1[1])
ab2 = input().split()
a2 = int(ab2[0])
b2 = int(ab2[1])
ab3 = input().split()
a3 = int(ab3[0])
b3 = int(ab3[1])
print(painting_fit(a1, b1, a2, b2, a3, b3))


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
f = False
if a1 >= a2 + a3 and b1 >= b2 and (b1 >= b3) or (a1 >= b2 + b3 and b1 >= a2 and (b1 >= a3)) or (a1 >= a2 + b3 and b1 >= b2 and (b1 >= a3)) or (a1 >= b2 + a3 and b1 >= a2 and (b1 >= b3)):
	f = True
if b1 >= b2 + b3 and a1 >= a2 and (a1 >= a3) or (b1 >= a2 + a3 and a1 >= b2 and (a1 >= b3)) or (b1 >= b2 + a3 and a1 >= a2 and (a1 >= b3)) or (b1 >= a2 + b3 and a1 >= b2 and (a1 >= a3)):
	f = True
if f:
	print('YES')
else:
	print('NO')


p0 = tuple(map(int, input().split()))
p1 = tuple(map(int, input().split()))
p2 = tuple(map(int, input().split()))

def rev(t):
	return (t[1], t[0])

def solve(a, b, c):
	return solve2(a, b, c) or solve2(rev(a), b, c)

def solve2(a, b, c):
	return solve3(a, b, c) or solve3(a, rev(b), c)

def solve3(a, b, c):
	return solve4(a, b, c) or solve4(a, b, rev(c))

def solve4(a, b, c):
	return a[0] >= b[0] + c[0] and a[1] >= max(b[1], c[1])
print('YES' if solve(p0, p1, p2) else 'NO')


(x, y) = map(int, input().strip().split(' '))
(x1, y1) = map(int, input().strip().split(' '))
(x2, y2) = map(int, input().strip().split(' '))
a = x
b = y
if x1 <= x and y1 <= y:
	x -= x1
	if x2 <= x and y2 <= y:
		print('YES')
	elif x2 <= y and y2 <= x:
		print('YES')
	else:
		x += x1
		y -= y1
		if x2 <= x and y2 <= y:
			print('YES')
		elif x2 <= y and y2 <= x:
			print('YES')
		else:
			x = a
			y = b
			if x1 <= y and y1 <= x:
				y -= x1
				if x2 <= x and y2 <= y:
					print('YES')
				elif x2 <= y and y2 <= x:
					print('YES')
				else:
					y += x1
					x -= y1
					if x2 <= x and y2 <= y:
						print('YES')
					elif x2 <= y and y2 <= x:
						print('YES')
					else:
						print('NO')
			else:
				print('NO')
elif x1 <= y and y1 <= x:
	y -= x1
	if x2 <= x and y2 <= y:
		print('YES')
	elif x2 <= y and y2 <= x:
		print('YES')
	else:
		y += x1
		x -= y1
		if x2 <= x and y2 <= y:
			print('YES')
		elif x2 <= y and y2 <= x:
			print('YES')
		else:
			print('NO')
else:
	print('NO')


rr = lambda : map(int, input().split())
(a1, b1) = rr()
(a2, b2) = rr()
(a3, b3) = rr()
f = lambda x, y: x <= a1 and y <= b1 or (x <= b1 and y <= a1)
ans = f(max(b2, b3), a2 + a3) or f(max(a2, a3), b2 + b3) or f(max(a2, b3), b2 + a3) or f(max(b2, a3), a2 + b3)
print('YES' if ans else 'NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())
t = 0
if a1 >= a2 and b1 >= b2:
	q = a1 - a2
	w = b1 - b2
	if q >= a3 and b1 >= b3 or (a1 >= a3 and w >= b3):
		t = 1
if a1 >= a2 and b1 >= b2:
	q = a1 - a2
	w = b1 - b2
	if q >= b3 and b1 >= a3 or (a1 >= b3 and w >= a3):
		t = 1
if a1 >= b2 and b1 >= a2:
	q = a1 - b2
	w = b1 - a2
	if q >= a3 and b1 >= b3 or (a1 >= a3 and w >= b3):
		t = 1
if a1 >= b2 and b1 >= a2:
	q = a1 - b2
	w = b1 - a2
	if q >= b3 and b1 >= a3 or (a1 >= b3 and w >= a3):
		t = 1
print('YES' if t else 'NO')


(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
if a2 + b3 <= b1:
	if max(a3, b2) <= a1:
		print('YES')
		return
if a2 + b3 <= a1:
	if max(a3, b2) <= b1:
		print('YES')
		return
if a2 + a3 <= b1:
	if max(b2, b3) <= a1:
		print('YES')
		return
if a2 + a3 <= a1:
	if max(b2, b3) <= b1:
		print('YES')
		return
if b2 + a3 <= a1:
	if max(a2, b3) <= b1:
		print('YES')
		return
if b2 + a3 <= b1:
	if max(a2, b3) <= a1:
		print('YES')
		return
if b2 + b3 <= a1:
	if max(a2, a3) <= b1:
		print('YES')
		return
if b2 + b3 <= b1:
	if max(a2, a3) <= a1:
		print('YES')
		return
print('NO')


from typing import Counter
import sys
from collections import defaultdict as dd
from math import *

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

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

def sinp():
	return input()

def inp():
	return int(input())

def mod(f):
	return f % 1000000007

def pr(*x):
	print(*x)

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def fout():
	return open('output.txt', 'w')

def fpr(f, x):
	f.write(x + '\n')

def csort(c):
	sorted(c.items(), key=lambda pair: pair[1], reverse=True)

def indc(l, n):
	c = {}
	for i in range(n):
		c[l[i]] = c.get(l[i], []) + [i + 1]
	return c
(a, b) = vinp()
(a2, b2) = vinp()
(a3, b3) = vinp()
check = 0
if a >= a2 and b >= b2:
	h1 = a - a2
	h2 = b - b2
	if h2 >= b3 and a >= a3 or (h2 >= a3 and a >= b3) or (h1 >= a3 and b >= b3) or (h1 >= b3 and b >= a3):
		check = 1
if a >= b2 and b >= a2:
	h1 = a - b2
	h2 = b - a2
	if h2 >= b3 and a >= a3 or (h2 >= a3 and a >= b3) or (h1 >= a3 and b >= b3) or (h1 >= b3 and b >= a3):
		check = 1
if check:
	print('YES')
else:
	print('NO')


r = lambda : map(int, input().split())
(a1, b1) = r()
(a2, b2) = r()
(a3, b3) = r()
ans = 'NO'
for (a1, b1) in [(a1, b1), (b1, a1)]:
	for (a2, b2) in [(a2, b2), (b2, a2)]:
		for (a3, b3) in [(a3, b3), (b3, a3)]:
			if a1 >= a2 + a3 and b1 >= max(b2, b3):
				ans = 'YES'
print(ans)


(n, m) = map(int, input().split())
(x, y) = map(int, input().split())
(z, t) = map(int, input().split())
if x + z <= n and max(y, t) <= m or (x + z <= m and max(y, t) <= n) or (x + t <= n and max(y, z) <= m) or (x + t <= m and max(y, z) <= n) or (y + z <= n and max(x, t) <= m) or (y + z <= m and max(x, t) <= n) or (y + t <= n and max(x, z) <= m) or (y + t <= m and max(x, z) <= n):
	print('YES')
else:
	print('NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def check(possible1):
	if max(possible1) <= b and min(possible1) <= a:
		return True
	return False
(a, b) = sorted(value())
(a1, b1) = sorted(value())
(a2, b2) = sorted(value())
possible1 = (max(a1, a2), b1 + b2)
possible2 = (max(a1, b2), a2 + b1)
(a1, b1) = (b1, a1)
(a2, b2) = (b2, a2)
possible3 = (max(a1, a2), b1 + b2)
possible4 = (max(a1, b2), a2 + b1)
if check(possible1) or check(possible2) or check(possible3) or check(possible4):
	print('YES')
else:
	print('NO')


def main():
	(a1, b1) = map(int, input().split())
	(a2, b2) = map(int, input().split())
	(a3, b3) = map(int, input().split())
	valid = False
	if a2 <= a1 and a3 <= a1 and (b2 + b3 <= b1):
		valid = True
	if a2 <= a1 and b3 <= a1 and (b2 + a3 <= b1):
		valid = True
	if b2 <= a1 and a3 <= a1 and (a2 + b3 <= b1):
		valid = True
	if b2 <= a1 and b3 <= a1 and (a2 + a3 <= b1):
		valid = True
	if a2 <= b1 and a3 <= b1 and (b2 + b3 <= a1):
		valid = True
	if a2 <= b1 and b3 <= b1 and (b2 + a3 <= a1):
		valid = True
	if b2 <= b1 and a3 <= b1 and (a2 + b3 <= a1):
		valid = True
	if b2 <= b1 and b3 <= b1 and (a2 + a3 <= a1):
		valid = True
	res = {True: 'YES', False: 'NO'}
	print(res[valid])
main()


board = tuple(map(int, input().split()))
p1 = tuple(map(int, input().split()))
p2 = tuple(map(int, input().split()))

def fits(b, pa, pb):
	if any((b[x] >= pa[x] + pb[x] and b[1 - x] >= max(pa[1 - x], pb[1 - x]) for x in (0, 1))):
		return True
	return False
success = False
for subset in [[], [0], [1], [0, 1]]:
	pa = tuple(reversed(p1)) if 0 in subset else p1
	pb = tuple(reversed(p2)) if 1 in subset else p2
	if fits(board, pa, pb):
		success = True
		break
if success:
	print('YES')
else:
	print('NO')


(a1, b1) = input().split()
(a1, b1) = (int(a1), int(b1))
(a2, b2) = input().split()
(a2, b2) = (int(a2), int(b2))
(a3, b3) = input().split()
(a3, b3) = (int(a3), int(b3))
ans = []
if a1 >= a2 + a3 and b2 <= b1 and (b3 <= b1):
	ans = 'YES'
elif a1 >= a2 + b3 and b2 <= b1 and (a3 <= b1):
	ans = 'YES'
elif a1 >= a3 + b2 and b3 <= b1 and (a2 <= b1):
	ans = 'YES'
elif a1 >= b3 + b2 and a2 <= b1 and (a3 <= b1):
	ans = 'YES'
elif b1 >= a2 + b3 and b2 <= a1 and (a3 <= a1):
	ans = 'YES'
elif b1 >= a3 + b2 and b3 <= a1 and (a2 <= a1):
	ans = 'YES'
elif b1 >= b3 + b2 and a2 <= a1 and (a3 <= a1):
	ans = 'YES'
elif b1 >= a3 + a2 and b2 <= a1 and (b3 <= a1):
	ans = 'YES'
else:
	ans = 'NO'
print(ans)


def read_list(t):
	return [t(x) for x in input().split()]

def read_line(t):
	return t(input())

def read_lines(t, N):
	return [t(input()) for _ in range(N)]
R = sorted(read_list(int))
(a2, b2) = read_list(int)
(a3, b3) = read_list(int)
R1 = sorted([a2 + a3, max(b2, b3)])
R2 = sorted([a2 + b3, max(b2, a3)])
R3 = sorted([b2 + a3, max(a2, b3)])
R4 = sorted([b2 + b3, max(a2, a3)])
if R1[0] <= R[0] and R1[1] <= R[1] or (R2[0] <= R[0] and R2[1] <= R[1]) or (R3[0] <= R[0] and R3[1] <= R[1]) or (R4[0] <= R[0] and R4[1] <= R[1]):
	print('YES')
else:
	print('NO')


def solve(a, b, c):
	return a[0] >= b[0] + c[0] and a[1] >= max(b[1], c[1])
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
for i in (1, -1):
	for j in (1, -1):
		for k in (1, -1):
			if solve(a[::i], b[::j], c[::k]):
				print('YES')
				exit()
print('NO')


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

def main():
	(a1, b1) = read()
	(a2, b2) = read()
	(a3, b3) = read()
	op1 = lambda x1, y1, x2, y2: (x1 + x2, max(y1, y2))
	op2 = lambda x1, y1, x2, y2: (max(x1, x2), y1 + y2)
	canvases = [op1(a2, b2, a3, b3), op1(b2, a2, a3, b3), op1(a2, b2, b3, a3), op1(b2, a2, b3, a3), op2(a2, b2, a3, b3), op2(b2, a2, a3, b3), op2(a2, b2, b3, a3), op2(b2, a2, b3, a3)]
	for (x, y) in canvases:
		if x <= a1 and y <= b1 or (x <= b1 and y <= a1):
			print('YES')
			return
	print('NO')
	return
main()


def test(size_x, size_y, x1, y1, x2, y2):
	if x1 + x2 <= size_x and y1 <= size_y and (y2 <= size_y):
		return 1
	return 0
import time
(A, B) = (int(i) for i in input().split())
(a1, b1) = (int(i) for i in input().split())
(a2, b2) = (int(i) for i in input().split())
start = time.time()
ans = 0
ans += test(A, B, a1, b1, a2, b2)
ans += test(A, B, a1, b1, b2, a2)
ans += test(A, B, b1, a1, a2, b2)
ans += test(A, B, b1, a1, b2, a2)
ans += test(B, A, a1, b1, a2, b2)
ans += test(B, A, a1, b1, b2, a2)
ans += test(B, A, b1, a1, a2, b2)
ans += test(B, A, b1, a1, b2, a2)
if ans > 0:
	print('YES')
else:
	print('NO')
finish = time.time()


def main():
	(a, b) = map(int, input().split())
	(c, d) = map(int, input().split())
	(e, f) = map(int, input().split())
	for _ in (0, 1):
		(a, b) = (b, a)
		for _ in (0, 1):
			(c, d) = (d, c)
			for _ in (0, 1):
				(e, f) = (f, e)
				if a >= c + e and d <= b >= f:
					print('YES')
					return
	print('NO')
main()


[A, B] = map(int, input().split())
(A, B) = (A + 1, B + 1)
[a, b] = map(int, input().split())
[c, d] = map(int, input().split())
found = 0
for i in range(2):
	for j in range(2):
		if a + c < A and b < B and (d < B) or (b + d < B and a < A and (c < A)):
			found = 1
		(a, b) = (b, a)
	(c, d) = (d, c)
print('YES' if found else 'NO')


(a1, b1) = map(int, input().split())
(a2, b2) = map(int, input().split())
(a3, b3) = map(int, input().split())

def f(a, b, c, d):
	if a + c <= a1 and max(b, d) <= b1:
		print('YES')
		exit(0)
for _ in range(2):
	f(a2, b2, a3, b3)
	f(b2, a2, a3, b3)
	f(a2, b2, b3, a3)
	f(b2, a2, b3, a3)
	(a1, b1) = (b1, a1)
print('NO')


(n, m) = map(int, input().split())
(n, m) = (max(n, m), min(n, m))
(a, b) = map(int, input().split())
(a1, b1) = map(int, input().split())
(a, b) = (max(a, b), min(a, b))
(a1, b1) = (max(a1, b1), min(a1, b1))
if b + b1 <= m and n >= max(a, a1) or (a + b1 <= n and max(a1, b) <= m) or (b + b1 <= n and m >= max(a, a1)) or (a + b1 <= m and max(a1, b) <= n) or (a1 + a <= n and max(b, b1) <= m) or (a1 + b <= n and max(a, b1) <= m) or (a1 + b <= m and max(a, b1) <= n):
	print('YES')
else:
	print('NO')


import sys
x = str(input()).split()
a1 = int(x[0])
b1 = int(x[1])
x = str(input()).split()
a2 = int(x[0])
b2 = int(x[1])
x = str(input()).split()
a3 = int(x[0])
b3 = int(x[1])
if a2 + a3 <= a1 and max(b2, b3) <= b1:
	print('YES')
elif b2 + a3 <= a1 and max(a2, b3) <= b1:
	print('YES')
elif a2 + b3 <= a1 and max(b2, a3) <= b1:
	print('YES')
elif b2 + b3 <= b1 and max(a2, a3) <= a1:
	print('YES')
elif b2 + a3 <= b1 and max(a2, b3) <= a1:
	print('YES')
elif a2 + b3 <= b1 and max(b2, a3) <= a1:
	print('YES')
else:
	(a1, b1) = (b1, a1)
	if a2 + a3 <= a1 and max(b2, b3) <= b1:
		print('YES')
	elif b2 + a3 <= a1 and max(a2, b3) <= b1:
		print('YES')
	elif a2 + b3 <= a1 and max(b2, a3) <= b1:
		print('YES')
	elif b2 + b3 <= b1 and max(a2, a3) <= a1:
		print('YES')
	elif b2 + a3 <= b1 and max(a2, b3) <= a1:
		print('YES')
	elif a2 + b3 <= b1 and max(b2, a3) <= a1:
		print('YES')
	else:
		print('NO')


def test(a, b, c, d, e, f):
	if a >= c + e and b >= max(d, f):
		return True
	if a >= max(c, e) and b >= d + f:
		return True
	return False
(a, b) = [int(i) for i in input().split()]
(c, d) = [int(i) for i in input().split()]
(e, f) = [int(i) for i in input().split()]
ans = False
if test(a, b, c, d, e, f):
	ans = True
if test(a, b, c, d, f, e):
	ans = True
if test(a, b, d, c, e, f):
	ans = True
if test(a, b, d, c, f, e):
	ans = True
if ans == True:
	print('YES')
else:
	print('NO')


(a1, b1) = [int(i) for i in input().split()]
(a2, b2) = [int(i) for i in input().split()]
(a3, b3) = [int(i) for i in input().split()]
if a2 + a3 <= a1 and b2 <= b1 and (b3 <= b1):
	print('YES')
	exit(0)
if b2 + b3 <= b1 and a2 <= a1 and (a3 <= a1):
	print('YES')
	exit(0)
if a2 + a3 <= b1 and b2 <= a1 and (b3 <= a1):
	print('YES')
	exit(0)
if b2 + b3 <= a1 and a2 <= b1 and (a3 <= b1):
	print('YES')
	exit(0)
if a2 + b3 <= a1 and a3 <= b1 and (b2 <= b1):
	print('YES')
	exit(0)
if a2 + b3 <= b1 and a3 <= a1 and (b2 <= a1):
	print('YES')
	exit(0)
if a3 + b2 <= a1 and a2 <= b1 and (b3 <= b1):
	print('YES')
	exit(0)
if a3 + b2 <= b1 and a2 <= a1 and (b3 <= a1):
	print('YES')
	exit(0)
print('NO')


(a, b) = [int(x) for x in input().split()]
(c, d) = [int(x) for x in input().split()]
(e, f) = [int(x) for x in input().split()]

def do(a, b, c, d, e, f):
	for i in range(1, 5):
		if c + e <= a and d <= b and (f <= b) or (d + f <= b and c <= a and (e <= a)):
			return 'YES'
		if i % 2:
			(c, d) = (d, c)
		(e, f) = (f, e)
	return 'NO'
print(do(a, b, c, d, e, f))


import sys

def main():
	x = []
	(n, m) = [int(i) for i in input().split()]
	(a1, b1) = [int(i) for i in input().split()]
	(a2, b2) = [int(i) for i in input().split()]
	ok = lambda a1, b1, a2, b2: a1 + a2 <= n and max(b1, b2) <= m or (b1 + b2 <= m and max(a1, a2) <= n)
	print('YES' if ok(a1, b1, a2, b2) or ok(a1, b1, b2, a2) or ok(b1, a1, a2, b2) or ok(b1, a1, b2, a2) else 'NO')
main()


def arr_2d(n):
	return [[int(x) for x in stdin.readline().split()] for i in range(n)]
from sys import stdin
(b, p1, p2) = arr_2d(3)
ans = 'NO'
for i in range(2):
	for j in range(2):
		for k in range(2):
			if p1[i] + p2[j] <= b[k]:
				if max(p1[not i], p2[not j]) <= b[not k]:
					ans = 'YES'
					break
print(ans)


from itertools import combinations
(a1, b1) = sorted(list(map(int, input().split(' '))), reverse=True)
(a2, b2) = sorted(list(map(int, input().split(' '))), reverse=True)
(a3, b3) = sorted(list(map(int, input().split(' '))), reverse=True)
arr = [[a2 + a3, max(b2, b3)], [max(a2, a3), b2 + b3], [a2 + b3, max(b3, a3)]]
for el in arr:
	if el[0] <= a1 and el[1] <= b1 or (el[1] <= a1 and el[0] <= b1):
		print('YES')
		exit(0)
print('NO')


(a1, b1) = list(map(int, input().split()))
(a2, b2) = list(map(int, input().split()))
(a3, b3) = list(map(int, input().split()))
ans = ''
if a1 > b1:
	(a1, b1) = (b1, a1)
if a2 > b2:
	(a2, b2) = (b2, a2)
if a3 > b3:
	(a3, b3) = (b3, a3)
ans = 0
if a2 + a3 <= a1 and max(b2, b3) <= b1:
	ans += 1
if a2 + b3 <= a1 and max(b2, a3) <= b1:
	ans += 1
if a3 + b2 <= a1 and max(a2, b3) <= b1:
	ans += 1
if b2 + b3 <= a1 and max(a2, a3) <= b1:
	ans += 1
if a2 + a3 <= b1 and max(b2, b3) <= a1:
	ans += 1
if a2 + b3 <= b1 and max(b2, a3) <= a1:
	ans += 1
if a3 + b2 <= b1 and max(a2, b3) <= a1:
	ans += 1
if b2 + b3 <= b1 and max(a2, a3) <= a1:
	ans += 1
if ans == 0:
	print('NO')
else:
	print('YES')


def combine(a1, b1, a2, b2):
	return (a1 + a2, max(b1, b2))

def fits(a1, b1, a2, b2):
	return a1 >= a2 and b1 >= b2 or (a1 >= b2 and b1 >= a2)
(a1, b1) = tuple(map(int, input().split()))
(a2, b2) = tuple(map(int, input().split()))
(a3, b3) = tuple(map(int, input().split()))
if fits(a1, b1, *combine(a2, b2, a3, b3)):
	print('YES')
elif fits(a1, b1, *combine(b2, a2, a3, b3)):
	print('YES')
elif fits(a1, b1, *combine(a2, b2, b3, a3)):
	print('YES')
elif fits(a1, b1, *combine(b2, a2, b3, a3)):
	print('YES')
else:
	print('NO')


check = lambda ax, ay, bx, by, cx, cy: bx + cx <= ax and max(by, cy) <= ay
inp = lambda : map(int, input().split())
(x1, y1) = inp()
(x2, y2) = inp()
(x3, y3) = inp()
if check(x1, y1, x2, y2, x3, y3) or check(y1, x1, x2, y2, x3, y3) or check(x1, y1, y2, x2, x3, y3) or check(y1, x1, y2, x2, x3, y3) or check(x1, y1, x2, y2, y3, x3) or check(y1, x1, x2, y2, y3, x3) or check(x1, y1, y2, x2, y3, x3) or check(y1, x1, y2, x2, y3, x3):
	print('YES')
else:
	print('NO')