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]

Difficulty: interview

Starter code:

Solutions:
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 ((cx < ax) == (bx < ax)) and ((cy < ay) == (by < ay)):
    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')


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())
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')
else:
    if b1*c1<0 or b2*c2<=0:print('NO')
    else:print('YES')

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'
    # sys.stdin = open('input.txt')
    # sys.stdout = open('output.txt', 'w')
else:
    sys.stdin = open('input.txt')
    # sys.stdin.close()
# sys.stdout = open('input.txt','w')

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')
    return
if math.copysign(x2, x1) != x2:
    print('NO')
    return
if math.copysign(y2, y1) != y2:
    print('NO')
    return
print('YES')

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 cx == ax or cy == ay or cx-cy==ax-ay or cx+cy==ax+ay:
#       print('YES')
#       return
    if (ax-bx)*(ax-cx) > 0 and (ay-by)*(ay-cy) > 0:
        print('YES')
    else:
        print('NO')

__starting_point()

# make sure the king never crosses the row or column the queen is in

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 < cx or bx > ax > cx or by < ay < cy or cy < ay < by:
    print('NO')
else:
    print('YES')


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

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

if bx < ax < cx:
    print("NO")
elif cx < ax < bx:
    print("NO")
elif by < ay < cy:
    print("NO")
elif cy < ay < by:
    print("NO")
else:
    print("YES")

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


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

# B = [abs(B[0]), abs(B[1])]
# C = [abs(C[0]), abs(C[1])]

# if B[0] > B[1] and C[0] < C[1]:
#     ok = False
# if B[0] < B[1] and C[0] > C[1]:
#     ok = False

print(["NO", "YES"][ok])


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

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


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

bx -= ax
cx -= ax
by -= ay
cy -= ay

if bx * cx > 0 and by * cy > 0:
    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()))
if (min(ax, cx) <= bx and bx <= max(ax, cx)):
      print("NO");
elif (min(ay, cy) <= by and by <= max(ay, 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()]


if (bx < ax < cx) or (bx > ax > cx) or (by < ay < cy) or (by > ay > cy):
    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())

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 = list(map(int, input().split()))
ax, ay = list(map(int, input().split()))
cx, cy = list(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")


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")
else:
    if((x(a1,b1)==x(a1,c1)) and (x(a2,b2)==x(a2,c2))):
        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 (ax-bx)*(ax-cx) > 0 and (ay-by)*(ay-cy) > 0:
    print("YES")
else:
    print("NO")


import sys

next(sys.stdin)

q_x, q_y = list(map(int, next(sys.stdin).rstrip().split()))
k_x, k_y = list(map(int, next(sys.stdin).rstrip().split()))
dest_x, dest_y = list(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")



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 = list(map(int, input().split()))
kx, ky = list(map(int, input().split()))
cx, cy = list(map(int, input().split()))

if quadrant(kx, ky, qx, qy) == quadrant(cx, cy, qx, qy):
	print("YES")
else:
	print("NO")


n = int(input()) 
ax,ay = [int(s) for s in input().split()]
bx,by = [int(s) for s in input().split()]
cx,cy = [int(s) for s in input().split()]
if ((bx-ax < 0 and cx-ax < 0 or
    bx-ax > 0 and cx-ax > 0) and
    (by-ay < 0 and cy-ay < 0 or
    by-ay > 0 and cy-ay > 0)):
        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')