Alice and Bob are playing chess on a huge chessboard with dimensions $n \times n$. Alice has a single piece left — a queen, located at $(a_x, a_y)$, while Bob has only the king standing at $(b_x, b_y)$. Alice thinks that as her queen is dominating the chessboard, victory is hers. 

But Bob has made a devious plan to seize the victory for himself — he needs to march his king to $(c_x, c_y)$ in order to claim the victory for himself. As Alice is distracted by her sense of superiority, she no longer moves any pieces around, and it is only Bob who makes any turns.

Bob will win if he can move his king from $(b_x, b_y)$ to $(c_x, c_y)$ without ever getting in check. Remember that a king can move to any of the $8$ adjacent squares. A king is in check if it is on the same rank (i.e. row), file (i.e. column), or diagonal as the enemy queen. 

Find whether Bob can win or not.


-----Input-----

The first line contains a single integer $n$ ($3 \leq n \leq 1000$) — the dimensions of the chessboard.

The second line contains two integers $a_x$ and $a_y$ ($1 \leq a_x, a_y \leq n$) — the coordinates of Alice's queen.

The third line contains two integers $b_x$ and $b_y$ ($1 \leq b_x, b_y \leq n$) — the coordinates of Bob's king.

The fourth line contains two integers $c_x$ and $c_y$ ($1 \leq c_x, c_y \leq n$) — the coordinates of the location that Bob wants to get to.

It is guaranteed that Bob's king is currently not in check and the target location is not in check either.

Furthermore, the king is not located on the same square as the queen (i.e. $a_x \neq b_x$ or $a_y \neq b_y$), and the target does coincide neither with the queen's position (i.e. $c_x \neq a_x$ or $c_y \neq a_y$) nor with the king's position (i.e. $c_x \neq b_x$ or $c_y \neq b_y$).


-----Output-----

Print "YES" (without quotes) if Bob can get from $(b_x, b_y)$ to $(c_x, c_y)$ without ever getting in check, otherwise print "NO".

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


-----Examples-----
Input
8
4 4
1 3
3 1

Output
YES

Input
8
4 4
2 3
1 6

Output
NO

Input
8
3 5
1 2
6 1

Output
NO



-----Note-----

In the diagrams below, the squares controlled by the black queen are marked red, and the target square is marked blue.

In the first case, the king can move, for instance, via the squares $(2, 3)$ and $(3, 2)$. Note that the direct route through $(2, 2)$ goes through check.

 [Image] 

In the second case, the queen watches the fourth rank, and the king has no means of crossing it.

 [Image] 

In the third case, the queen watches the third file.

 [Image]

Source: codeforces | Difficulty: EASY
Tags: Graph algorithms

Graph traversal

Implementation


Solutions:
n = int(input())
(bx, by) = map(int, input().split())
(ax, ay) = map(int, input().split())
(cx, cy) = map(int, input().split())
if ax < bx and cx < bx and (ay < by) and (cy < by):
	print('YES')
elif ax < bx and cx < bx and (ay > by) and (cy > by):
	print('YES')
elif ax > bx and cx > bx and (ay > by) and (cy > by):
	print('YES')
elif ax > bx and cx > bx and (ay < by) and (cy < by):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if (bx > ax and cx > ax or (bx < ax and cx < ax)) and (by > ay and cy > ay or (by < ay and cy < ay)):
	print('yes')
else:
	print('no')


n = int(input())
(bx, by) = [int(x) for x in input().split()]
(ax, ay) = [int(x) for x in input().split()]
(cx, cy) = [int(x) for x in input().split()]
if ax < bx and ay < by and (cx < bx) and (cy < by) or (ax > bx and ay < by and (cx > bx) and (cy < by)) or (ax < bx and ay > by and (cx < bx) and (cy > by)) or (ax > bx and ay > by and (cx > bx) and (cy > by)):
	print('YES')
else:
	print('NO')


def solve(n, bx, by, ax, ay, cx, cy):
	if bx > ax and bx < cx:
		return 'NO'
	if bx < ax and bx > cx:
		return 'NO'
	if by > ay and by < cy:
		return 'NO'
	if by < ay and by > cy:
		return 'NO'
	return 'YES'
n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
print(solve(n, ax, ay, bx, by, cx, cy))


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

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

def quadrant(x, y):
	if x > 0 and y > 0:
		return 1
	elif x > 0 and y < 0:
		return 2
	elif x < 0 and y > 0:
		return 3
	else:
		return 4
n = ri()
(qx, qy) = rl()
(rx, ry) = rl()
(tx, ty) = rl()
if quadrant(rx - qx, ry - qy) == quadrant(tx - qx, ty - qy):
	print('YES')
else:
	print('NO')


n = int(input())
(kx, ky) = input().split()
(qx, qy) = input().split()
(x, y) = input().split()
if int(qx) < int(kx) and int(x) < int(kx) and (int(qy) < int(ky)) and (int(y) < int(ky)):
	print('yes ')
elif int(qx) > int(kx) and int(x) > int(kx) and (int(qy) < int(ky)) and (int(y) < int(ky)):
	print('yes ')
elif int(qx) < int(kx) and int(x) < int(kx) and (int(qy) > int(ky)) and (int(y) > int(ky)):
	print('yes ')
elif int(qx) > int(kx) and int(x) > int(kx) and (int(qy) > int(ky)) and (int(y) > int(ky)):
	print('yes ')
else:
	print('no')


n = int(input())
(ax, ay) = [int(i) for i in input().split()]
(bx, by) = [int(i) for i in input().split()]
(cx, cy) = [int(i) for i in input().split()]
mb = 0
if bx < ax and by < ay:
	mb = 1
if bx > ax and by < ay:
	mb = 2
if bx < ax and by > ay:
	mb = 3
if bx > ax and by > ay:
	mb = 4
mc = 0
if cx < ax and cy < ay:
	mc = 1
if cx > ax and cy < ay:
	mc = 2
if cx < ax and cy > ay:
	mc = 3
if cx > ax and cy > ay:
	mc = 4
if mb == mc:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
bx -= ax
cx -= ax
by -= ay
cy -= ay
if bx * cx <= 0 or by * cy <= 0:
	print('NO')
else:
	print('YES')


a = int(input())
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if x2 < x1 and x3 < x1 and (y2 < y1) and (y3 < y1):
	print('YES')
elif x2 > x1 and x3 > x1 and (y2 < y1) and (y3 < y1):
	print('YES')
elif x2 > x1 and x3 > x1 and (y2 > y1) and (y3 > y1):
	print('YES')
elif x2 < x1 and x3 < x1 and (y2 > y1) and (y3 > y1):
	print('YES')
else:
	print('NO')


I = lambda : tuple(map(int, input().split()))
input()
(a, b, c) = (I(), I(), I())
print('YES' if all(((i - j) / (i - k) > 0 for (i, j, k) in zip(a, b, c))) else 'NO')


n = int(input())
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
(x3, y3) = list(map(int, input().split()))
if (x2 < x1 and x3 < x1 or (x2 > x1 and x3 > x1)) and (y2 < y1 and y3 < y1 or (y2 > y1 and y3 > y1)):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def h(x, y, x1, y1):
	if x < x1 and y < y1:
		return 3
	elif x < x1 and y > y1:
		return 2
	elif x > x1 and y > y1:
		return 1
	else:
		return 4
if h(bx, by, ax, ay) == h(cx, cy, ax, ay):
	print('YES')
else:
	print('NO')


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

def main():
	n = innput()
	(ax, ay) = innput()
	(bx, by) = innput()
	(cx, cy) = innput()
	d = {}
	if bx > cx:
		(bx, cx) = (cx, bx)
	if by > cy:
		(by, cy) = (cy, by)
	if cx > ax and ax > bx:
		print('NO')
	elif cy > ay and ay > by:
		print('NO')
	else:
		print('YES')
	return 0
	for i in range(bx, cx + 1):
		if d.get((i, by), 0) == 1:
			print('failed at (i, by) ', (i, by))
			print('NO')
			return 0
	for i in range(by, cy + 1):
		if d.get((bx, i), 0) == 1:
			print('failed at (bx, i) ', (bx, i))
			print('NO')
			return 0
	print('YES')
main()


n = int(input())
(ax, ay) = input().split()
ax = int(ax)
ay = int(ay)
(bx, by) = input().split()
bx = int(bx)
by = int(by)
(cx, cy) = input().split()
cx = int(cx)
cy = int(cy)
hod = True
if not ((bx - ax) * (cx - ax) > 0 and (by - ay) * (cy - ay) > 0) or (cx - ax) ** 2 == (cy - ay) ** 2:
	hod = False
if hod == False:
	print('NO')
else:
	print('YES')


class CodeforcesTask1033ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.king = []
		self.queen = []
		self.target = []

	def read_input(self):
		self.n = int(input())
		self.queen = [int(x) for x in input().split(' ')]
		self.king = [int(x) for x in input().split(' ')]
		self.target = [int(x) for x in input().split(' ')]

	def process_task(self):
		can = False
		if self.queen[0] < self.king[0] and self.queen[0] < self.target[0]:
			if self.queen[1] < self.king[1] and self.queen[1] < self.target[1]:
				can = True
			elif self.queen[1] > self.king[1] and self.queen[1] > self.target[1]:
				can = True
		elif self.queen[0] > self.king[0] and self.queen[0] > self.target[0]:
			if self.queen[1] < self.king[1] and self.queen[1] < self.target[1]:
				can = True
			elif self.queen[1] > self.king[1] and self.queen[1] > self.target[1]:
				can = True
		self.result = 'YES' if can else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask1033ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


from sys import stdin

def main():
	N = int(input())
	(Ax, Ay) = map(int, input().split())
	(Bx, By) = map(int, input().split())
	(Cx, Cy) = map(int, input().split())
	if min(Bx, Cx) < Ax < max(Bx, Cx) or min(By, Cy) < Ay < max(By, Cy):
		print('NO')
	else:
		print('YES')
input = lambda : stdin.readline()
main()


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
c = 0
if bx > ax and cx > ax or (bx < ax and cx < ax):
	c += 1
if by > ay and cy > ay or (by < ay and cy < ay):
	c += 1
if c == 2:
	print('YES')
else:
	print('NO')


def blocked(x, y):
	return x == 0 or y == 0
n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
bx -= ax
by -= ay
cx -= ax
cy -= ay
distx = abs(cx - bx)
disty = abs(cy - by)
if cx > bx:
	movx = 1
else:
	movx = -1
if cy > by:
	movy = 1
else:
	movy = -1
while True:
	if not blocked(movx + bx, by) and distx:
		bx += movx
		distx -= 1
	elif not blocked(bx, movy + by) and disty:
		by += movy
		disty -= 1
	else:
		break
if distx == disty == 0:
	print('YES')
else:
	print('NO')


r = lambda : map(int, input().split(' '))
input()
v = [r() for _ in 'abc']
print(['NO', 'YES'][all(((c < a) == (b < a) for (a, b, c) in zip(*v)))])


input()
(Queen, King, Destination, Check) = (list(map(int, input().split())), list(map(int, input().split())), list(map(int, input().split())), False)
if not (King[0] > Queen[0] and Destination[0] > Queen[0] or (King[0] < Queen[0] and Destination[0] < Queen[0])):
	print('NO')
	exit()
if not (King[1] < Queen[1] and Destination[1] < Queen[1] or (King[1] > Queen[1] and Destination[1] > Queen[1])):
	print('NO')
	exit()
print('YES')


r = lambda : map(int, input().split(' '))
input()
(ax, ay) = r()
(bx, by) = r()
(cx, cy) = r()
print(['NO', 'YES'][(cx < ax) == (bx < ax) and (cy < ay) == (by < ay)])


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
x1 = set(range(1, a[0]))
x2 = set(range(a[0] + 1, n + 1))
y1 = set(range(1, a[1]))
y2 = set(range(a[1] + 1, n + 1))
if set([b[0], c[0]]) <= x1 and set([b[1], c[1]]) <= y1:
	print('YES')
elif set([b[0], c[0]]) <= x1 and set([b[1], c[1]]) <= y2:
	print('YES')
elif set([b[0], c[0]]) <= x2 and set([b[1], c[1]]) <= y1:
	print('YES')
elif set([b[0], c[0]]) <= x2 and set([b[1], c[1]]) <= y2:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input().split())
b = list(input().split())
c = list(input().split())
a[0] = int(a[0])
a[1] = int(a[1])
b[0] = int(b[0])
b[1] = int(b[1])
c[0] = int(c[0])
c[1] = int(c[1])
end_right = False
end_left = False
start_right = False
start_left = False
end_top = False
end_bottom = False
start_top = False
start_bottom = False
if c[0] - a[0] != abs(c[0] - a[0]):
	end_left = True
else:
	end_right = True
if b[0] - a[0] != abs(b[0] - a[0]):
	start_left = True
else:
	start_right = True
if c[1] - a[1] != abs(c[1] - a[1]):
	end_bottom = True
else:
	end_top = True
if b[1] - a[1] != abs(b[1] - a[1]):
	start_bottom = True
else:
	start_top = True
if start_top and end_bottom:
	print('NO')
elif start_bottom and end_top:
	print('NO')
elif start_left and end_right:
	print('NO')
elif start_right and end_left:
	print('NO')
else:
	print('YES')


N = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def p():
	print('NO')
	exit()
if bx < cx:
	if bx < ax < cx:
		p()
elif cx < ax < bx:
	p()
if by < cy:
	if by < ay < cy:
		p()
elif cy < ay < by:
	p()
print('YES')


n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
ans = ''
if a[0] == 1 and a[1] == 1 or (a[0] == 1 and a[1] == n) or (a[0] == n and a[1] == 1) or (a[0] == n and a[1] == n):
	ans = 'YES'
elif a[0] == 1 or a[0] == n or a[1] == 1 or (a[1] == n):
	if a[0] == 1 or a[0] == n:
		if b[1] > a[1] and c[1] > a[1] or (b[1] < a[1] and c[1] < a[1]):
			ans = 'YES'
		else:
			ans = 'NO'
	elif a[1] == 1 or a[1] == n:
		if b[0] > a[0] and c[0] > a[0] or (b[0] < a[0] and c[0] < a[0]):
			ans = 'YES'
		else:
			ans = 'NO'
elif b[0] > a[0] and b[1] > a[1] and (c[0] > a[0]) and (c[1] > a[1]):
	ans = 'YES'
elif b[0] > a[0] and b[1] < a[1] and (c[0] > a[0]) and (c[1] < a[1]):
	ans = 'YES'
elif b[0] < a[0] and b[1] < a[1] and (c[0] < a[0]) and (c[1] < a[1]):
	ans = 'YES'
elif b[0] < a[0] and b[1] > a[1] and (c[0] < a[0]) and (c[1] > a[1]):
	ans = 'YES'
else:
	ans = 'NO'
print(ans)


n = int(input().strip())
(qx, qy) = map(int, input().strip().split())
(kx, ky) = map(int, input().strip().split())
(tx, ty) = map(int, input().strip().split())
flag = 0
if kx < qx:
	if ky < qy:
		if tx < qx and ty < qy:
			flag = 1
	elif ky > qy:
		if tx < qx and ty > qy:
			flag = 1
elif kx > qx:
	if ky > qy:
		if tx > qx and ty > qy:
			flag = 1
	elif ky < qy:
		if tx > qx and ty < qy:
			flag = 1
if tx > n or ty > n or kx > n or (ky > n):
	flag = 0
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if bx < ax:
	if by < ay:
		k = 1
	else:
		k = 3
elif by < ay:
	k = 2
else:
	k = 4
if cx < ax:
	if cy < ay:
		k1 = 1
	else:
		k1 = 3
elif cy < ay:
	k1 = 2
else:
	k1 = 4
if k1 != k:
	print('NO')
else:
	print('YES')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def sign(x):
	if x >= 0:
		return 1
	else:
		return 0
if (sign(ax - bx), sign(ay - by)) == (sign(ax - cx), sign(ay - cy)):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
(lx0, lx1, ly0, ly1) = (1, n, 1, n)
if ax > bx:
	lx1 = ax - 1
else:
	lx0 = ax + 1
if ay > by:
	ly1 = ay - 1
else:
	ly0 = ay + 1
test = True
if cx > lx1 or cx < lx0 or cy > ly1 or (cy < ly0):
	test = False
if test:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = list(map(int, input().split()))
(bx, by) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
if (bx > ax, by > ay) != (cx > ax, cy > ay):
	print('NO')
	return
print('YES')


n = int(input())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(x, y) = map(int, input().split())
if a > c and x > a or (a < c and x < a) or (b > d and y > b) or (b < d and y < b):
	print('NO')
else:
	print('YES')


n = int(input())
aq = list(map(int, input().split()))
bk = list(map(int, input().split()))
lk = list(map(int, input().split()))
if bk[0] < aq[0] and lk[0] < aq[0]:
	if bk[1] < aq[1] and lk[1] < aq[1] or (bk[1] > aq[1] and lk[1] > aq[1]):
		print('YES')
	else:
		print('NO')
elif bk[0] > aq[0] and lk[0] > aq[0]:
	if bk[1] > aq[1] and lk[1] > aq[1] or (bk[1] < aq[1] and lk[1] < aq[1]):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


input()
print(['NO', 'YES'][all(((c < a) == (b < a) for (a, b, c) in zip(*[map(int, input().split(' ')) for _ in 'abc'])))])


I = lambda : map(int, input().split())
n = int(input())
(ax, ay) = I()
(bx, by) = I()
(cx, cy) = I()
print('YNEOS'[(ax - bx) * (ax - cx) < 0 or (ay - by) * (ay - cy) < 0::2])


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

def four(x, y):
	xf = a[0]
	yf = a[1]
	if x > xf and y > yf:
		return 1
	if x < xf and y > yf:
		return 2
	if x < xf and y < yf:
		return 3
	if x > xf and y < yf:
		return 4
print('YES' if four(b[0], b[1]) == four(c[0], c[1]) else 'NO')


n = int(input())
(a1, a2) = list(map(int, input().split()))
(b1, b2) = list(map(int, input().split()))
(c1, c2) = list(map(int, input().split()))
if c1 < a1 and c2 < a2 and (b1 < a1) and (b2 < a2):
	print('YES')
elif c1 > a1 and c2 < a2 and (b1 > a1) and (b2 < a2):
	print('YES')
elif c1 < a1 and c2 > a2 and (b1 < a1) and (b2 > a2):
	print('YES')
elif c1 > a1 and c2 > a2 and (b1 > a1) and (b2 > a2):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
(bx, cx) = (max(bx, cx), min(bx, cx))
(by, cy) = (max(by, cy), min(by, cy))
if ax <= bx and ax >= cx or (ay >= cy and ay <= by):
	print('NO')
else:
	print('YES')


inp = lambda : map(int, input().split())
dimension = int(input())
(a1, a2) = inp()
(b1, b2) = inp()
(c1, c2) = inp()
print('NO' if b1 < a1 < c1 or b2 < a2 < c2 or b1 > a1 > c1 or (b2 > a2 > c2) else 'YES')


n = input()
(x0, y0) = map(int, input().split())
(xk, yk) = map(int, input().split())
(xc, yc) = map(int, input().split())
xk -= x0
xk /= abs(xk)
yk -= y0
yk /= abs(yk)
xc -= x0
xc /= abs(xc)
yc -= y0
yc /= abs(yc)
if xk == xc and yk == yc:
	print('YES')
else:
	print('NO')


n = int(input())
a = tuple(map(int, input().split(' ')))
b = tuple(map(int, input().split(' ')))
c = tuple(map(int, input().split(' ')))
if min(c[0], b[0]) < a[0] < max(c[0], b[0]) or min(c[1], b[1]) < a[1] < max(c[1], b[1]):
	print('NO')
else:
	print('YES')


def tigde(x, y, a, b):
	if x > a and y > b:
		return 1
	if x > a and y < b:
		return 2
	if x < a and y < b:
		return 3
	return 4
input()
(n, m) = map(int, input().split())
(k, z) = map(int, input().split())
(l, o) = map(int, input().split())
if tigde(k, z, n, m) == tigde(l, o, n, m):
	print('YES')
else:
	print('NO')


import math
import bisect
import collections
import itertools
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd, Counter as ctr
from bisect import bisect_left as bl, bisect_right as br
from itertools import permutations as pr, combinations as cb
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))

def results(a, b, c):
	(ax, ay) = (a[0], a[1])
	(bx, by) = (b[0], b[1])
	(cx, cy) = (c[0], c[1])
	if cx < ax and cy < ay and (bx < ax) and (by < ay):
		return 'YES'
	elif cx > ax and cy > ay and (bx > ax) and (by > ay):
		return 'YES'
	elif cx < ax and cy > ay and (bx < ax) and (by > ay):
		return 'YES'
	elif cx > ax and cy < ay and (bx > ax) and (by < ay):
		return 'YES'
	return 'NO'

def main():
	n = inp()
	a = seq()
	b = seq()
	c = seq()
	print(results(a, b, c))
main()


n = int(input())
v = [int(i) for i in input().split()]
k = [int(i) for i in input().split()]
z = [int(i) for i in input().split()]
if (v[0] > k[0]) == (v[0] > z[0]) and (v[1] > k[1]) == (v[1] > z[1]):
	print('YES')
else:
	print('NO')


n = int(input())
q = tuple(map(int, input().split()))
k = tuple(map(int, input().split()))
target = tuple(map(int, input().split()))

def dx(p, q):
	return abs(p[0] - q[0])

def dy(p, q):
	return abs(p[1] - q[1])

def find_section(p, q):
	a = str(p[0] < q[0])
	b = str(p[1] < q[1])
	c = str(dx(p, q) < dy(p, q) or True)
	return a + b + c
print('YES' if find_section(k, q) == find_section(target, q) else 'NO')


n = int(input())
(qx, qy) = [int(x) for x in input().split(' ')]
(kx1, ky1) = [int(x) for x in input().split(' ')]
(kx2, ky2) = [int(x) for x in input().split(' ')]
if (kx1 - qx > 0 and kx2 - qx > 0) and (ky2 - qy > 0 and ky1 - qy > 0 or (ky2 - qy < 0 and ky1 - qy < 0)) or ((kx1 - qx < 0 and kx2 - qx < 0) and (ky2 - qy < 0 and ky1 - qy < 0 or (ky2 - qy > 0 and ky1 - qy > 0))):
	print('YES')
else:
	print('NO')


size = int(input())
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if (y2 - y1) * (y3 - y1) > 0 and (x2 - x1) * (x3 - x1) > 0 and (x1 + y1 != x3 + y3):
	print('YES')
else:
	print('NO')


I = lambda : map(int, input().split())
I()
(Ax, Ay) = I()
(Bx, By) = I()
(Cx, Cy) = I()
if Bx < Ax < Cx or Bx > Ax > Cx or By < Ay < Cy or (By > Ay > Cy):
	print('NO')
else:
	print('YES')


n = int(input())
(bx, by) = map(int, input().split())
(ax, ay) = map(int, input().split())
(cx, cy) = map(int, input().split())
possible = True
if (ax - bx) * (cx - bx) <= 0:
	possible = False
if (ay - by) * (cy - by) <= 0:
	possible = False
if possible:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
flag = 0
sign1 = (bx - ax) / abs(bx - ax)
sign2 = (cx - ax) / abs(cx - ax)
sign3 = (by - ay) / abs(by - ay)
sign4 = (cy - ay) / abs(cy - ay)
if sign1 == sign2 and sign3 == sign4:
	print('YES')
else:
	print('NO')


from math import ceil, sqrt, log, gcd

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

def si():
	return input()

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

def li():
	return list(mi())
dx = [-1, -1, 1, 1, 0, 0, -1, 1]
dy = [0, -1, 1, 0, -1, 1, 1, -1]
vis = [[0 for i in range(1001)] for j in range(1001)]

def main():
	n = ii()
	(qx, qy) = mi()
	(x, y) = mi()
	(x1, y1) = mi()
	q = []
	if max(x, x1) >= qx >= min(x, x1) or max(y, y1) >= qy >= min(y, y1):
		print('NO')
		exit(0)
	q.append([x, y])
	vis[x][y] = 1
	c = 0
	while len(q) > 0:
		n1 = len(q) - 1
		x = q[n1][0]
		y = q[n1][1]
		q.pop()
		for i in range(8):
			x2 = x + dx[i]
			y2 = y + dy[i]
			if x2 < 1 or y2 < 1:
				continue
			if x2 > n or y2 > n:
				continue
			if vis[x2][y2]:
				continue
			vis[x2][y2] = 1
			if x2 == qx or y2 == qy or x2 + y2 == qx + qy or (abs(x2 - y2) == abs(qx - qy)):
				continue
			if x2 == x1 and y2 == y1:
				print('YES')
				exit(0)
			if min(x, x1) <= x2 <= max(x, x1) or min(y, y1) <= y2 <= max(y, y1):
				q.append([x2, y2])
	print('NO')
main()


input()
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if (bx - ax) * (cx - ax) > 0 and (by - ay) * (cy - ay) > 0 and (abs(bx - ax) > 1 or abs(by - ay) > 1) and (abs(cx - ax) > 1 or abs(ay - cy) > 1) and (abs(ax - cx) != abs(ay - cy)) and (abs(ax - bx) != abs(ay - by)):
	print('YES')
else:
	print('NO')


n = int(input())
(x1, y1) = map(int, input().split())
(x, y) = map(int, input().split())
(a, b) = map(int, input().split())
if x < x1 and y < y1:
	if a > x1 or b > y1:
		print('NO')
	else:
		print('YES')
elif x < x1 and y > y1:
	if a > x1 or b < y1:
		print('NO')
	else:
		print('YES')
elif x > x1 and y > y1:
	if a < x1 or b < y1:
		print('NO')
	else:
		print('YES')
elif x > x1 and y < y1:
	if a < x1 or b > y1:
		print('NO')
	else:
		print('YES')


n = input()
(qx, qy) = map(int, input().split())
(kx, ky) = map(int, input().split())
(wx, wy) = map(int, input().split())
if (kx - qx) * (wx - qx) > 0 and (ky - qy) * (wy - qy) > 0:
	print('YES')
else:
	print('NO')


n = int(input())
(qx, qy) = map(int, input().split(' '))
(kx, ky) = map(int, input().split(' '))
(fx, fy) = map(int, input().split(' '))
flag1 = False
flag2 = False
flag3 = False
flag4 = False
if qx > kx and qy > ky and (qx > fx) and (qy > fy):
	flag1 = True
if qx > kx and qy < ky and (qx > fx) and (qy < fy):
	flag1 = True
if qx < kx and qy < ky and (qx < fx) and (qy < fy):
	flag1 = True
if qx < kx and qy > ky and (qx < fx) and (qy > fy):
	flag1 = True
if flag1 or flag2 or flag3 or flag4:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = [int(x) for x in input().split()]
(bx, by) = [int(x) for x in input().split()]
(cx, cy) = [int(x) for x in input().split()]
yes = True
if ax in range(bx, cx) or ax in range(cx, bx) or ay in range(by, cy) or (ay in range(cy, by)):
	yes = False
print('YES' if yes else 'NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
f = 0
if bx < ax and by < ay and (cx < ax) and (cy < ay):
	f = 1
if bx < ax and by > ay and (cx < ax) and (cy > ay):
	f = 1
if bx > ax and by < ay and (cx > ax) and (cy < ay):
	f = 1
if bx > ax and by > ay and (cx > ax) and (cy > ay):
	f = 1
if f == 1:
	print('YES')
else:
	print('NO')


import sys
next(sys.stdin)
(q_x, q_y) = map(int, next(sys.stdin).rstrip().split())
(k_x, k_y) = map(int, next(sys.stdin).rstrip().split())
(dest_x, dest_y) = map(int, next(sys.stdin).rstrip().split())

def sign(x):
	return 1 if x >= 0 else -1

def which_square(x, y):
	return (sign(x - q_x), sign(y - q_y))
if which_square(k_x, k_y) == which_square(dest_x, dest_y):
	print('YES')
else:
	print('NO')


n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
b1 -= a1
b2 -= a2
c1 -= a1
c2 -= a2

def sgn(a):
	return 1 if a > 0 else -1
print('YES' if sgn(b1) == sgn(c1) and sgn(b2) == sgn(c2) else 'NO')


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


n = int(input())
(a1, a2) = [int(i) for i in input().split()]
(b1, b2) = [int(i) for i in input().split()]
(c1, c2) = [int(i) for i in input().split()]
if c1 == a1 + 1 and c2 == a2 or (c1 == a1 - 1 and c2 == a2) or (c1 == a1 - 1 and c2 == a2 + 1) or (c1 == a1 - 1 and c2 == a2 - 1) or (c1 == a1 + 1 and c2 == a2 + 1) or (c1 == a1 + 1 and c2 == a2 - 1) or (c1 == a1 and c2 == a2 + 1) or (c1 == a1 and c2 == a2 - 1):
	print('NO')
elif c2 == a2 or c1 == a1:
	print('NO')
else:
	if b1 < a1 and c1 < a1 and (c2 > a2) and (b2 > a2):
		print('YES')
		exit()
	if b1 < a1 and c1 < a1 and (c2 < a2) and (b2 < a2):
		print('YES')
		exit()
	if b1 > a1 and c1 > a1 and (c2 > a2) and (b2 > a2):
		print('YES')
		exit()
	if b1 > a1 and c1 > a1 and (c2 < a2) and (b2 < a2):
		print('YES')
		exit()
	print('NO')


n = int(input())
tmp = input().split()
ax = int(tmp[0])
ay = int(tmp[1])
tmp = input().split()
bx = int(tmp[0])
by = int(tmp[1])
tmp = input().split()
cx = int(tmp[0])
cy = int(tmp[1])
minx = min(bx, cx)
maxx = max(bx, cx)
miny = min(by, cy)
maxy = max(by, cy)
if minx < ax and ax < maxx or (miny < ay and ay < maxy):
	print('NO')
else:
	print('YES')


def get_coord():
	return list(map(int, input().split()))
rows = int(input())
(ax, ay) = get_coord()
(bx, by) = get_coord()
(cx, cy) = get_coord()

def on_same_side(a, b, c):
	return b < a and c < a or (b > a and c > a)
if on_same_side(ax, bx, cx) and on_same_side(ay, by, cy):
	print('YES')
else:
	print('NO')


n = int(input())
data = input().split()
ax = int(data[0])
ay = int(data[1])
data = input().split()
bx = int(data[0])
by = int(data[1])
data = input().split()
cx = int(data[0])
cy = int(data[1])
key = 0
if ax > bx:
	if ax < cx and key == 0:
		print('NO\n')
		key = 1
	if ay > by and key == 0:
		if ay < cy:
			print('NO\n')
			key = 1
	elif ay > cy and key == 0:
		print('NO\n')
		key = 1
else:
	if ax > cx and key == 0:
		print('NO\n')
		key = 1
	if ay > by and key == 0:
		if ay < cy:
			print('NO\n')
			key = 1
	elif ay > cy and key == 0:
		print('NO\n')
		key = 1
if key == 0:
	print('YES\n')


import sys
from collections import deque
n = int(sys.stdin.readline())
(x, y) = map(int, sys.stdin.readline().split())
(b1, b2) = map(int, sys.stdin.readline().split())
(k, l) = map(int, sys.stdin.readline().split())
grid = [[1] * (n + 1) for _ in range(n + 1)]
for i in range(n + 1):
	grid[i][y] = 0
	grid[x][i] = 0
	if x + i <= n:
		if y - i >= 0:
			grid[x + i][y - i] = 0
		if y + i <= n:
			grid[x + i][y + i] = 0
	if x - i >= 0:
		if y - i >= 0:
			grid[x - i][y - i] = 0
		if y + i <= n:
			grid[x - i][y + i] = 0
queue = deque([[b1, b2]])
while queue:
	(a, b) = queue.popleft()
	if 0 < a <= n and 0 < b <= n and grid[a][b]:
		grid[a][b] = 0
		if a == k and b == l:
			print('YES')
			sys.exit()
		else:
			queue.append([a + 1, b + 1])
			queue.append([a, b + 1])
			queue.append([a + 1, b])
			queue.append([a - 1, b])
			queue.append([a, b - 1])
			queue.append([a - 1, b - 1])
			queue.append([a - 1, b + 1])
			queue.append([a + 1, b - 1])
print('NO')


import sys
n = int(input())
(fX, fY) = map(int, input().split())
(kXS, kYS) = map(int, input().split())
(kXF, kYF) = map(int, input().split())
if min(kXS, kXF) < fX and fX < max(kXS, kXF) or (min(kYS, kYF) < fY and fY < max(kYS, kYF)):
	print('NO')
else:
	print('YES')


n = int(input())
queen_pos = list(map(int, input().split(' ')))
king_initial = list(map(int, input().split(' ')))
king_final = list(map(int, input().split(' ')))
if king_initial[0] <= queen_pos[0] <= king_final[0] or king_initial[0] >= queen_pos[0] >= king_final[0] or king_initial[1] <= queen_pos[1] <= king_final[1] or (king_initial[1] >= queen_pos[1] >= king_final[1]):
	print('NO')
else:
	print('YES')


a = int(input())
a = input().split()
a = [int(i) for i in a]
b = input().split()
b = [int(i) for i in b]
c = input().split()
c = [int(i) for i in c]
ok = False
if b[0] - a[0] < 0 and c[0] - a[0] < 0 or (b[0] - a[0] > 0 and c[0] - a[0] > 0):
	if b[1] - a[1] < 0 and c[1] - a[1] < 0 or (b[1] - a[1] > 0 and c[1] - a[1] > 0):
		print('YES')
		ok = True
if ok == False:
	print('NO')


n = int(input())
(ax, ay) = [int(w) for w in input().split()]
(bx, by) = [int(w) for w in input().split()]
(cx, cy) = [int(w) for w in input().split()]

def between(x, y, z):
	return x < y < z or z < y < x
if between(bx, ax, cx) or between(by, ay, cy):
	print('NO')
else:
	print('YES')


def check():
	n = input()
	queen = [int(i) for i in input().split()]
	king = [int(i) for i in input().split()]
	win = [int(i) for i in input().split()]
	if king[1] > queen[1] and win[1] > queen[1] and (king[0] < queen[0]) and (win[0] < queen[0]):
		return True
	if king[1] > queen[1] and win[1] > queen[1] and (king[0] > queen[0]) and (win[0] > queen[0]):
		return True
	if king[1] < queen[1] and win[1] < queen[1] and (king[0] < queen[0]) and (win[0] < queen[0]):
		return True
	if king[1] < queen[1] and win[1] < queen[1] and (king[0] > queen[0]) and (win[0] > queen[0]):
		return True
if check():
	print('YES')
else:
	print('NO')


def main():
	N = int(input())
	(ax, ay) = map(int, input().split())
	(bx, by) = map(int, input().split())
	(cx, cy) = map(int, input().split())
	if by >= ay + 1 and by <= N and (cy >= ay + 1) and (cy <= N):
		if bx >= 1 and bx <= ax - 1 and (cx >= 1) and (cx <= ax - 1):
			print('YES')
		elif bx >= ax + 1 and bx <= N and (cx >= ax + 1) and (cx <= N):
			print('YES')
		else:
			print('NO')
	elif by >= 1 and by <= ay - 1 and (cy >= 1) and (cy <= ay - 1):
		if bx >= 1 and bx <= ax - 1 and (cx >= 1) and (cx <= ax - 1):
			print('YES')
		elif bx >= ax + 1 and bx <= N and (cx >= ax + 1) and (cx <= N):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 4 * [0]
x[0] = (a[0] - 1, a[1] - 1)
x[1] = (a[0] - 1, a[1] + 1)
x[2] = (a[0] + 1, a[1] - 1)
x[3] = (a[0] - 1, a[1] - 1)
n = 0
z = 0
for i in x:
	if b[0] <= i[0] and b[1] <= i[1]:
		n = 1
	elif b[0] <= i[0] and b[1] >= i[1]:
		n = 2
	elif b[0] >= i[0] and b[1] <= i[1]:
		n = 3
	else:
		n = 4
	if c[0] <= i[0] and c[1] <= i[1]:
		z = 1
	elif c[0] <= i[0] and c[1] >= i[1]:
		z = 2
	elif c[0] >= i[0] and c[1] <= i[1]:
		z = 3
	else:
		z = 4
if z == n:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split(' '))
(bx, by) = map(int, input().split(' '))
(cx, cy) = map(int, input().split(' '))
place_b = -1
place_c = -1
if bx < ax:
	if by > ay:
		place_b = 1
	else:
		place_b = 2
elif by > ay:
	place_b = 3
else:
	place_b = 4
if cx < ax:
	if cy > ay:
		place_c = 1
	else:
		place_c = 2
elif cy > ay:
	place_c = 3
else:
	place_c = 4
if place_b == place_c:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
f3 = lambda x, y: x - ax
f4 = lambda x, y: y - ay
t3 = f3(bx, by) * f3(cx, cy) > 0
t4 = f4(bx, by) * f4(cx, cy) > 0
if (t3 and t4) == False:
	print('NO')
else:
	print('YES')


n = int(input())
(qx, qy) = list(map(int, input().split()))
(kx, ky) = list(map(int, input().split()))
(fx, fy) = list(map(int, input().split()))
(f, g, h, i) = (0, 0, 0, 0)
if kx > qx:
	f = 1
if ky > qy:
	g = 1
if fx > qx:
	h = 1
if fy > qy:
	i = 1
if f == h and g == i:
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if cx > ax and cy > ay and (bx > ax) and (by > ay):
	print('Yes')
elif cx > ax and cy < ay and (bx > ax) and (by < ay):
	print('Yes')
elif cx < ax and cy > ay and (bx < ax) and (by > ay):
	print('Yes')
elif cx < ax and cy < ay and (bx < ax) and (by < ay):
	print('Yes')
else:
	print('No')


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


n = int(input())
(a_x, a_y) = map(int, input().split(' '))
(b_x, b_y) = map(int, input().split(' '))
(c_x, c_y) = map(int, input().split(' '))

def get_quadrant(x, y):
	if x < a_x:
		if y < a_y:
			return 1
		else:
			return 2
	elif y < a_y:
		return 3
	else:
		return 4
if get_quadrant(b_x, b_y) == get_quadrant(c_x, c_y):
	print('YES')
else:
	print('NO')


from math import copysign as cs
n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
x1 = b1 - a1
x2 = c1 - a1
y1 = b2 - a2
y2 = c2 - a2
p1 = cs(1, x1)
p2 = cs(1, x2)
q1 = cs(1, y1)
q2 = cs(1, y2)
if p1 == p2 and q1 == q2:
	print('YES')
else:
	print('NO')


a = int(input())
(b, c) = list(map(int, input().split()))
(d, e) = list(map(int, input().split()))
(f, g) = list(map(int, input().split()))
print('NYOE S'[(d < b) == (f < b) and (e < c) == (g < c)::2])


n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
flag = 'YES'
if a1 - c1 == a2 - c2:
	flag = 'NO'
if a1 > b1 and a1 < c1 or (a1 > c1 and a1 < b1):
	flag = 'NO'
if a2 > b2 and a2 < c2 or (a2 > c2 and a2 < b2):
	flag = 'NO'
print(flag)


n = int(input())
a = input()
b = input()
c = input()
A = a.split()
B = b.split()
C = c.split()
ax = int(A[0])
ay = int(A[1])
bx = int(B[0])
by = int(B[1])
cx = int(C[0])
cy = int(C[1])
if bx < ax and cx < ax or (bx > ax and cx > ax):
	if by < ay and cy < ay or (by > ay and cy > ay):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def main():
	n = input()
	(ax, ay) = map(int, input().split())
	(bx, by) = map(int, input().split())
	(cx, cy) = map(int, input().split())

	def parse(x, y):
		flag = (x - ax > 0) << 1 | (y - ay > 0) << 0
		if flag == 0 or flag == 3:
			flag |= (x + y > ax + ay) << 3
		else:
			flag |= (x - y > ax - ay) << 3
		return flag
	print('YES' if parse(bx, by) == parse(cx, cy) else 'NO')
main()


import sys
dimensions = int(sys.stdin.readline()[0])
alice = sys.stdin.readline().split()
alicex = int(alice[0])
alicey = int(alice[1])
bob = sys.stdin.readline().split()
bobx = int(bob[0])
boby = int(bob[1])
desired = sys.stdin.readline().split()
desiredx = int(desired[0])
desiredy = int(desired[1])
if bobx > alicex:
	if boby > alicey:
		bobquad = 2
	else:
		bobquad = 4
elif boby > alicey:
	bobquad = 1
else:
	bobquad = 3
if desiredx > alicex:
	if desiredy > alicey:
		desiredquad = 2
	else:
		desiredquad = 4
elif desiredy > alicey:
	desiredquad = 1
else:
	desiredquad = 3
if desiredquad == bobquad:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	(ax, ay) = map(int, input().split())
	(bx, by) = map(int, input().split())
	(cx, cy) = map(int, input().split())
	if bx > ax and by < ay and (cx > ax) and (cy < ay) or (bx < ax and by < ay and (cx < ax) and (cy < ay)) or (bx < ax and by > ay and (cx < ax) and (cy > ay)) or (bx > ax and by > ay and (cx > ax) and (cy > ay)):
		return 'YES'
	else:
		return 'NO'
print(main())


sign = lambda x: (1, -1)[x < 0]

def solve(n, ax, ay, bx, by, cx, cy):
	axdif = sign(bx - ax)
	aydif = sign(by - ay)
	cxdif = sign(cx - ax)
	cydif = sign(cy - ay)
	return 'YES' if axdif == cxdif and aydif == cydif else 'NO'
n = int(input())
(ax, ay) = map(lambda x: int(x) - 1, input().split())
(bx, by) = map(lambda x: int(x) - 1, input().split())
(cx, cy) = map(lambda x: int(x) - 1, input().split())
print(solve(n, ax, ay, bx, by, cx, cy))


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
from collections import defaultdict

def check(a, b, c, d):
	if a == c or b == d:
		return True
	if abs(a - c) == abs(b - d):
		return True
	return False
n = I()
v = defaultdict(int)
(bx, by) = M()
(ax, ay) = M()
(cx, cy) = M()
l = [ax, bx, cx]
y = [ay, by, cy]
l.sort()
y.sort()
if l[1] == bx or y[1] == by:
	print('NO')
else:
	print('YES')


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

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

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

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
n = getInt()
(a, b) = zzz()
(c, d) = zzz()
(x, y) = zzz()
if x > a > c or x < a < c:
	print('NO')
elif y > b > d or y < b < d:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
v = []
f = max(b[0], c[0])
l = min(b[0], c[0])
g = max(b[1], c[1])
k = min(b[1], c[1])
count = 0
if a[0] < f and a[0] > l:
	count += 1
if a[1] < g and a[1] > k:
	count += 1
if count > 0:
	print('NO')
else:
	print('YES')


def quadrant(x, y, rx, ry):
	if x > rx and y > ry:
		return 1
	elif x < rx and y > ry:
		return 2
	elif x < rx and y < ry:
		return 3
	else:
		return 4
n = int(input())
(qx, qy) = map(int, input().split())
(kx, ky) = map(int, input().split())
(cx, cy) = map(int, input().split())
if quadrant(kx, ky, qx, qy) == quadrant(cx, cy, qx, qy):
	print('YES')
else:
	print('NO')


n = int(input())
(x, y) = map(int, input().split())
(a, b) = map(int, input().split())
(a1, b1) = map(int, input().split())
if x - 1 <= a1 <= x + 1 and y - 1 <= b1 <= y + 1:
	print('NO')
elif a1 == x or b1 == y:
	print('NO')
elif a < x and a1 > x:
	print('NO')
elif a > x and a1 < x:
	print('NO')
elif b > y and b1 < y:
	print('NO')
elif b < y and b1 > y:
	print('NO')
else:
	print('YES')


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

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

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

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

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

def getKey(item):
	return item[0]

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

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

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

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

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

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

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

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

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

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

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d
n = ii()
(a, b) = mi()
(c, d) = mi()
(x, y) = mi()
ans = 'NO'
if abs(a - x) == abs(b - y):
	print('NO')
else:
	if a > c and b > d:
		if a > x and b > y:
			ans = 'YES'
	elif a < c and b > d:
		if a < x and b > y:
			ans = 'YES'
	if a < c and b < d:
		if a < x and b < y:
			ans = 'YES'
	if a > c and b < d:
		if a > x and b < y:
			ans = 'YES'
	print(ans)


from sys import stdin
(n,) = map(int, stdin.readline().split())
(a_x, a_y) = map(int, stdin.readline().split())
(b_x, b_y) = map(int, stdin.readline().split())
(c_x, c_y) = map(int, stdin.readline().split())

def f(a_x, a_y, b_x, b_y):
	if b_x > a_x and b_y > a_y:
		return 1
	elif b_x > a_x and b_y < a_y:
		return 2
	elif b_x < a_x and b_y > a_y:
		return 3
	elif b_x < a_x and b_y < a_y:
		return 4
if f(a_x, a_y, b_x, b_y) == f(a_x, a_y, c_x, c_y):
	print('YES')
else:
	print('NO')


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from bisect import *
from functools import reduce
from operator import mul
star = lambda x: print(' '.join(map(str, x)))
grid = lambda r: [lint() for i in range(r)]
INF = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import sys
from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

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

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

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

def is_lose(x, y):
	return x == qx or y == qy or abs(qx - x) == abs(qy - y)

def is_valid(x, y):
	if x < 0 or y < 0 or x >= len(vis) or (y >= len(vis[0])) or vis[x][y]:
		return False
	return True
dx = [-1, 1, 0, 0, 1, 1, -1, -1]
dy = [0, 0, 1, -1, 1, -1, 1, -1]

def dfs(sr, sc, er, ec, n):
	visited = [[False for c in range(n)] for r in range(n)]
	q = deque()
	q.appendleft((sr, sc))
	visited[sr][sc] = True
	while q:
		(r, c) = q.pop()
		if r == er and c == ec:
			return True
		for i in range(8):
			nr = r + dx[i]
			nc = c + dy[i]
			if nr < 0 or nc < 0 or nr >= n or (nc >= n) or visited[nr][nc] or is_lose(nr, nc):
				continue
			visited[nr][nc] = True
			q.appendleft((nr, nc))
	return visited[er][ec]

def solve():
	n = inp()
	global vis
	global qx
	global qy
	vis = [[0 for _ in range(n)] for _ in range(n)]
	(qx, qy) = invr()
	(kx, ky) = invr()
	(resx, resy) = invr()
	qx -= 1
	qy -= 1
	kx -= 1
	ky -= 1
	resx -= 1
	resy -= 1
	res = dfs(kx, ky, resx, resy, n)
	if res:
		print('YES')
	else:
		print('NO')
t = 1
for _ in range(t):
	solve()


def main():
	n = int(input())
	(qx, qy) = [int(i) for i in input().split()]
	(kx, ky) = [int(i) for i in input().split()]
	(tx, ty) = [int(i) for i in input().split()]
	if kx > qx > tx or kx < qx < tx:
		return False
	if ky > qy > ty or ky < qy < ty:
		return False
	return True
print('YES' if main() else 'NO')


n = int(input())
q = input().split()
q = [int(x) for x in q]
k = input().split()
k = [int(x) for x in k]
c = input().split()
c = [int(x) for x in c]
ans = 'YES'
for i in range(2):
	if c[i] - k[i] > 0 and q[i] - k[i] > 0 or (c[i] - k[i] < 0 and q[i] - k[i] < 0):
		if abs(q[i] - k[i]) < abs(c[i] - k[i]):
			ans = 'NO'
print(ans)


a = int(input())
b = [int(b) for b in input().split()]
c = [int(c) for c in input().split()]
d = [int(d) for d in input().split()]
if c[0] < b[0] and c[1] < b[1] and (d[0] < b[0]) and (d[1] < b[1]) or (c[0] > b[0] and c[1] > b[1] and (d[0] > b[0]) and (d[1] > b[1])) or (c[0] < b[0] and c[1] > b[1] and (d[0] < b[0]) and (d[1] > b[1])) or (c[0] > b[0] and c[1] < b[1] and (d[0] > b[0]) and (d[1] < b[1])):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(lambda x: int(x) - 1, input().split())
(bx, by) = map(lambda x: int(x) - 1, input().split())
(cx, cy) = map(lambda x: int(x) - 1, input().split())

def region(tx, ty):
	c1 = ax < tx
	c2 = ay < ty
	if c1 and c2:
		return 1
	if c1 and (not c2):
		return 2
	if not c1 and c2:
		return 3
	if not c1 and (not c2):
		return 4
if region(bx, by) == region(cx, cy):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
ans = 'NO'
if bx < ax and by < ay and (cx < ax) and (cy < ay):
	ans = 'YES'
if bx < ax and by > ay and (cx < ax) and (cy > ay):
	ans = 'YES'
if bx > ax and by < ay and (cx > ax) and (cy < ay):
	ans = 'YES'
if bx > ax and by > ay and (cx > ax) and (cy > ay):
	ans = 'YES'
print(ans)


import sys

def dfs(n, Q, K, dest):
	(visited, stack) = (set(), [K])
	while stack:
		vertex = stack.pop()
		if vertex == dest:
			return 'YES'
		visited.add(vertex)
		adj = get_adjacent_cells(vertex, n, Q)
		stack.extend(adj - visited)
	return 'NO'

def get_adjacent_cells(cell, n, Q):
	x_coord = cell[0]
	y_coord = cell[1]
	adj = set()
	for (dx, dy) in adjacency:
		if 1 <= x_coord + dx <= n and 1 <= y_coord + dy <= n and (x_coord != Q[0]) and (y_coord != Q[1]) and (abs(Q[1] - y_coord) != abs(Q[0] - x_coord)):
			adj.add((x_coord + dx, y_coord + dy))
	return adj
inputs = sys.stdin.readlines()
inputs = [x.rstrip().split(' ') for x in inputs]
inputs = [int(x) for sublist in inputs for x in sublist]
n = inputs[0]
Q = tuple((x for x in inputs[1:3]))
K = tuple((x for x in inputs[3:5]))
dest = tuple((x for x in inputs[5:]))
if n > 100:
	lookRight = lookUp = False
	if dest[0] >= K[0]:
		lookRight = True
	if dest[1] >= K[1]:
		lookUp = True
	if lookRight and lookUp:
		adjacency = [(i, j) for i in (0, 1) for j in (0, 1) if not i == j == 0]
	elif lookRight and (not lookUp):
		adjacency = [(i, j) for i in (0, 1) for j in (-1, 0) if not i == j == 0]
	elif not lookRight and lookUp:
		adjacency = [(i, j) for i in (-1, 0) for j in (0, 1) if not i == j == 0]
	else:
		adjacency = [(i, j) for i in (-1, 0) for j in (-1, 0) if not i == j == 0]
else:
	adjacency = [(i, j) for i in (-1, 0, 1) for j in (-1, 0, 1) if not i == j == 0]
print(dfs(n, Q, K, dest))
sys.exit()


n = int(input())
(a_x, a_y) = map(int, input().split())
(b_x, b_y) = map(int, input().split())
(c_x, c_y) = map(int, input().split())
if b_x > a_x and b_y > a_y and (c_x > a_x) and (c_y > a_y):
	flag = True
elif b_x > a_x and b_y < a_y and (c_x > a_x) and (c_y < a_y):
	flag = True
elif b_x < a_x and b_y < a_y and (c_x < a_x) and (c_y < a_y):
	flag = True
elif b_x < a_x and b_y > a_y and (c_x < a_x) and (c_y > a_y):
	flag = True
else:
	flag = False
if flag:
	print('YES')
else:
	print('NO')


def checkQ(Qx, Qy, x, y):
	if x > Qx and y > Qy:
		return 1
	if x < Qx and y > Qy:
		return 2
	if x < Qx and y < Qy:
		return 3
	if x > Qx and y < Qy:
		return 4
n = int(input())
(ai, aj) = map(int, input().split())
(bi, bj) = map(int, input().split())
(ci, cj) = map(int, input().split())
if ci == ai or cj == aj:
	print('NO')
elif ci + ai == cj + aj or ci - ai == cj - aj:
	print('NO')
else:
	b = checkQ(ai, aj, bi, bj)
	c = checkQ(ai, aj, ci, cj)
	if b == c:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict
mod = 1000000007

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

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

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

def print_array(a):
	print(' '.join(map(str, a)))

def main():
	n = int(input())
	(qx, qy) = get_ints()
	(kx, ky) = get_ints()
	(tx, ty) = get_ints()
	if (kx < qx and tx < qx or (kx > qx and tx > qx)) and (ky < qy and ty < qy or (ky > qy and ty > qy)):
		print('YES')
	else:
		print('NO')
main()


a = int(input())
l = []
for i in range(3):
	l.append(list(map(int, input().split())))
f = 0
if l[0][0] > l[1][0] and l[0][1] > l[1][1]:
	if l[0][0] > l[2][0] and l[0][1] > l[2][1]:
		f = 1
elif l[0][0] > l[1][0] and l[0][1] < l[1][1]:
	if l[0][0] > l[2][0] and l[0][1] < l[2][1]:
		f = 1
elif l[0][0] < l[1][0] and l[0][1] > l[1][1]:
	if l[0][0] < l[2][0] and l[0][1] > l[2][1]:
		f = 1
elif l[0][0] < l[1][0] and l[0][1] < l[1][1]:
	if l[0][0] < l[2][0] and l[0][1] < l[2][1]:
		f = 1
if f == 1:
	print('YES')
else:
	print('NO')


import sys

def __starting_point():
	cin = sys.stdin
	n = int(next(cin))
	(ax, ay) = list(map(int, next(cin).split()))
	(bx, by) = list(map(int, next(cin).split()))
	(cx, cy) = list(map(int, next(cin).split()))
	if (ax - bx) * (ax - cx) > 0 and (ay - by) * (ay - cy) > 0:
		print('YES')
	else:
		print('NO')
__starting_point()


n = int(input())
(x1, y1) = input().split()
x1 = int(x1)
y1 = int(y1)
(x2, y2) = input().split()
x2 = int(x2)
y2 = int(y2)
(x3, y3) = input().split()
x3 = int(x3)
y3 = int(y3)
if 1 <= x2 and x2 < x1 and (1 <= y2) and (y2 < y1) and (1 <= x3) and (x3 < x1) and (1 <= y3) and (y3 < y1):
	print('YES')
elif 1 <= x2 and x2 < x1 and (y1 < y2) and (y2 <= n) and (1 <= x3) and (x3 < x1) and (y1 < y3) and (y3 <= n):
	print('YES')
elif x1 < x2 and x2 <= n and (1 <= y2) and (y2 < y1) and (x1 < x3) and (x3 <= n) and (1 <= y3) and (y3 < y1):
	print('YES')
elif x1 < x2 and x2 <= n and (y1 < y2) and (y2 <= n) and (x1 < x3) and (x3 <= n) and (y1 < y3) and (y3 <= n):
	print('YES')
else:
	print('NO')


n = int(input())
queen = tuple(map(int, input().split()))
king = tuple(map(int, input().split()))
dest = tuple(map(int, input().split()))
if king[0] < queen[0] and dest[0] < queen[0]:
	if king[1] < queen[1] and dest[1] < queen[1] or (king[1] > queen[1] and dest[1] > queen[1]):
		print('YES')
	else:
		print('NO')
elif king[0] > queen[0] and dest[0] > queen[0]:
	if king[1] < queen[1] and dest[1] < queen[1] or (king[1] > queen[1] and dest[1] > queen[1]):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
(queen_x, queen_y) = list(map(int, input().strip().split()))
(king_x, king_y) = list(map(int, input().strip().split()))
(tar_x, tar_y) = list(map(int, input().strip().split()))
(min_x, max_x) = sorted([king_x, tar_x])
(min_y, max_y) = sorted([king_y, tar_y])
if max_x > queen_x > min_x or max_y > queen_y > min_y:
	print('NO')
else:
	print('YES')


n = int(input())
(q1, q2) = map(int, input().split())
(k1, k2) = map(int, input().split())
(a1, a2) = map(int, input().split())
if (k1 > q1 and k2 > q2) and (a1 > q1 and a2 > q2):
	print('YES')
elif (k1 < q1 and k2 < q2) and (a1 < q1 and a2 < q2):
	print('YES')
elif (k1 > q1 and k2 < q2) and (a1 > q1 and a2 < q2):
	print('YES')
elif (k1 < q1 and k2 > q2) and (a1 < q1 and a2 > q2):
	print('YES')
else:
	print('NO')


n = int(input())
(qr, qc) = map(int, input().split())
(kr, kc) = map(int, input().split())
(fr, fc) = map(int, input().split())
(qr, qc, kr, kc, fr, fc) = (qr - 1, qc - 1, kr - 1, kc - 1, fr - 1, fc - 1)
mat = []
for i in range(n):
	k = []
	for j in range(n):
		k.append(0)
	mat.append(k)
for i in range(n):
	mat[i][qc] = 1
for i in range(n):
	mat[qr][i] = 1
p = qr
q = qc
while p < n and q < n:
	mat[p][q] = 1
	p += 1
	q += 1
p = qr - 1
q = qc - 1
while p > -1 and q > -1:
	mat[p][q] = 1
	p -= 1
	q -= 1
p = qr - 1
q = qc + 1
while p > -1 and q < n:
	mat[p][q] = 1
	p -= 1
	q += 1
p = qr + 1
q = qc - 1
while p < n and q > -1:
	mat[p][q] = 1
	p += 1
	q -= 1
flag = 0
if kr > qr and kc > qc and (fr > qr) and (fc > qc) or (kr < qr and kc < qc and (fr < qr) and (fc < qc)) or (kr > qr and kc < qc and (fr > qr) and (fc < qc)) or (kr < qr and kc > qc and (fr < qr) and (fc > qc)):
	print('YES')
else:
	print('NO')


I = lambda : map(int, input().split())
input()
(a, b) = I()
(c, d) = I()
(e, f) = I()
print('YNEOS'[(c - a) * (e - a) < 0 or (d - b) * (f - b) < 0::2])


from sys import stdin
import sys
n = int(input())
(q1, q2) = map(int, stdin.readline().strip().split())
(k1, k2) = map(int, stdin.readline().strip().split())
(a, b) = map(int, stdin.readline().strip().split())
if a > q1 and k1 > q1 and (k2 > q2) and (b > q2):
	print('YES')
	sys.exit()
if a < q1 and k1 < q1 and (k2 < q2) and (b < q2):
	print('YES')
	sys.exit()
if a < q1 and k1 < q1 and (k2 > q2) and (b > q2):
	print('YES')
	sys.exit()
if a > q1 and k1 > q1 and (k2 < q2) and (b < q2):
	print('YES')
	sys.exit()
print('NO')


n = int(input())
(bx, by) = map(int, input().split())
(ax, ay) = map(int, input().split())
(cx, cy) = map(int, input().split())
num1 = ax > bx
num3 = cx > bx
num2 = ay > by
num4 = cy > by
if num1 == num3 and num2 == num4:
	print('YES')
else:
	print('NO')


from collections import deque
moves = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (-1, 1), (1, -1)]

def get_neighbors(row, col, q, n):
	res = []
	for (x, y) in moves:
		new_x = x + row
		new_y = y + col
		if new_x >= 0 and new_x < n:
			if new_y >= 0 and new_y < n:
				if abs(new_x - q[0]) != abs(new_y - q[1]):
					if new_y != q[1] and new_x != q[0]:
						res.append([new_x, new_y])
	return res

def solve(n, queen, king, target):
	visited = [[-1] * (n + 1) for _ in range(n + 1)]

	def _bfs(start):
		if start == target:
			print('YES')
			return
		(x, y) = start
		visited[x][y] = 1
		q = deque()
		q.append(start)
		while len(q):
			(row, col) = q.popleft()
			if row == target[0] and col == target[1]:
				print('YES')
				return
			neighbors = get_neighbors(row, col, queen, n + 1)
			for (x, y) in neighbors:
				if visited[x][y] == -1:
					visited[x][y] = 1
					q.append([x, y])
		print('NO')
		return
	_bfs([king[0], king[1]])
dimensions = int(input())
queen = list(map(int, input().split(' ')))
king = list(map(int, input().split(' ')))
target = list(map(int, input().split(' ')))
solve(dimensions, queen, king, target)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192
from collections import defaultdict

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')
n = int(input())
(c1, c2) = map(int, input().split(' '))
(x1, y1) = map(int, input().split(' '))
(x2, y2) = map(int, input().split(' '))
a = c1
b = c2
l = [(c1, c2)]
while a > 1 and b > 1:
	a -= 1
	b -= 1
	l.append((a, b))
ans = 'YES'
if c1 in range(min(x1, x2), max(x1, x2) + 1):
	ans = 'NO'
if c2 in range(min(y1, y2), max(y1, y2) + 1):
	ans = 'NO'
if (x1, y1) in l or (x2, y2) in l:
	ans = 'NO'
print(ans)


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

def sign(a, b):
	if a - b > 0:
		return 1
	else:
		return 0

def check(a, b, c):
	if sign(a[0], b[0]) == sign(a[0], c[0]) and sign(a[1], b[1]) == sign(a[1], c[1]):
		print('YES')
	else:
		print('NO')
check(a, b, c)


def findquad(a, b):
	x1 = int(a[0])
	y1 = int(a[1])
	x2 = int(b[0])
	y2 = int(b[1])
	if x1 > x2:
		if y1 > y2:
			return 3
		else:
			return 2
	elif y1 > y2:
		return 4
	else:
		return 1
x = input()
q = input()
queen = q.split()
k = input()
king = k.split()
g = input()
goal = g.split()
num1 = findquad(queen, king)
num2 = findquad(queen, goal)
if num1 == num2:
	print('YES')
else:
	print('NO')


def sec1(x, y):
	return x > ax and x <= n and (y < ay) and (y > 0)

def sec2(x, y):
	return x > ax and x <= n and (y > ay) and (y <= n)

def sec3(x, y):
	return x < ax and x > 0 and (y < ay) and (y > 0)

def sec4(x, y):
	return x < ax and x > 0 and (y > ay) and (y <= n)

def sec(x, y):
	if sec1(x, y):
		return 1
	if sec2(x, y):
		return 2
	if sec3(x, y):
		return 3
	if sec4(x, y):
		return 4
n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if sec(bx, by) == sec(cx, cy):
	print('YES')
else:
	print('NO')


n = int(input())
(qx, qy) = list(map(int, input().split()))
(kx, ky) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
result = 'NO'
if kx >= qx + 1 and ky >= qy + 1 and (cx >= qx + 1) and (cy >= qy + 1):
	result = 'YES'
elif kx <= qx - 1 and ky <= qy - 1 and (cx <= qx - 1) and (cy <= qy - 1):
	result = 'YES'
elif kx >= qx + 1 and ky <= qy - 1 and (cx >= qx + 1) and (cy <= qy - 1):
	result = 'YES'
elif kx <= qx - 1 and ky >= qy + 1 and (cx <= qx - 1) and (cy >= qy + 1):
	result = 'YES'
print(result)


def main_function():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	b = [int(i) for i in input().split(' ')]
	c = [int(i) for i in input().split(' ')]
	if (min(b[0], c[0]) > a[0] or max(b[0], c[0]) < a[0]) and (min(b[1], c[1]) > a[1] or max(b[1], c[1]) < a[1]):
		print('YES')
	else:
		print('NO')
main_function()


n = int(input())
queen = list(map(int, input().split(' ')))
king = list(map(int, input().split(' ')))
final = list(map(int, input().split(' ')))

def notTouching(pointX):
	(x1, y1) = pointX
	(qx, qy) = queen
	if x1 == qx or y1 == qy:
		return False
	if x1 - y1 == qx - qy:
		return False
	if x1 + y1 == qx + qy:
		return False
	return True

def quadrant(point):
	(x, y) = point
	(qx, qy) = queen
	res = 1
	if x < qx:
		res *= 2
	if y < qy:
		res *= -1
	return res
solution = 'NO'
if notTouching(king) and notTouching(final):
	if quadrant(king) == quadrant(final):
		solution = 'YES'
print(solution)


from operator import sub
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
db = list(map(sub, a, b))
dc = list(map(sub, a, c))
if db[0] * dc[0] > 0 and db[1] * dc[1] > 0:
	print('YES')
else:
	print('NO')


n = int(input())
queen = [int(x) for x in input().split()]
king = [int(x) for x in input().split()]
dest = [int(x) for x in input().split()]

def isSignSame(one, two):
	if one > 0 and two > 0:
		return True
	if one < 0 and two < 0:
		return True
	return False
king_new = [king[0] - queen[0], king[1] - queen[1]]
dest_new = [dest[0] - queen[0], dest[1] - queen[1]]
if isSignSame(king_new[0], dest_new[0]) and isSignSame(king_new[1], dest_new[1]):
	print('YES')
else:
	print('NO')


from collections import deque

def valid(x, y):
	if x < 0 or x >= n or y < 0 or (y >= n):
		return False
	if v[x][y]:
		return False
	return True
dx = [-1, 1, -1, 1, 1, -1, 0, 0]
dy = [1, -1, -1, 1, 0, 0, -1, -1]

def BFS(x, y):
	q = deque()
	q.append([x, y])
	while q:
		A = q.pop()
		(a, b) = (A[0], A[1])
		for i in range(8):
			(newX, newY) = (a + dx[i], b + dy[i])
			if valid(newX, newY):
				v[newX][newY] = True
				q.append([newX, newY])
n = int(input())
(Ax, Ay) = map(int, input().split())
(Bx, By) = map(int, input().split())
(Cx, Cy) = map(int, input().split())
Ax -= 1
Ay -= 1
Bx -= 1
By -= 1
Cx -= 1
Cy -= 1
v = [[False for i in range(n)] for i in range(n)]
for i in range(n):
	v[Ax][i] = True
	v[i][Ay] = True
c = Ax
d = Ay
while c >= 0 and d < n:
	v[c][d] = True
	c -= 1
	d += 1
c = Ax
d = Ay
while c >= 0 and d >= 0:
	v[c][d] = True
	c -= 1
	d -= 1
c = Ax
d = Ay
while c < n and d < n:
	v[c][d] = True
	c += 1
	d += 1
c = Ax
d = Ay
while c < n and d >= 0:
	v[c][d] = True
	c += 1
	d -= 1
BFS(Bx, By)
print('YES' if v[Cx][Cy] else 'NO')


n = int(input())
(a1, a2) = [int(x) for x in input().split()]
(b1, b2) = [int(x) for x in input().split()]
(d1, d2) = [int(x) for x in input().split()]
mina = min(d1, b1)
maxa = max(d1, b1)
if a1 >= mina and a1 <= maxa:
	print('NO')
	exit()
mina = min(d2, b2)
maxa = max(d2, b2)
if a2 >= mina and a2 <= maxa:
	print('NO')
	exit()
print('YES')


n = int(input())
(qx, qy) = map(int, input().split())
(kx, ky) = map(int, input().split())
(fx, fy) = map(int, input().split())
if (kx < qx) == (fx < qx) and (ky < qy) == (fy < qy):
	print('YES')
else:
	print('NO')


n = int(input().strip())
(a_x, a_y) = map(int, input().strip().split())
(b_x, b_y) = map(int, input().strip().split())
(c_x, c_y) = map(int, input().strip().split())

def get_quad(x, y, a_x, a_y):
	ret = 0
	if x < a_x:
		if y < a_y:
			ret = 3
		else:
			ret = 2
	elif y < a_y:
		ret = 4
	else:
		ret = 1
	return ret
if get_quad(b_x, b_y, a_x, a_y) == get_quad(c_x, c_y, a_x, a_y):
	print('YES')
else:
	print('NO')


def test_0():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	(ax, ay) = list(map(int, input().split(' ')))
	(bx, by) = list(map(int, input().split(' ')))
	(cx, cy) = list(map(int, input().split(' ')))
	if (ax - bx) * (ax - cx) > 0 and (ay - by) * (ay - cy) > 0:
		print('YES')
	else:
		print('NO')
test_0()


from sys import stdin, stdout
n = int(stdin.readline())
(a1, a2) = map(int, stdin.readline().split())
(b1, b2) = map(int, stdin.readline().split())
(c1, c2) = map(int, stdin.readline().split())
b1 -= a1
b2 -= a2
c1 -= a1
c2 -= a2

def sgn(a):
	return 1 if a > 0 else -1
stdout.write('YES\n' if sgn(b1) == sgn(c1) and sgn(b2) == sgn(c2) else 'NO\n')


n = int(input())
(x1, y1) = [int(x) for x in input().split()]
(x2, y2) = [int(x) for x in input().split()]
(c1, c2) = [int(x) for x in input().split()]
if (x2 < x1 and c1 < x1 or (x2 > x1 and c1 > x1)) and (c2 < y1 and y2 < y1 or (c2 > y1 and y2 > y1)):
	print('YES')
else:
	print('NO')


d = int(input())
(qx, qy) = [int(i) for i in input().split()]
(kx, ky) = [int(j) for j in input().split()]
(nx, ny) = [int(k) for k in input().split()]
x = False
y = False
if kx > qx and nx > qx:
	x = True
if kx < qx and nx < qx:
	x = True
if ky > qy and ny > qy:
	y = True
if ky < qy and ny < qy:
	y = True
if x and y:
	print('YES')
else:
	print('NO')


def q(ax, ay, x, y):
	if ax < x and ay < y:
		return 1
	if ax > x and ay < y:
		return 2
	if ax < x and ay > y:
		return 3
	if ax > x and ay > y:
		return 4
	return 0

def main():
	n = int(input())
	(ax, ay) = [int(x) for x in input().split()]
	(bx, by) = [int(x) for x in input().split()]
	(cx, cy) = [int(x) for x in input().split()]
	if q(ax, ay, bx, by) == q(ax, ay, cx, cy):
		print('Yes')
	else:
		print('No')
main()


import sys
import string
from math import gcd
import getpass
import math
from decimal import Decimal

def ria():
	return [int(i) for i in input().split()]
if getpass.getuser() != 'frohenk':
	filename = 'half'
else:
	sys.stdin = open('input.txt')
n = ria()[0]
(x, y) = ria()
(bx, by) = ria()
(cx, cy) = ria()
(x1, y1) = (x - bx, y - by)
(x2, y2) = (x - cx, y - cy)
if abs(x2) == abs(y2):
	print('NO')
	exit(0)
if math.copysign(x2, x1) != x2:
	print('NO')
	exit(0)
if math.copysign(y2, y1) != y2:
	print('NO')
	exit(0)
print('YES')


def get_input_list():
	return list(map(int, input().split()))
n = get_input_list()[0]
(ax, ay) = get_input_list()
(bx, by) = get_input_list()
(cx, cy) = get_input_list()
if ax - bx == ay - by or ax - bx == -(ay - by) or ax - cx == ay - cy or (ax - cx == -(ay - cy)) or (ax == bx) or (ax == cx) or (ay == by) or (ay == cy):
	print('NO')
elif (ax - bx) * (ax - cx) < 0 or (ay - by) * (ay - cy) < 0:
	print('NO')
else:
	print('YES')


I = lambda : map(int, input().split())
I()
(ax, ay) = I()
(bx, by) = I()
(cx, cy) = I()
(cx, cy, bx, by) = (max(cx, bx), max(cy, by), min(cx, bx), min(cy, by))
if cx > ax > bx or cy > ay > by:
	print('NO')
else:
	print('YES')


def quadrant(a, b, x, y):
	if x < a:
		if y > b:
			return 1
		else:
			return 2
	elif y < b:
		return 3
	else:
		return 4
n = int(input())
(ax, ay) = map(int, input().strip().split(' '))
(bx, by) = map(int, input().strip().split(' '))
(cx, cy) = map(int, input().strip().split(' '))
if quadrant(ax, ay, bx, by) != quadrant(ax, ay, cx, cy):
	print('NO')
else:
	print('YES')


n = int(input())
(ax, ay) = [int(x) for x in input().split()]
(bx, by) = [int(x) for x in input().split()]
(cx, cy) = [int(x) for x in input().split()]
dxb = ax - bx
dxc = ax - cx
dyb = ay - by
dyc = ay - cy
dxba = int(dxb / abs(dxb))
dxca = int(dxc / abs(dxc))
dyba = int(dyb / abs(dyb))
dyca = int(dyc / abs(dyc))
if dxba == dxca and dyba == dyca:
	print('YES')
else:
	print('NO')


cnt = lambda s, i: s.count(i)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
lf = lambda : list(map(int, input().split()))
n = ii()
fg = 0
(ax, ay) = f()
(bx, by) = f()
(cx, cy) = f()
if min(bx, cx) < ax < max(bx, cx):
	fg = 1
elif min(by, cy) < ay < max(by, cy):
	fg = 1
print('YNEOS'[fg == 1::2])


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

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

	def In():
		return map(int, input().split())
else:

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

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def check(x, y, x1, y1):
	if y == x + abs(x1 - y1):
		return False
	elif y == -x + abs(x1 - y1):
		return False
	return True

def dfs(n, queen, initial, final):
	visit = [[False for x in range(n)] for y in range(n)]
	q = deque([initial])
	visit[initial[0]][initial[1]] = True
	while q:
		temp = q.popleft()
		(x, y) = (temp[0], temp[1])
		if x + 1 < n:
			if x + 1 != queen[0] and check(x + 1, y, queen[0], queen[1]) and (visit[x + 1][y] == False):
				q.appendleft([x + 1, y])
				visit[x + 1][y] = True
		if x + 1 < n and y + 1 < n:
			if x + 1 != queen[0] and y + 1 != queen[1] and check(x + 1, y + 1, queen[0], queen[1]) and (visit[x + 1][y + 1] == False):
				q.appendleft([x + 1, y + 1])
				visit[x + 1][y + 1] = True
		if x + 1 < n and y - 1 >= 0:
			if x + 1 != queen[0] and y - 1 != queen[1] and check(x + 1, y - 1, queen[0], queen[1]) and (visit[x + 1][y - 1] == False):
				q.appendleft([x + 1, y - 1])
				visit[x + 1][y - 1] = True
		if x - 1 >= 0:
			if x - 1 != queen[0] and check(x - 1, y, queen[0], queen[1]) and (visit[x - 1][y] == False):
				q.appendleft([x - 1, y])
				visit[x - 1][y] = True
		if x - 1 >= 0 and y - 1 >= 0:
			if x - 1 != queen[0] and y - 1 != queen[1] and check(x - 1, y - 1, queen[0], queen[1]) and (visit[x - 1][y - 1] == False):
				q.appendleft([x - 1, y - 1])
				visit[x - 1][y - 1] = True
		if x - 1 >= 0 and y + 1 < n:
			if x - 1 != queen[0] and y + 1 != queen[1] and check(x - 1, y + 1, queen[0], queen[1]) and (visit[x - 1][y + 1] == False):
				q.appendleft([x - 1, y + 1])
				visit[x - 1][y + 1] = True
		if y - 1 >= 0:
			if y - 1 != queen[1] and check(x, y - 1, queen[0], queen[1]) and (visit[x][y - 1] == False):
				q.appendleft([x, y - 1])
				visit[x][y - 1] = True
		if y + 1 < n:
			if y + 1 != queen[1] and check(x, y + 1, queen[0], queen[1]) and (visit[x][y + 1] == False):
				q.appendleft([x, y + 1])
				visit[x][y + 1] = True
	if visit[final[0]][final[1]] == True:
		yes()
	else:
		no()

def ext(l):
	l[0] -= 1
	l[1] -= 1
	return l

def main():
	try:
		n = I()
		queen = ext(list(In()))
		initial = ext(list(In()))
		final = ext(list(In()))
		dfs(n, queen, initial, final)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


n = int(input())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
r1 = c1 = r2 = c2 = 0
if c > a:
	r1 = 1
if d > b:
	c1 = 1
if e > a:
	r2 = 1
if f > b:
	c2 = 1
print('YES' if r1 == r2 and c1 == c2 else 'NO')


n = int(input())
q = [*map(int, input().split())]
k = [*map(int, input().split())]
w = [*map(int, input().split())]
if (q[0] - k[0]) * (q[0] - w[0]) > 0 and (q[1] - k[1]) * (q[1] - w[1]) > 0:
	if (k[0] - (sum(q) - k[1])) * (w[0] - (sum(q) - w[1])) > 0 or (k[0] - (q[0] - q[1] + k[1])) * (w[0] - (q[0] - q[1] + w[1])):
		print('YES')
		exit()
print('NO')


n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(t1, t2) = map(int, input().split())
if (b1 > a1 and t1 > a1) and (b2 > a2 and t2 > a2) or ((b1 < a1 and t1 < a1) and (b2 < a2 and t2 < a2)) or ((b1 > a1 and t1 > a1) and (b2 < a2 and t2 < a2)) or ((b1 < a1 and t1 < a1) and (b2 > a2 and t2 > a2)):
	print('YES')
else:
	print('NO')


n = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
C = tuple(map(int, input().split()))
from collections import deque
d = deque([B])
USEDLIST = [[0 for i in range(n + 1)] for j in range(n + 1)]
USEDLIST[B[0]][B[1]] = 1

def check(x, y):
	if x == A[0] or y == A[1]:
		return 0
	if abs(x - A[0]) == abs(y - A[1]):
		return 0
	else:
		return 1
while d:
	search = d.pop()
	searchlist = [(search[0] - 1, search[1] - 1), (search[0] - 1, search[1]), (search[0] - 1, search[1] + 1), (search[0], search[1] - 1), (search[0], search[1] + 1), (search[0] + 1, search[1] - 1), (search[0] + 1, search[1]), (search[0] + 1, search[1] + 1)]
	for sl in searchlist:
		if check(sl[0], sl[1]) == 1 and 1 <= sl[0] <= n and (1 <= sl[1] <= n) and (USEDLIST[sl[0]][sl[1]] == 0):
			d.append((sl[0], sl[1]))
			USEDLIST[sl[0]][sl[1]] = 1
	if USEDLIST[C[0]][C[1]] == 1:
		print('YES')
		break
else:
	print('NO')


n = int(input())
f = lambda x: int(x) - 1
(ax, ay) = map(f, input().split())
(bx, by) = map(f, input().split())
(cx, cy) = map(f, input().split())
WHITE = 0
GREY = 1
BLACK = 2
color = [[WHITE for j in range(n)] for i in range(n)]

def get_nbs(x, y):
	var = [-1, 0, 1]
	for i in var:
		for j in var:
			(nx, ny) = (x + i, y + j)
			if (nx, ny) != (x, y) and 0 <= nx < n and (0 <= ny < n):
				if nx != ax and ny != ay and (abs(ax - nx) != abs(ay - ny)):
					yield [nx, ny]

def dfs(x, y):
	color[x][y] = GREY
	for (nx, ny) in get_nbs(x, y):
		if color[nx][ny] == WHITE:
			dfs(nx, ny)

def get_q(x, y):
	if x < ax:
		if y < ay:
			return 1
		else:
			return 2
	elif y < ay:
		return 3
	else:
		return 4
if get_q(bx, by) != get_q(cx, cy):
	print('NO')
else:
	print('YES')


import sys, collections
n = int(sys.stdin.readline())
(ax, ay) = map(int, sys.stdin.readline().split())
(bx, by) = map(int, sys.stdin.readline().split())
(cx, cy) = map(int, sys.stdin.readline().split())
ax -= 1
ay -= 1
bx -= 1
by -= 1
cx -= 1
cy -= 1
check = [[0] * n for _ in range(n)]
q = collections.deque()
check[bx][by] = 1
for i in range(n):
	check[ax][i] = 2
	check[i][ay] = 2
for i in range(n):
	if 0 <= ax - i < n and 0 <= ay - i < n:
		check[ax - i][ay - i] = 2
	if 0 <= ax - i < n and 0 <= ay + i < n:
		check[ax - i][ay + i] = 2
	if 0 <= ax + i < n and 0 <= ay - i < n:
		check[ax + i][ay - i] = 2
	if 0 <= ax + i < n and 0 <= ay + i < n:
		check[ax + i][ay + i] = 2
dx = [0, 1, 0, -1, 1, 1, -1, -1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
q.append((bx, by))
while q:
	(x, y) = q.popleft()
	for i in range(8):
		(nx, ny) = (x + dx[i], y + dy[i])
		if 0 <= nx < n and 0 <= ny < n:
			if check[nx][ny] == 0:
				check[nx][ny] = 1
				q.append((nx, ny))
print('YES' if check[cx][cy] == 1 else 'NO')


def main():
	n = int(input())
	(ax, ay) = map(int, input().split())
	(bx, by) = map(int, input().split())
	(cx, cy) = map(int, input().split())
	d1 = bx - ax
	d2 = cx - ax
	d3 = by - ay
	d4 = cy - ay
	if d1 * d2 >= 0 and d3 * d4 >= 0:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
q = input().split()
k = input().split()
t = input().split()
if int(t[0]) > int(q[0]) and int(k[0]) > int(q[0]) and (int(t[1]) > int(q[1])) and (int(k[1]) > int(q[1])):
	print('YES')
elif int(t[0]) > int(q[0]) and int(k[0]) > int(q[0]) and (int(t[1]) < int(q[1])) and (int(k[1]) < int(q[1])):
	print('YES')
elif int(t[0]) < int(q[0]) and int(k[0]) < int(q[0]) and (int(t[1]) < int(q[1])) and (int(k[1]) < int(q[1])):
	print('YES')
elif int(t[0]) < int(q[0]) and int(k[0]) < int(q[0]) and (int(t[1]) > int(q[1])) and (int(k[1]) > int(q[1])):
	print('YES')
else:
	print('NO')


n = int(input())
(bx, by) = list(map(int, input().split()))
(ax, ay) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
nax = ax - bx
nay = ay - by
ncx = cx - bx
ncy = cy - by

def znak(x):
	if x < 0:
		return -1
	else:
		return 1
if ncx == 0 or ncy == 0 or abs(ncx) == abs(ncy):
	print('NO')
elif znak(nax) == znak(ncx) and znak(nay) == znak(ncy):
	print('YES')
else:
	print('NO')


n = int(input())
(f1, f2) = map(int, input().split())
(k1, k2) = map(int, input().split())
(k21, k22) = map(int, input().split())
if k1 < f1 and k21 < f1 and (k2 < f2) and (k22 < f2) or (k1 > f1 and k21 > f1 and (k2 < f2) and (k22 < f2)) or (k1 < f1 and k21 < f1 and (k2 > f2) and (k22 > f2)) or (k1 > f1 and k21 > f1 and (k2 > f2) and (k22 > f2)):
	print('YES')
else:
	print('NO')


import sys
n = int(input())
(ax, ay) = list(map(int, input().split()))
(bx, by) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
if (ax, ay) in [(0, 0), (n, n), (0, n), (n, 0)]:
	print('YES')
	sys.exit()
if bx > ax and cx < ax or (bx < ax and cx > ax):
	print('NO')
	sys.exit()
if by > ay and cy < ay or (by < ay and cy > ay):
	print('NO')
	sys.exit()
print('YES')


t = 1
for _ in range(t):
	n = int(input())
	(a1, a2) = map(int, input().split())
	(b1, b2) = map(int, input().split())
	(c1, c2) = map(int, input().split())
	if (b1 > a1) == (c1 > a1) and (b2 > a2) == (c2 > a2):
		print('YES')
	else:
		print('NO')
exit(0)


def isCheck(a1, a2, b1, b2):
	if a1 == b1 or a2 == b2:
		return True
	if abs(a1 - b1) == abs(a2 - b2):
		return True
	return False
N = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(t1, t2) = map(int, input().split())
if b1 <= a1 and t1 >= a1:
	print('NO')
elif b1 >= a1 and t1 <= a1:
	print('NO')
elif b2 <= a2 and t2 >= a2:
	print('NO')
elif b2 >= a2 and t2 <= a2:
	print('NO')
else:
	print('YES')


n = int(input())
(a1, a2) = [int(x) for x in input().split()]
(b1, b2) = [int(x) for x in input().split()]
(c1, c2) = [int(x) for x in input().split()]
if a1 - b1 > 0 and a2 - b2 > 0:
	if a1 - c1 > 0 and a2 - c2 > 0:
		print('YES')
	else:
		print('NO')
if a1 - b1 < 0 and a2 - b2 < 0:
	if a1 - c1 < 0 and a2 - c2 < 0:
		print('YES')
	else:
		print('NO')
if a1 - b1 > 0 and a2 - b2 < 0:
	if a1 - c1 > 0 and a2 - c2 < 0:
		print('YES')
	else:
		print('NO')
if a1 - b1 < 0 and a2 - b2 > 0:
	if a1 - c1 < 0 and a2 - c2 > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
(ax, ay) = list(map(int, input().strip().split()))
(bx, by) = list(map(int, input().strip().split()))
(cx, cy) = list(map(int, input().strip().split()))
if (bx - ax) * (cx - ax) > 0 and (cy - ay) * (by - ay) > 0:
	print('YES')
else:
	print('NO')


import math
import sys
DEBUG = False

def inp():
	return sys.stdin.readline().rstrip()

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def solve(N, ax, ay, bx, by, cx, cy):
	ax -= 1
	ay -= 1
	bx -= 1
	by -= 1
	cx -= 1
	cy -= 1
	F = [bytearray(N) for _ in range(N)]
	Q = [(bx, by)]
	while Q:
		(x, y) = Q.pop()
		if F[y][x] == 1:
			continue
		F[y][x] = 1
		for dy in [-1, 0, 1]:
			for dx in [-1, 0, 1]:
				if (dx, dy) == (0, 0):
					continue
				nx = x + dx
				ny = y + dy
				if (nx, ny) == (cx, cy):
					return True
				if nx < 0 or ny < 0 or nx >= N or (ny >= N):
					continue
				if nx == ax or ny == ay or ax - nx == ay - ny or (ax - nx == ny - ay):
					continue
				if F[ny][nx] == 1:
					continue
				Q.append((nx, ny))
	return False

def main():
	N = int(inp())
	(ax, ay) = [int(e) for e in inp().split()]
	(bx, by) = [int(e) for e in inp().split()]
	(cx, cy) = [int(e) for e in inp().split()]
	print('YES' if solve(N, ax, ay, bx, by, cx, cy) else 'NO')
main()


n = int(input())
(ax, ay) = [int(i) for i in input().split()]
(bx, by) = [int(i) for i in input().split()]
(cx, cy) = [int(i) for i in input().split()]
if (bx - ax) // abs(bx - ax) == (cx - ax) // abs(cx - ax) and (by - ay) // abs(by - ay) == (cy - ay) // abs(cy - ay):
	print('YES')
else:
	print('NO')


gi = lambda : list(map(int, input().split()))
(n,) = gi()
(qx, qy) = gi()
(kx, ky) = gi()
(dx, dy) = gi()
print('YNEOS'[not ((kx > qx and dx > qx or (kx < qx and dx < qx)) and (ky > qy and dy > qy or (ky < qy and dy < qy)))::2])


rows = int(input())
queen_pos = [int(i) for i in input().split()]
king_pos = [int(i) for i in input().split()]
target_pos = [int(i) for i in input().split()]

def valid(king_pos):
	return 0 < king_pos[0] <= rows and 0 < king_pos[1] <= rows

def good(king_pos):
	return valid(king_pos) and (not check(king_pos))

def next_position(pos):
	(i, j) = pos
	return [(i + 1, j), (i, j + 1), (i - 1, j), (i, j - 1), (i + 1, j + 1), (i - 1, j - 1), (i + 1, j - 1), (i - 1, j + 1)]

def check(king_pos):
	return queen_pos[0] == king_pos[0] or queen_pos[1] == king_pos[1] or queen_pos[0] - king_pos[0] == queen_pos[1] - king_pos[1]

def is_closer(first, second):
	return first[0] - target_pos[0] + first[1] - target_pos[1] >= second[0] - target_pos[0] + second[1] - target_pos[1]
stack = [king_pos]
visited = set(tuple(king_pos))
found = False
while stack:
	pos = stack.pop()
	if pos == tuple(target_pos):
		found = True
		break
	for next_pos in next_position(pos):
		if good(next_pos) and next_pos not in visited:
			visited.add(next_pos)
			stack.append(next_pos)
if found:
	print('YES')
else:
	print('NO')


n = int(input())
(x, y) = input().split()
x = int(x)
y = int(y)
(bx, by) = input().split()
bx = int(bx)
by = int(by)
(cx, cy) = input().split()
cx = int(cx)
cy = int(cy)
if (bx > x) == (cx > x) and (by > y) == (cy > y):
	print('YES')
else:
	print('NO')


dx = [0, -1, -1, -1, 0, 1, 1, 1]
dy = [-1, -1, 0, 1, 1, 1, 0, -1]
from sys import stdin, stdout
n = int(stdin.readline())
(qx, qy) = map(int, stdin.readline().split())
(kx, ky) = map(int, stdin.readline().split())
(tx, ty) = map(int, stdin.readline().split())
ans = 'YES'
if tx > qx and kx < qx or (tx < qx and kx > qx):
	ans = 'NO'
if ty > qy and ky < qy or (ty < qy and ky > qy):
	ans = 'NO'
stdout.write('{}\n'.format(ans))


import queue
n = int(input())
[qx, qy] = map(int, input().split())
[kx, ky] = map(int, input().split())
[tx, ty] = map(int, input().split())
kdx = kx - qx
kdy = ky - qy
tdx = tx - qx
tdy = ty - qy
if tdx * kdx > 0 and tdy * kdy > 0:
	print('YES')
else:
	print('NO')


n = int(input())
q = list(map(int, input().split(' ')))
k = list(map(int, input().split(' ')))
wannabe = list(map(int, input().split(' ')))
w = wannabe
up1 = [q[0] + 1, q[1] + 1]
up2 = [q[0] - 1, q[1] + 1]
down1 = [q[0] + 1, q[1] - 1]
down2 = [q[0] - 1, q[1] - 1]
if w == up1 or w == up2 or w == down1 or (w == down2):
	print('NO')
elif w[0] == q[0] or w[1] == q[1]:
	print('NO')
else:
	if k[0] > q[0]:
		xk = 1
	else:
		xk = 0
	if k[1] > q[1]:
		yk = 1
	else:
		yk = 0
	if w[0] > q[0]:
		xw = 1
	else:
		xw = 0
	if w[1] > q[1]:
		yw = 1
	else:
		yw = 0
	if xw == xk and yk == yw:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	queen = [int(x) for x in input().split()]
	king = [int(x) for x in input().split()]
	target = [int(x) for x in input().split()]
	for (k, q, t) in zip(king, queen, target):
		if (q - k) * (q - t) <= 0:
			print('NO')
			return
	print('YES')
solve()


from collections import defaultdict
import math
n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
if a2 < b2 and a2 > c2:
	print('NO')
elif a2 > b2 and a2 < c2:
	print('NO')
elif a1 < b1 and a1 > c1:
	print('NO')
elif a1 > b1 and a1 < c1:
	print('NO')
else:
	print('YES')


n = int(input())
R = lambda : map(int, input().split())
(ax, ay) = R()
(bx, by) = R()
(cx, cy) = R()
(minx, maxx) = (min(bx, cx), max(bx, cx))
(miny, maxy) = (min(by, cy), max(by, cy))
ans = not (minx <= ax <= maxx or miny <= ay <= maxy)
print('YES' if ans else 'NO')


from math import *
n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
if c1 != a1 and c2 != a2 and (abs(a1 - c1) != abs(a2 - c2)):
	if b1 < a1 and c1 < a1 and (b2 < a2) and (c2 < a2):
		print('YES')
		exit()
	elif b1 < a1 and c1 < a1 and (b2 > a2) and (c2 > a2):
		print('YES')
		exit()
	elif b1 > a1 and c1 > a1 and (b2 > a2) and (c2 > a2):
		print('YES')
		exit()
	elif b1 > a1 and c1 > a1 and (b2 < a2) and (c2 < a2):
		print('YES')
		exit()
print('NO')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
n = get_int()
(q_x, q_y) = get_int_list()
(k_x, k_y) = get_int_list()
(c_x, c_y) = get_int_list()
flag = True
if k_x > q_x:
	if c_x < q_x:
		flag = False
elif c_x > q_x:
	flag = False
if k_y > q_y:
	if c_y < q_y:
		flag = False
elif c_y > q_y:
	flag = False
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
(x, y) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if x2 > x and x3 > x and (y2 > y) and (y3 > y) or (x2 < x and x3 < x and (y2 < y) and (y3 < y)) or (x2 > x and x3 > x and (y2 < y) and (y3 < y)) or (x2 < x and x3 < x and (y2 > y) and (y3 > y)):
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split(' ')
b = input().split(' ')
c = input().split(' ')
for i in range(2):
	a[i] = int(a[i])
	b[i] = int(b[i])
	c[i] = int(c[i])
nahie = [[], [], [], []]
for i in range(a[0] - 1):
	for j in range(a[1] - 1):
		nahie[0] += [[i + 1, j + 1]]
for i in range(a[0] - 1):
	for j in range(a[1], n):
		nahie[1] += [[i + 1, j + 1]]
for i in range(a[0], n):
	for j in range(a[1], n):
		nahie[2] += [[i + 1, j + 1]]
for i in range(a[0], n):
	for j in range(a[1] - 1):
		nahie[3] += [[i + 1, j + 1]]
done = 'NO'
if b in nahie[0] and c in nahie[0]:
	done = 'YES'
if b in nahie[1] and c in nahie[1]:
	done = 'YES'
if b in nahie[2] and c in nahie[2]:
	done = 'YES'
if b in nahie[3] and c in nahie[3]:
	done = 'YES'
print(done)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
if min(b[0], c[0]) <= a[0] <= max(b[0], c[0]) or min(b[1], c[1]) <= a[1] <= max(b[1], c[1]):
	print('NO')
else:
	print('YES')


def reg(q, k):
	k[0] -= q[0]
	k[1] -= q[1]
	pos = 0
	if k[0] > 0:
		pos += 1
	else:
		pos += 2
	if k[1] > 0:
		pos += 4
	else:
		pos += 8
	return pos
n = int(input())
s = input().split()
a = [int(i) for i in s]
s = input().split()
b = [int(i) for i in s]
s = input().split()
c = [int(i) for i in s]
if reg(a, b) == reg(a, c):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
bax = bx < ax
cax = cx < ax
bay = by < ay
cay = cy < ay
if bax ^ cax == False and bay ^ cay == False:
	print('YES')
else:
	print('NO')


def sign(x):
	return x > 0 - x < 0
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
B = [B[0] - A[0], B[1] - A[1]]
C = [C[0] - A[0], C[1] - A[1]]
ok = True
if sign(B[0]) != sign(C[0]) or sign(B[1]) != sign(C[1]):
	ok = False
print(['NO', 'YES'][ok])


def check():
	if Cx < Qx < Kx or Cx > Qx > Kx or Cy < Qy < Ky or (Cy > Qy > Ky):
		print('NO')
		return
	print('YES')
n = int(input())
(Qx, Qy) = map(int, input().split(' '))
(Kx, Ky) = map(int, input().split(' '))
(Cx, Cy) = map(int, input().split(' '))
check()


n = int(input())
(ax, ay) = [int(el) for el in input().split()]
(bx, by) = [int(el) for el in input().split()]
(cx, cy) = [int(el) for el in input().split()]
if by < ay and cy > ay or (by > ay and cy < ay):
	print('NO')
	raise SystemExit
if cx < ax and bx > ax or (cx > ax and bx < ax):
	print('NO')
	raise SystemExit
print('YES')


n = int(input())
(a_x, a_y) = map(int, input().split())
(b_x, b_y) = map(int, input().split())
(c_x, c_y) = map(int, input().split())
if b_x < a_x < c_x or b_x > a_x > c_x or b_y < a_y < c_y or (b_y > a_y > c_y):
	print('NO')
else:
	print('YES')


def okay(qr, qc, kr, kc, tr, tc):
	return (qr - kr) * (qr - tr) > 0 and (qc - kc) * (qc - tc) > 0
n = int(input())
(qr, qc) = [int(s) - 1 for s in input().split()]
(kr, kc) = [int(s) - 1 for s in input().split()]
(tr, tc) = [int(s) - 1 for s in input().split()]
print('YES' if okay(qr, qc, kr, kc, tr, tc) else 'NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
same_side = False
same_above = False
if cx - ax < 0 and cx - bx < 0 or (cx - ax > 0 and cx - bx > 0):
	if abs(cx - ax) > abs(cx - bx):
		same_side = True
	else:
		same_side = False
else:
	same_side = True
if cy - ay < 0 and cy - by < 0 or (cy - ay > 0 and cy - by > 0):
	if abs(cy - ay) > abs(cy - by):
		same_above = True
	else:
		same_above = False
else:
	same_above = True
if same_side and same_above:
	print('YES')
else:
	print('NO')


def x(a, b):
	if a > b:
		return 1
	else:
		return 0
n = int(input())
(a1, a2) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
if a1 - a2 == b1 - b2:
	print('NO')
elif a1 + a2 == b1 + b2:
	print('NO')
elif a1 == b1:
	print('NO')
elif a2 == b2:
	print('NO')
elif a1 - a2 == c1 - c2:
	print('NO')
elif a1 + a2 == c1 + c2:
	print('NO')
elif a1 == c1:
	print('NO')
elif a2 == c2:
	print('NO')
elif x(a1, b1) == x(a1, c1) and x(a2, b2) == x(a2, c2):
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	(ax, ay) = (int(x) for x in input().split())
	(bx, by) = (int(x) for x in input().split())
	(cx, cy) = (int(x) for x in input().split())
	solver(ax, ay, bx, by, cx, cy)

def solver(ax, ay, bx, by, cx, cy):
	if notInRange(ax, bx, cx) and notInRange(ay, by, cy):
		print('YES')
	else:
		print('NO')

def notInRange(a, b, c):
	(bi, ci) = (min(b, c), max(b, c))
	return a < bi or a > ci
main()


input()
Q = list(map(int, input().split()))
K = list(map(int, input().split()))
T = list(map(int, input().split()))
if K[0] < Q[0] < T[0] or T[0] < Q[0] < K[0] or K[1] < Q[1] < T[1] or (T[1] < Q[1] < K[1]):
	print('NO')
else:
	print('YES')


n = int(input())
(fx, fy) = list(map(int, input().split()))
(kx, ky) = list(map(int, input().split()))
(px, py) = list(map(int, input().split()))
if kx < fx and px < fx or (kx > fx and px > fx):
	if ky < fy and py < fy or (ky > fy and py > fy):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = tuple(map(lambda x: int(x) - 1, input().split(' ')))
b = tuple(map(lambda x: int(x) - 1, input().split(' ')))
c = tuple(map(lambda x: int(x) - 1, input().split(' ')))
if 1:
	doska = [[0] * n for _ in range(n)]
	for i in range(n):
		doska[a[0]][i] = 1
	for i in range(n):
		doska[i][a[1]] = 1
	point = list(a)
	while True:
		point[0] -= 1
		point[1] -= 1
		if point[0] < 0 or point[1] < 0 or point[0] >= n or (point[1] >= n):
			break
		doska[point[0]][point[1]] = 1
	point = list(a)
	while True:
		point[0] += 1
		point[1] -= 1
		if point[0] < 0 or point[1] < 0 or point[0] >= n or (point[1] >= n):
			break
		doska[point[0]][point[1]] = 1
	point = list(a)
	while True:
		point[0] += 1
		point[1] += 1
		if point[0] < 0 or point[1] < 0 or point[0] >= n or (point[1] >= n):
			break
		doska[point[0]][point[1]] = 1
	point = list(a)
	while True:
		point[0] -= 1
		point[1] += 1
		if point[0] < 0 or point[1] < 0 or point[0] >= n or (point[1] >= n):
			break
		doska[point[0]][point[1]] = 1

def gen_funcs(v):
	change_0 = -1 if c[0] - v[0] < 0 else 1
	change_1 = -1 if c[1] - v[1] < 0 else 1
	retval = [lambda x: (x[0] + change_0, x[1]), lambda x: (x[0] + change_0, x[1] + change_1), lambda x: (x[0], x[1] + change_1)]
	if c[0] - v[0] == 0 or c[1] - v[1] == 0:
		retval.append(lambda x: (x[0] - change_0, x[1] - change_1))
		retval.append(lambda x: (x[0] - change_0, x[1] + change_1))
		retval.append(lambda x: (x[0] + change_0, x[1] - change_1))
		retval.append(lambda x: (x[0], x[1] - change_1))
		retval.append(lambda x: (x[0] - change_0, x[1]))
	return retval

def func():
	visited = set()
	stack = [b]
	while len(stack) > 0:
		v = stack.pop()
		visited.add(v)
		for child_func in gen_funcs(v):
			child = child_func(v)
			if child[0] < 0 or child[1] < 0 or child[0] >= n or (child[1] >= n):
				continue
			if doska[child[0]][child[1]] == 1:
				continue
			if child in visited:
				continue
			if child == c:
				return print('YES')
			stack.append(child)
	print('NO')
func()


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def findArea(x, y):
	if x > ax:
		if y < ay:
			return 4
		else:
			return 1
	elif y < ay:
		return 3
	else:
		return 2

def main():
	if findArea(bx, by) == findArea(cx, cy):
		print('YES')
	else:
		print('NO')
main()


from collections import deque
input = __import__('sys').stdin.readline
n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
dq = deque()
m = [[True for _ in range(n + 1)] for _ in range(n + 1)]
visited = [[False for _ in range(n + 1)] for _ in range(n + 1)]
for x in range(1, n + 1):
	m[ay][x] = False
for y in range(1, n + 1):
	m[y][ax] = False
(x, y) = (ax, ay)
while 1 <= x and 1 <= y:
	m[y][x] = False
	x -= 1
	y -= 1
(x, y) = (ax, ay)
while x <= n and y <= n:
	m[y][x] = False
	x += 1
	y += 1
(x, y) = (ax, ay)
while 1 <= x and y <= n:
	m[y][x] = False
	x -= 1
	y += 1
(x, y) = (ax, ay)
while x <= n and 1 <= y:
	m[y][x] = False
	x += 1
	y -= 1
visited[ay][ax] = True
dq.append([bx, by])

def inRange(x, y):
	return 1 <= x <= n and 1 <= y <= n

def push(x, y):
	if inRange(x, y) and m[y][x] and (not visited[y][x]):
		visited[y][x] = True
		dq.append([x, y])
while dq:
	(x, y) = dq.popleft()
	push(x + 1, y)
	push(x - 1, y)
	push(x, y + 1)
	push(x, y - 1)
	push(x + 1, y + 1)
	push(x - 1, y + 1)
	push(x + 1, y - 1)
	push(x - 1, y - 1)
if visited[cy][cx]:
	print('YES')
else:
	print('NO')


a = int(input())
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if x2 < x1 < x3 or x2 > x1 > x3 or y2 < y1 < y3 or (y2 > y1 > y3):
	print('NO')
else:
	print('YES')


Input = lambda : map(int, input().split())
n = int(input())
(ax, ay) = Input()
(bx, by) = Input()
(cx, cy) = Input()
if bx < ax and cx < ax or (bx > ax and cx > ax):
	if by < ay and cy < ay or (by > ay and cy > ay):
		print('YES')
		exit()
print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if (bx > ax, by > ay) != (cx > ax, cy > ay):
	print('NO')
	exit(0)
print('YES')


n = int(input())
[ax, ay] = map(int, input().split())
[bx, by] = map(int, input().split())
[cx, cy] = map(int, input().split())
(xt, yt) = (ax - bx, ay - by)
(xk, yk) = (ax - cx, ay - cy)
if xt * xk > 0 and yt * yk > 0 and (xt != yt) and (xk != yk):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = [int(x) for x in input().split()]
(bx, by) = [int(x) for x in input().split()]
(cx, cy) = [int(x) for x in input().split()]
if bx > ax > cx or cx > ax > bx:
	print('NO')
	return
elif by > ay > cy or cy > ay > by:
	print('NO')
	return
print('YES')


def sign(x):
	return x / abs(x)
n = int(input())
((ax, ay), (bx, by), (cx, cy)) = (map(int, input().split()) for i in range(3))
print(('NO', 'YES')[sign(ax - bx) == sign(ax - cx) and sign(ay - by) == sign(ay - cy)])


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
ax -= 1
ay -= 1
bx -= 1
cx -= 1
by -= 1
cy -= 1
if not bx <= ax <= cx and (not by <= ay <= cy) and (not abs(ax - cx) == abs(ay - cy)) and (not cx <= ax <= bx) and (not cy <= ay <= by):
	print('YES')
else:
	print('NO')


n = int(input())
Queen = list(map(int, input().split()))
Kingi = list(map(int, input().split()))
Kingf = list(map(int, input().split()))
diagx = []
diagy = []
x = Queen[0]
y = Queen[1]
while x != 0 and y != 0:
	diagx.append([x, y])
	x -= 1
	y -= 1
x = Queen[0]
y = Queen[1]
while x != n and y != n:
	x += 1
	y += 1
	diagx.append([x, y])
x = Queen[0]
y = Queen[1]
while x != n and y != 0:
	x += 1
	y -= 1
	diagx.append([x, y])
x = Queen[0]
y = Queen[1]
while x != 0 and y != n:
	x -= 1
	y += 1
	diagx.append([x, y])
if Kingf in diagx:
	print('NO')
elif Kingi[0] < Queen[0] and Kingi[1] < Queen[1]:
	if Kingf[0] < Queen[0] and Kingf[1] < Queen[1]:
		print('YES')
	else:
		print('NO')
elif Kingi[0] < Queen[0] and Kingi[1] > Queen[1]:
	if Kingf[0] < Queen[0] and Kingf[1] > Queen[1]:
		print('YES')
	else:
		print('NO')
elif Kingi[0] > Queen[0] and Kingi[1] < Queen[1]:
	if Kingf[0] > Queen[0] and Kingf[1] < Queen[1]:
		print('YES')
	else:
		print('NO')
elif Kingi[0] > Queen[0] and Kingi[1] > Queen[1]:
	if Kingf[0] > Queen[0] and Kingf[1] > Queen[1]:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys

def get_single_int():
	return int(sys.stdin.readline().strip())

def get_string():
	return sys.stdin.readline().strip()

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

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

def row():
	if bx < ax:
		if cx < ax:
			pass
		else:
			return False
	elif cx > ax:
		pass
	else:
		return False
	return True

def column():
	if by < ay:
		if cy < ay:
			pass
		else:
			return False
	elif cy > ay:
		pass
	else:
		return False
	return True
n = get_single_int()
(ax, ay) = get_ints()
(bx, by) = get_ints()
(cx, cy) = get_ints()
if row() and column():
	print('YES')
else:
	print('NO')


number = int(input())
(a, b) = map(int, input().split())
(x, y) = map(int, input().split())
(mx, mn) = map(int, input().split())
if x < a and mx < a and (y < b) and (mn < b):
	print('YES')
elif x > a and mx > a and (y < b) and (mn < b):
	print('YES')
elif x > a and mx > a and (y > b) and (mn > b):
	print('YES')
elif x < a and mx < a and (y > b) and (mn > b):
	print('YES')
else:
	print('NO')


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


n = int(input())
(q1, q2) = [int(x) for x in input().split()]
(b1, b2) = [int(x) for x in input().split()]
(c1, c2) = [int(x) for x in input().split()]
flag = int(0)
if b1 < q1 and c1 < q1:
	if b2 < q2 and c2 < q2:
		flag = 1
	elif b2 > q2 and c2 > q2:
		flag = 1
	else:
		flag = 0
elif b1 > q1 and c1 > q1:
	if b2 < q2 and c2 < q2:
		flag = 1
	elif b2 > q2 and c2 > q2:
		flag = 1
	else:
		flag = 0
else:
	flag = 0
if flag == 0:
	print('NO')
else:
	print('YES')


a = int(input())
(b, c) = map(int, input().split())
(d, e) = map(int, input().split())
(f, g) = map(int, input().split())
if d < b and e < c:
	if f < b and g < c:
		print('YES')
	else:
		print('NO')
elif d < b and e > c:
	if f < b and g > c:
		print('YES')
	else:
		print('NO')
elif d > b and e < c:
	if f > b and g < c:
		print('YES')
	else:
		print('NO')
if d > b and e > c:
	if f > b and g > c:
		print('YES')
	else:
		print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def under_attack(a, c):
	if a[0] == c[0] or a[1] == c[1]:
		return True
	(x, y) = (a[0], a[0])
	diff = 0
	return False

def get_square(p, c):
	if p[0] < c[0]:
		f = 1
	else:
		f = 2
	if p[1] < c[1]:
		x = 1
	else:
		x = 2
	return (f, x)

def is_one_square(a, b, c):
	return get_square(a, b) == get_square(a, c)
if not under_attack((ax, ay), (cx, cy)) and is_one_square((ax, ay), (bx, by), (cx, cy)):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
(dx, dy) = (bx - ax, by - ay)
(ex, ey) = (cx - ax, cy - ay)
if dx / abs(dx) == ex / abs(ex) and dy / abs(dy) == ey / abs(ey):
	print('YES')
else:
	print('NO')


n = int(input())
queen = list(map(int, input().split()))
king = list(map(int, input().split()))
target = list(map(int, input().split()))
if queen[0] > king[0] and queen[0] > target[0] or (queen[0] < king[0] and queen[0] < target[0]):
	if queen[1] > king[1] and queen[1] > target[1] or (queen[1] < king[1] and queen[1] < target[1]):
		print('YES')
		exit()
print('NO')


n = int(input())
queen = list(map(int, input().split()))
start = list(map(int, input().split()))
finish = list(map(int, input().split()))
if start[0] > queen[0] and start[1] > queen[1] and (finish[0] > queen[0]) and (finish[1] > queen[1]):
	print('YES')
elif start[0] < queen[0] and start[1] > queen[1] and (finish[0] < queen[0]) and (finish[1] > queen[1]):
	print('YES')
elif start[0] < queen[0] and start[1] < queen[1] and (finish[0] < queen[0]) and (finish[1] < queen[1]):
	print('YES')
elif start[0] > queen[0] and start[1] < queen[1] and (finish[0] > queen[0]) and (finish[1] < queen[1]):
	print('YES')
else:
	print('NO')


n = int(input())
(ax, ay) = list(map(int, input().split()))
(bx, by) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
x = [ax, bx, cx]
y = [ay, by, cy]
x.sort()
y.sort()
if x[1] != ax and y[1] != ay:
	print('YES')
else:
	print('NO')


import sys

def minp():
	return sys.stdin.readline().strip()

def g(x, y):
	r = 0
	if x > 0:
		r += 1
	if y > 0:
		r += 2
	return r
n = minp()
(x1, y1) = map(int, minp().split())
(x2, y2) = map(int, minp().split())
(x3, y3) = map(int, minp().split())
(x2, y2) = (x2 - x1, y2 - y1)
(x3, y3) = (x3 - x1, y3 - y1)
print('YES' if g(x2, y2) == g(x3, y3) else 'NO')


def r():
	return map(int, input().split(' '))
input()
(ax, ay) = r()
(bx, by) = r()
(cx, cy) = r()
print(['NO', 'YES'][(cx < ax) == (bx < ax) and (cy < ay) == (by < ay)])


import math
import os
import random
import re
import sys
n = int(input())
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if bx < ax and cx < ax:
	if by < ay and cy < ay:
		flag = 1
	elif by > ay and cy > ay:
		flag = 1
	else:
		flag = 0
elif bx > ax and cx > ax:
	if by < ay and cy < ay:
		flag = 1
	elif by > ay and cy > ay:
		flag = 1
	else:
		flag = 0
else:
	flag = 0
if flag == 1:
	print('YES')
else:
	print('NO')


from collections import deque
n = int(input())
(qr, qc) = map(int, input().split())
qr -= 1
qc -= 1
(sr, sc) = map(int, input().split())
sr -= 1
sc -= 1
(er, ec) = map(int, input().split())
er -= 1
ec -= 1

def is_lose(r, c):
	return r == qr or c == qc or abs(qr - r) == abs(qc - c)
DR = [-1, -1, 0, 1, 1, 1, 0, -1]
DC = [0, 1, 1, 1, 0, -1, -1, -1]

def bfs():
	visited = [[False for c in range(n)] for r in range(n)]
	q = deque()
	q.appendleft((sr, sc))
	visited[sr][sc] = True
	while q:
		(r, c) = q.pop()
		if r == er and c == ec:
			return True
		for i in range(8):
			nr = r + DR[i]
			nc = c + DC[i]
			if nr < 0 or nc < 0 or nr >= n or (nc >= n) or visited[nr][nc] or is_lose(nr, nc):
				continue
			visited[nr][nc] = True
			q.appendleft((nr, nc))
	return visited[er][ec]
ans = bfs()
print('YES' if ans else 'NO')


import sys
n = input()
(qx, qy) = map(int, input().split())
(kx, ky) = map(int, input().split())
(wx, wy) = map(int, input().split())
if kx - qx > 0 and wx - qx > 0:
	if ky - qy > 0 and wy - qy > 0:
		print('YES')
		sys.exit()
	if ky - qy < 0 and wy - qy < 0:
		print('YES')
		sys.exit()
if kx - qx < 0 and wx - qx < 0:
	if ky - qy > 0 and wy - qy > 0:
		print('YES')
		sys.exit()
	if ky - qy < 0 and wy - qy < 0:
		print('YES')
		sys.exit()
print('NO')


n = int(input())
(qx, qy) = map(int, input().split())
(kx, ky) = map(int, input().split())
(dx, dy) = map(int, input().split())
des = (dx, dy)
mylist = []
flag = True
if qx == dx or qy == dy:
	flag = False
elif dx > qx and kx < qx or (dx < qx and kx > qx):
	flag = False
elif dy > qy and ky < qy or (dy < qy and ky > qy):
	flag = False
else:
	i = qx
	j = qy
	while i - 1 >= 0 and j + 1 < n:
		i -= 1
		j += 1
		mylist.append((i, j))
	i = qx
	j = qy
	while i + 1 < n and j - 1 >= 0:
		i += 1
		j -= 1
		mylist.append((i, j))
	i = qx
	j = qy
	while i - 1 >= 0 and j - 1 >= 0:
		i -= 1
		j -= 1
		mylist.append((i, j))
	i = qx
	j = qy
	while i + 1 < n and j + 1 < n:
		i += 1
		j += 1
		mylist.append((i, j))
	if des in mylist:
		flag = False
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
(a, b) = map(int, input().split())
(b1, b2) = map(int, input().split())
(c1, c2) = map(int, input().split())
b1 -= a
b2 -= b
c1 -= a
c2 -= b
if b1 == 0 or b2 == 0 or c1 == 0 or (c2 == 0):
	print('NO')
elif b1 * c1 < 0 or b2 * c2 <= 0:
	print('NO')
else:
	print('YES')


from collections import deque
from sys import stdin
lines = deque((line.strip() for line in stdin.readlines()))

def nextline():
	return lines.popleft()

def types(cast, sep=None):
	return tuple((cast(x) for x in strs(sep=sep)))

def ints(sep=None):
	return types(int, sep=sep)

def strs(sep=None):
	return tuple(nextline()) if sep == '' else tuple(nextline().split(sep=sep))

def same_sign(k, g, q):
	return (k < q) == (g < q)

def main():
	n = int(nextline())
	(qx, qy) = ints()
	(kx, ky) = ints()
	(gx, gy) = ints()
	print('YES' if same_sign(kx, gx, qx) and same_sign(ky, gy, qy) else 'NO')
main()


x = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
if b[0] < a[0] and b[1] < a[1]:
	if c[0] < a[0] and c[1] < a[1]:
		print('YES')
	else:
		print('NO')
elif b[0] < a[0] and b[1] > a[1]:
	if c[0] < a[0] and c[1] > a[1]:
		print('YES')
	else:
		print('NO')
elif b[0] > a[0] and b[1] > a[1]:
	if c[0] > a[0] and c[1] > a[1]:
		print('YES')
	else:
		print('NO')
elif b[0] > a[0] and b[1] < a[1]:
	if c[0] > a[0] and c[1] < a[1]:
		print('YES')
	else:
		print('NO')


def x():
	return map(int, i().split())
i = input
n = int(i())
(ax, ay) = x()
(bx, by) = x()
(cx, cy) = x()
if cx == ax or cy == ay or abs(ax - cx) == abs(ay - cy) or (bx < ax < cx) or (bx > ax > cx) or (by < ay < cy) or (by > ay > cy):
	print('NO')
else:
	print('YES')


n = int(input())
queen = list(map(int, input().split(' ')))
king = list(map(int, input().split(' ')))
target = list(map(int, input().split(' ')))

def done():
	print('NO')
	exit()

def complete():
	print('YES')
	exit()
if king[0] < queen[0]:
	if target[0] > queen[0]:
		done()
	if king[1] > queen[1]:
		if target[1] < queen[1]:
			done()
		complete()
	else:
		if target[1] > queen[1]:
			done()
		complete()
else:
	if target[0] < queen[0]:
		done()
	if king[1] > queen[1]:
		if target[1] < queen[1]:
			done()
		complete()
	else:
		if target[1] > queen[1]:
			done()
		complete()


n = int(input())
(a, b) = [int(x) for x in input().split()]
(c1, d1) = [int(x) for x in input().split()]
(c2, d2) = [int(x) for x in input().split()]
i = 0
j = 0
k = 0
if a <= n and b <= n and (c1 <= n) and (d1 <= n) and (c2 <= n) and (d2 <= n):
	if (b - d1) / (a - c1) == 1 or (b - d1) / (a - c1) == -1 or (b - d2) / (a - c2) == 1 or ((b - d2) / (a - c2) == -1):
		k = 1
	else:
		k = 0
	if d1 > d2:
		y2 = d1
		y1 = d2
	if d2 >= d1:
		y2 = d2
		y1 = d1
	if c1 >= c2:
		x2 = c1
		x1 = c2
	if c2 > c1:
		x2 = c2
		x1 = c1
	if b <= y2 and b >= y1:
		i = 1
	else:
		i = 0
	if a <= x2 and a >= x1:
		j = 1
	else:
		j = 0
	if i == 1 or j == 1 or k == 1:
		print('NO')
	else:
		print('YES')
else:
	print('false')


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

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

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

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
n = getInt()
(ax, ay) = zzz()
(bx, by) = zzz()
(cx, cy) = zzz()
ax -= 1
ay -= 1
bx -= 1
by -= 1
cx -= 1
cy -= 1
check = [[0] * n for _ in range(n)]
q = deque()
check[bx][by] = 1
for i in range(n):
	check[ax][i] = 2
	check[i][ay] = 2
for i in range(n):
	if 0 <= ax - i < n and 0 <= ay - i < n:
		check[ax - i][ay - i] = 2
	if 0 <= ax - i < n and 0 <= ay + i < n:
		check[ax - i][ay + i] = 2
	if 0 <= ax + i < n and 0 <= ay - i < n:
		check[ax + i][ay - i] = 2
	if 0 <= ax + i < n and 0 <= ay + i < n:
		check[ax + i][ay + i] = 2
dx = [0, 1, 0, -1, 1, 1, -1, -1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
q.append((bx, by))
while q:
	(x, y) = q.popleft()
	for i in range(8):
		(nx, ny) = (x + dx[i], y + dy[i])
		if 0 <= nx < n and 0 <= ny < n:
			if check[nx][ny] == 0:
				check[nx][ny] = 1
				q.append((nx, ny))
print('YES' if check[cx][cy] == 1 else 'NO')


n = int(input())
(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))
(e, f) = list(map(int, input().split()))
if e <= c and f <= d:
	if a not in list(range(e, c + 1)) and b not in list(range(f, d + 1)):
		print('YES')
	else:
		print('NO')
elif e >= c and f >= d:
	if a not in list(range(c, e + 1)) and b not in list(range(d, f + 1)):
		print('YES')
	else:
		print('NO')
elif e >= c and f <= d:
	if a not in list(range(c, e + 1)) and b not in list(range(f, d + 1)):
		print('YES')
	else:
		print('NO')
elif e <= c and f >= d:
	if a not in list(range(e, c + 1)) and b not in list(range(d, f + 1)):
		print('YES')
	else:
		print('NO')


n = int(input())
queen = input().split()
queen = [int(i) for i in queen]
king = input().split()
king = [int(i) for i in king]
to = input().split()
to = [int(i) for i in to]

def check(king, queen, to):
	if king[0] < queen[0] and to[0] < queen[0]:
		if king[1] < queen[1] and to[1] < queen[1]:
			return 'YES'
	if king[0] < queen[0] and to[0] < queen[0]:
		if king[1] > queen[1] and to[1] > queen[1]:
			return 'YES'
	if king[0] > queen[0] and to[0] > queen[0]:
		if king[1] < queen[1] and to[1] < queen[1]:
			return 'YES'
	if king[0] > queen[0] and to[0] > queen[0]:
		if king[1] > queen[1] and to[1] > queen[1]:
			return 'YES'
	return 'NO'
print(check(king, queen, to))


n = int(input())
(ax, ay) = list(map(int, input().split()))
(bx, by) = list(map(int, input().split()))
(cx, cy) = list(map(int, input().split()))
mithoo = False
if bx < ax and by < ay:
	if cx < ax and cy < ay:
		mithoo = True
elif bx > ax and by < ay:
	if cx > ax and cy < ay:
		mithoo = True
elif bx > ax and by > ay:
	if cx > ax and cy > ay:
		mithoo = True
elif bx < ax and by > ay:
	if cx < ax and cy > ay:
		mithoo = True
if mithoo:
	print('YES')
else:
	print('NO')


w = input()
x = input()
y = input()
z = input()
queen = x.split()
king = y.split()
square = z.split()
a = int(king[0]) - int(queen[0])
b = int(queen[0]) - int(square[0])
c = int(king[1]) - int(queen[1])
d = int(queen[1]) - int(square[1])
if (a > 0 and b > 0 or (a < 0 and b < 0)) or (c > 0 and d > 0 or (c < 0 and d < 0)):
	print('NO')
else:
	print('YES')


n = int(input())
(a_x, a_y) = [int(val) for val in input().split()]
(b_x, b_y) = [int(val) for val in input().split()]
(c_x, c_y) = [int(val) for val in input().split()]
if (b_x < a_x and b_y < a_y) and (c_x < a_x and c_y < a_y):
	print('YES')
elif (b_x > a_x and b_y > a_y) and (c_x > a_x and c_y > a_y):
	print('YES')
elif (b_x < a_x and b_y > a_y) and (c_x < a_x and c_y > a_y):
	print('YES')
elif (b_x > a_x and b_y < a_y) and (c_x > a_x and c_y < a_y):
	print('YES')
else:
	print('NO')


n = int(input())
q = list(map(int, input().split(' ')))
q1 = int(q[0])
q2 = int(q[1])
aa = list(map(int, input().split(' ')))
a1 = int(aa[0])
a2 = int(aa[1])
bb = list(map(int, input().split(' ')))
b1 = int(bb[0])
b2 = int(bb[1])
a1 = a1 - q1
a2 = a2 - q2
b1 = b1 - q1
b2 = b2 - q2
if (a1 >= 0 and b1 >= 0 or (a1 < 0 and b1 < 0)) and (a2 >= 0 and b2 >= 0 or (a2 < 0 and b2 < 0)):
	print('YES')
else:
	print('NO')