While playing chess, Chef noticed that it is generally advantageous for him if his knight attacks two or more of his opponent's pieces simultaneously. To practice this skill, Chef decided to perform the following exercise:

Take an empty 8 \times 8 chessboard, and any two white pieces.
Choose two distinct cells (X_{1}, Y_{1}), (X_{2}, Y_{2}) and place the pieces on those cells (the cell at the intersection of the i-th row and j-th column is denoted (i, j)).
Check if there exists an empty cell where he can place a black knight in such a way that the knight attacks both the white pieces simultaneously.

Given the position of the two white pieces (X_{1}, Y_{1}), (X_{2}, Y_{2}), print 'YES' if there exists an empty cell where he can place a black knight in such a way that the knight attacks both the white pieces simultaneously, otherwise print NO.

For reference, a knight attacks a piece placed in a cell that is:
One square horizontally and two squares vertically away from it, or
One square vertically and two squares horizontally away from it

A visual description of this may be found [here]#Movement).

------ Input Format ------ 

- The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
- The first line of each test case contains two space-separated integers X_{1} and Y_{1}, the position of first white piece.
- The second line of each test case contains two space-separated integers X_{2} and Y_{2}, the position of second white piece.

------ Output Format ------ 

For each test case, output the answer on a new line — YES if there exists an empty cell where Chef can place a black knight in such a way that the knight attacks both the white pieces simultaneously, and NO otherwise.

You may print each character of YES and NO in either uppercase or lowercase (for example, yes, yEs, Yes will be considered identical). 

------ Constraints ------ 

$1 ≤ T ≤ 5000$
$1 ≤ X_{1}, Y_{1} ≤ 8$
$1 ≤ X_{2}, Y_{2} ≤ 8$
- Both the cells are distinct

----- Sample Input 1 ------ 
4
1 1
1 2
1 1
1 3
1 1
1 4
1 1
1 5
----- Sample Output 1 ------ 
NO
YES
NO
YES

----- explanation 1 ------ 
Test case $2$: Chef can place a knight at $(3, 2)$, forking both pieces.

Test case $4$: Chef can place a knight at $(2, 3)$, forking both pieces.

In the other two cases it can be verified that there is no way to place a knight that attacks both pieces at the same time.

Source: codechef | Difficulty: MEDIUM
Tags: Data structures


Solutions:
def kni(x, y):
	lst = []
	if x > 1 and y > 2:
		lst.append([x - 1, y - 2])
	if x < 8 and y > 2:
		lst.append([x + 1, y - 2])
	if x > 2 and y > 1:
		lst.append([x - 2, y - 1])
	if x < 7 and y > 1:
		lst.append([x + 2, y - 1])
	if x > 2 and y < 8:
		lst.append([x - 2, y + 1])
	if x < 7 and y < 8:
		lst.append([x + 2, y + 1])
	if x > 1 and y < 7:
		lst.append([x - 1, y + 2])
	if x < 8 and y < 7:
		lst.append([x + 1, y + 2])
	return lst
t = int(input())
while t > 0:
	f = 0
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	p1 = kni(x1, y1)
	p2 = kni(x2, y2)
	for p in p1:
		if p in p2:
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


l = [[0 for i in range(8)] for j in range(8)]

def che(x, y):
	fill(x + 1, y + 2)
	fill(x + 2, y + 1)
	fill(x - 1, y + 2)
	fill(x - 1, y - 2)
	fill(x + 1, y - 2)
	fill(x + 2, y - 1)
	fill(x - 2, y + 1)
	fill(x - 2, y - 1)

def fill(x, y):
	if x >= 0 and x < 8 and (y >= 0) and (y < 8):
		l[y][x] += 1
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(c, d) = map(int, input().split())
	che(a - 1, b - 1)
	che(c - 1, d - 1)
	w = 0
	for i in range(8):
		if l[i].count(2) >= 1:
			w = 1
			break
	if w == 0:
		print('NO')
	else:
		print('YES')
	l = [[0 for i in range(8)] for j in range(8)]


def isCorner(r, c):
	if r == 1 or r == 8:
		if c == 1 or c == 8:
			return True
		else:
			return False
	else:
		return False
T = int(input())
for i in range(T):
	(X1, Y1) = [int(n) for n in input().split()]
	(X2, Y2) = [int(n) for n in input().split()]
	if X1 == X2 and abs(Y1 - Y2) == 2 or (Y1 == Y2 and abs(X1 - X2) == 2):
		print('YES')
		continue
	elif X1 == X2 and abs(Y1 - Y2) == 4 or (Y1 == Y2 and abs(X1 - X2) == 4):
		print('YES')
		continue
	elif abs(X1 - X2) == 2 and abs(Y1 - Y2) == 4 or (abs(Y1 - Y2) == 2 and abs(X1 - X2) == 4):
		print('YES')
		continue
	elif abs(X1 - X2) == 1 and abs(Y1 - Y2) == 3 or (abs(Y1 - Y2) == 1 and abs(X1 - X2) == 3):
		print('YES')
		continue
	elif abs(X1 - X2) == 3 and abs(Y1 - Y2) == 3:
		print('YES')
		continue
	elif abs(X1 - X2) == 1 and abs(Y1 - Y2) == 1:
		if isCorner(X1, Y1) == False and isCorner(X2, Y2) == False:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


moves = [[2, 1], [2, -1], [-2, 1], [-2, -1], [1, 2], [1, -2], [-1, 2], [-1, -2]]
for i in range(int(input())):
	boll = False
	c1 = input().split()
	c1 = [int(val) for val in c1]
	c2 = input().split()
	c2 = [int(val) for val in c2]
	for move in moves:
		point = [c1[0] + move[0], c1[1] + move[1]]
		if point[0] >= 1 and point[0] <= 8 and (point[1] >= 1) and (point[1] <= 8):
			for move2 in moves:
				point2 = [c2[0] + move2[0], c2[1] + move2[1]]
				if point2[0] >= 1 and point2[0] <= 8 and (point2[1] >= 1) and (point2[1] <= 8):
					if point2 == point:
						boll = True
						print('YES')
						break
			if boll:
				break
	if not boll:
		print('NO')


rel_pos = [[1, 2], [2, 1], [1, -2], [2, -1], [-1, 2], [-1, -2], [-2, 1], [-2, -1]]

def knight_circle(x1, y1):
	li = []
	for pos in rel_pos:
		if x1 + pos[0] >= 1 and x1 + pos[0] <= 8:
			if y1 + pos[1] >= 1 and y1 + pos[1] <= 8:
				li.append([x1 + pos[0], y1 + pos[1]])
	return li
for _ in range(int(input())):
	res = 'NO'
	(x1, y1) = map(int, input().split(' '))
	(x2, y2) = map(int, input().split(' '))
	li1 = knight_circle(x1, y1)
	li2 = knight_circle(x2, y2)
	for i in li1:
		if i in li2:
			res = 'YES'
			break
	print(res)


t = int(input())
for _ in range(t):
	d = {}
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	dx = [-2, -2, 2, 2, -1, 1, -1, 1]
	dy = [-1, 1, -1, 1, -2, -2, 2, 2]
	for i in range(8):
		kp = (x1 + dx[i], y1 + dy[i])
		d[kp] = 1
	for i in range(8):
		kp = (x2 + dx[i], y2 + dy[i])
		if kp in d and kp[0] >= 1 and (kp[0] <= 8) and (kp[1] >= 1) and (kp[1] <= 8):
			print('YES')
			break
	else:
		print('NO')


for _ in range(int(input())):
	(x1, y1) = list(map(int, input().split()))
	(x2, y2) = list(map(int, input().split()))
	n = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
	for (dx, dy) in n:
		nx = x1 + dx
		ny = y1 + dy
		if (nx - x2, ny - y2) in n:
			if nx >= 1 and nx <= 8 and (ny >= 1) and (ny <= 8):
				print('YES')
				break
	else:
		print('NO')


N_moves = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
for tx in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	for (dx, dy) in N_moves:
		nx = x1 + dx
		ny = y1 + dy
		if (nx - x2, ny - y2) in N_moves:
			if nx >= 1 and nx <= 8 and (ny >= 1) and (ny <= 8):
				print('YES')
				break
	else:
		print('NO')


for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	c = 0
	a1 = [[x1 - 1, y1 - 2], [x1 - 2, y1 - 1], [x1 + 1, y1 + 2], [x1 + 2, y1 + 1], [x1 - 1, y1 + 2], [x1 - 2, y1 + 1], [x1 + 1, y1 - 2], [x1 + 2, y1 - 1]]
	a2 = [[x2 - 1, y2 - 2], [x2 - 2, y2 - 1], [x2 + 1, y2 + 2], [x2 + 2, y2 + 1], [x2 - 1, y2 + 2], [x2 - 2, y2 + 1], [x2 + 1, y2 - 2], [x2 + 2, y2 - 1]]
	for i in a1:
		for j in a2:
			if i == j and (i[0] > 0 and i[0] < 9 and (i[1] > 0) and (i[1] < 9)) and (j[0] > 0 and j[0] < 9 and (j[1] > 0) and (j[1] < 9)):
				print('YES')
				c = -1
				break
		if c == -1:
			break
	if c == 0:
		print('NO')


def remove_neg(arr):
	n = 0
	while n < len(arr):
		(i, j) = arr[n]
		if i < 1 or j < 1 or i > 8 or (j > 8):
			del arr[n]
			n -= 1
		n += 1
	return arr
for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	c = False
	a1 = [[x1 - 2, y1 - 1], [x1 - 2, y1 + 1], [x1 - 1, y1 - 2], [x1 - 1, y1 + 2], [x1 + 1, y1 - 2], [x1 + 1, y1 + 2], [x1 + 2, y1 - 1], [x1 + 2, y1 + 1]]
	a2 = [[x2 - 2, y2 - 1], [x2 - 2, y2 + 1], [x2 - 1, y2 - 2], [x2 - 1, y2 + 2], [x2 + 1, y2 - 2], [x2 + 1, y2 + 2], [x2 + 2, y2 - 1], [x2 + 2, y2 + 1]]
	remove_neg(a1)
	remove_neg(a2)
	for a in a1:
		for b in a2:
			if a == b:
				c = True
				break
	if c:
		print('YES')
	else:
		print('NO')


def remove_neg(arr):
	n = 0
	while n < len(arr):
		(i, j) = arr[n]
		if i < 1 or j < 1 or i > 8 or (j > 8):
			del arr[n]
			n -= 1
		n += 1
	return arr
for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	h1 = [[x1 - 2, y1 - 1], [x1 - 2, y1 + 1], [x1 - 1, y1 - 2], [x1 - 1, y1 + 2], [x1 + 1, y1 - 2], [x1 + 1, y1 + 2], [x1 + 2, y1 - 1], [x1 + 2, y1 + 1]]
	h2 = [[x2 - 2, y2 - 1], [x2 - 2, y2 + 1], [x2 - 1, y2 - 2], [x2 - 1, y2 + 2], [x2 + 1, y2 - 2], [x2 + 1, y2 + 2], [x2 + 2, y2 - 1], [x2 + 2, y2 + 1]]
	remove_neg(h1)
	remove_neg(h2)
	ans = False
	for a in h1:
		for b in h2:
			if a == b:
				ans = True
	if ans:
		print('YES')
	else:
		print('NO')


(t, n) = (int(input()), 1)
N_pos = [(-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2, 1)]
while n <= t:
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	for (cx, cy) in N_pos:
		nx = x1 + cx
		ny = y1 + cy
		if (nx - x2, ny - y2) in N_pos:
			if nx >= 1 and nx <= 8 and (ny >= 1) and (ny <= 8):
				print('YES')
				break
	else:
		print('NO')
	n += 1


for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	first = []
	if x1 - 1 > 0:
		if y1 - 2 > 0:
			first.append((x1 - 1, y1 - 2))
		if y1 + 2 < 9:
			first.append((x1 - 1, y1 + 2))
	if x1 - 2 > 0:
		if y1 - 1 > 0:
			first.append((x1 - 2, y1 - 1))
		if y1 + 1 < 9:
			first.append((x1 - 2, y1 + 1))
	if x1 + 1 < 9:
		if y1 - 2 > 0:
			first.append((x1 + 1, y1 - 2))
		if y1 + 2 < 9:
			first.append((x1 + 1, y1 + 2))
	if x1 + 2 < 9:
		if y1 - 1 > 0:
			first.append((x1 + 2, y1 - 1))
		if y1 + 1 < 9:
			first.append((x1 + 2, y1 + 1))
	f1 = set(first)
	first = []
	if x2 - 1 > 0:
		if y2 - 2 > 0:
			first.append((x2 - 1, y2 - 2))
		if y2 + 2 < 9:
			first.append((x2 - 1, y2 + 2))
	if x2 - 2 > 0:
		if y2 - 1 > 0:
			first.append((x2 - 2, y2 - 1))
		if y2 + 1 < 9:
			first.append((x2 - 2, y2 + 1))
	if x2 + 1 < 9:
		if y2 - 2 > 0:
			first.append((x2 + 1, y2 - 2))
		if y2 + 2 < 9:
			first.append((x2 + 1, y2 + 2))
	if x2 + 2 < 9:
		if y2 - 1 > 0:
			first.append((x2 + 2, y2 - 1))
		if y2 + 1 < 9:
			first.append((x2 + 2, y2 + 1))
	f2 = set(first)
	if len(f1 & f2) >= 1:
		print('YES')
	else:
		print('NO')


import sys
import random
from collections import defaultdict

class DefaultDict:

	def __init__(self, default=None):
		self.default = default
		self.x = random.randrange(1, 1 << 31)
		self.dd = defaultdict(default)

	def __repr__(self):
		return '{' + ', '.join((f'{k ^ self.x}: {v}' for (k, v) in self.dd.items())) + '}'

	def __eq__(self, other):
		for k in set(self) | set(other):
			if self[k] != other[k]:
				return False
		return True

	def __or__(self, other):
		res = DefaultDict(self.default)
		for (k, v) in self.dd:
			res[k] = v
		for (k, v) in other.dd:
			res[k] = v
		return res

	def __len__(self):
		return len(self.dd)

	def __getitem__(self, item):
		return self.dd[item ^ self.x]

	def __setitem__(self, key, value):
		self.dd[key ^ self.x] = value

	def __delitem__(self, key):
		del self.dd[key ^ self.x]

	def __contains__(self, item):
		return item ^ self.x in self.dd

	def items(self):
		for (k, v) in self.dd.items():
			yield (k ^ self.x, v)

	def keys(self):
		for k in self.dd:
			yield (k ^ self.x)

	def values(self):
		for v in self.dd.values():
			yield v

	def __iter__(self):
		for k in self.dd:
			yield (k ^ self.x)

class Counter(DefaultDict):

	def __init__(self, aa=[]):
		super().__init__(int)
		for a in aa:
			self.dd[a ^ self.x] += 1

	def __add__(self, other):
		res = Counter()
		for k in set(self) | set(other):
			v = self[k] + other[k]
			if v > 0:
				res[k] = v
		return res

	def __sub__(self, other):
		res = Counter()
		for k in set(self) | set(other):
			v = self[k] - other[k]
			if v > 0:
				res[k] = v
		return res

	def __and__(self, other):
		res = Counter()
		for k in self:
			v = min(self[k], other[k])
			if v > 0:
				res[k] = v
		return res

	def __or__(self, other):
		res = Counter()
		for k in set(self) | set(other):
			v = max(self[k], other[k])
			if v > 0:
				res[k] = v
		return res

class Set:

	def __init__(self, aa=[]):
		self.x = random.randrange(1, 1 << 31)
		self.st = set()
		for a in aa:
			self.st.add(a ^ self.x)

	def __repr__(self):
		return '{' + ', '.join((str(k ^ self.x) for k in self.st)) + '}'

	def __len__(self):
		return len(self.st)

	def add(self, item):
		self.st.add(item ^ self.x)

	def discard(self, item):
		self.st.discard(item ^ self.x)

	def __contains__(self, item):
		return item ^ self.x in self.st

	def __iter__(self):
		for k in self.st:
			yield (k ^ self.x)

	def pop(self):
		return self.st.pop() ^ self.x

	def __or__(self, other):
		res = Set(self)
		for a in other:
			res.add(a)
		return res

	def __and__(self, other):
		res = Set()
		for a in self:
			if a in other:
				res.add(a)
		for a in other:
			if a in self:
				res.add(a)
		return res
int1 = lambda x: int(x) - 1
pDB = lambda *x: print(*x, end='\n', file=sys.stderr)
p2D = lambda x: print(*x, sep='\n', end='\n\n', file=sys.stderr)

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
inf = (1 << 63) - 1
md = 10 ** 9 + 7

def solve():

	def pos(i, j):
		res = set()
		for a in range(1, 3):
			for c in [1, -1]:
				for d in [1, -1]:
					di = a * c
					dj = (3 - a) * d
					(ni, nj) = (i + di, j + dj)
					if ni < 0 or ni >= n or nj < 0 or (nj >= n):
						continue
					res.add((ni, nj))
		return res
	n = 8
	(i, j) = LI1()
	(x, y) = LI1()
	return pos(i, j) & pos(x, y)
testnumber = II()
for testcase in range(testnumber):
	print('YES' if solve() else 'NO')


from math import gcd, sqrt, ceil, floor, log10, log2
from heapq import heapify, heappop, heappush, nsmallest, nlargest
from collections import Counter, deque, OrderedDict, defaultdict
from itertools import combinations, permutations, zip_longest
from bisect import bisect_left, bisect_right
from functools import lru_cache, reduce
import sys
import time
import string
import operator
RECURSION_LIMIT = int(10000000.0)
INT_MAX = float('inf')
INT_MIN = float('-inf')
MOD = int(1000000000.0) + 7
NEWLINE = '\n'
SPACE = ' '
sys.setrecursionlimit(RECURSION_LIMIT)
inp = lambda fn: fn(input())
inp_vars = lambda fn, delim, convert_to=list: convert_to(map(fn, input().split(delim)))

def inp_graph(n, adj, gtype=0):
	pass

def solve(*args, **kwargs):
	((x1, y1), (x2, y2)) = args
	pos1 = [(x1 + 2, y1 + 1), (x1 + 2, y1 - 1), (x1 - 2, y1 + 1), (x1 - 2, y1 - 1), (x1 - 1, y1 + 2), (x1 + 1, y1 + 2), (x1 - 1, y1 - 2), (x1 + 1, y1 - 2)]
	pos2 = [(x2 + 2, y2 + 1), (x2 + 2, y2 - 1), (x2 - 2, y2 + 1), (x2 - 2, y2 - 1), (x2 - 1, y2 + 2), (x2 + 1, y2 + 2), (x2 - 1, y2 - 2), (x2 + 1, y2 - 2)]
	for (X1, Y1) in pos1:
		if X1 <= 0 or X1 > 8 or Y1 <= 0 or (Y1 > 8):
			continue
		for (X2, Y2) in pos2:
			if X2 <= 0 or X2 > 8 or Y2 <= 0 or (Y2 > 8):
				continue
			if (X1, Y1) == (X2, Y2):
				return 'YES'
	return 'NO'

def main(*args, **kwargs):
	for _ in range(int(input())):
		arg2 = inp_vars(int, SPACE)
		arg3 = inp_vars(int, SPACE)
		res = solve(*(arg2, arg3))
		if type(res) in {list, tuple, set}:
			print(*res, sep=' ')
		else:
			print(res)
main()


def solve():
	(a, b) = map(int, input().split())
	(x, y) = map(int, input().split())
	s = set()
	for d in [b + 1, b - 1]:
		if d >= 1 and d <= 8:
			for c in [a + 2, a - 2]:
				if c >= 1 and c <= 8:
					s.add((c, d))
	for d in [b + 2, b - 2]:
		if d >= 1 and d <= 8:
			for c in [a + 1, a - 1]:
				if c >= 1 and c <= 8:
					s.add((c, d))
	for d in [y + 1, y - 1]:
		if d >= 1 and d <= 8:
			for c in [x + 2, x - 2]:
				if c >= 1 and c <= 8:
					if (c, d) in s:
						return 'YES'
	for d in [y + 2, y - 2]:
		if d >= 1 and d <= 8:
			for c in [x + 1, x - 1]:
				if c >= 1 and c <= 8:
					if (c, d) in s:
						return 'YES'
	return 'NO'
for _ in range(int(input())):
	print(solve())


import collections as clts
import math
import heapq

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

def lcm(x, y):
	return int(x / gcd(x, y) * y)

def take_input(type='int'):
	if type == 'int':
		return int(input())
	elif type == 'str':
		return input()
	elif type == 'list-int':
		return list(map(int, input().split()))
	elif type == 'list-float':
		return list(map(float, input().split()))
	else:
		return None
for _ in range(int(input())):
	(X1, Y1) = take_input('list-int')
	(X2, Y2) = take_input('list-int')
	cellsH = [+1, -1, +2, -2]
	cellsV = [+2, -2, +1, -1]
	(empty1, empty2) = (set(), set())
	for i in range(len(cellsH)):
		for j in range(len(cellsV)):
			if abs(cellsH[i]) != abs(cellsV[j]):
				(x1, y1) = (cellsH[i] + X1, cellsV[j] + Y1)
				(x2, y2) = (cellsH[i] + X2, cellsV[j] + Y2)
				if x1 >= 1 and x1 <= 8 and (y1 >= 1) and (y1 <= 8):
					empty1.add((x1, y1))
				if x2 >= 1 and x2 <= 8 and (y2 >= 1) and (y2 <= 8):
					empty2.add((x2, y2))
			else:
				continue
	cells = empty1.intersection(empty2)
	if len(cells) > 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	(c, d) = map(int, input().split())
	l = []
	l.append(a - 1)
	l.append(b + 2)
	l.append(a - 2)
	l.append(b + 1)
	l.append(a + 1)
	l.append(b - 2)
	l.append(a + 2)
	l.append(b - 1)
	l.append(a + 1)
	l.append(b + 2)
	l.append(a + 2)
	l.append(b + 1)
	l.append(a - 1)
	l.append(b - 2)
	l.append(a - 2)
	l.append(b - 1)
	flag = 0
	for i in range(0, len(l) - 1, 2):
		if c + 1 == l[i] and 1 <= c + 1 <= 8:
			if d - 2 == l[i + 1] and 1 <= d - 2 <= 8:
				flag = 1
		if c + 2 == l[i] and 1 <= c + 2 <= 8:
			if d - 1 == l[i + 1] and 1 <= d - 1 <= 8:
				flag = 1
		if c - 1 == l[i] and 1 <= c - 1 <= 8:
			if d + 2 == l[i + 1] and 1 <= d + 2 <= 8:
				flag = 1
		if c - 2 == l[i] and 1 <= c - 2 <= 8:
			if d + 1 == l[i + 1] and 1 <= d + 1 <= 8:
				flag = 1
		if c + 1 == l[i] and 1 <= c + 1 <= 8:
			if d + 2 == l[i + 1] and 1 <= d + 2 <= 8:
				flag = 1
		if c + 2 == l[i] and 1 <= c + 2 <= 8:
			if d + 1 == l[i + 1] and 1 <= d + 1 <= 8:
				flag = 1
		if c - 1 == l[i] and 1 <= c - 1 <= 8:
			if d - 2 == l[i + 1] and 1 <= d - 2 <= 8:
				flag = 1
		if c - 2 == l[i] and 1 <= c - 2 <= 8:
			if d - 1 == l[i + 1] and 1 <= d - 1 <= 8:
				flag = 1
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for z in range(t):
	a = list((int(i) for i in input().split(' ')))
	b = list((int(i) for i in input().split(' ')))
	(x, y) = ([], [])
	(x1, y1, x2, y2) = (a[0], a[1], b[0], b[1])
	for i in range(2):
		if i:
			p = 2
		else:
			p = 1
		if p == 2:
			q = 1
		else:
			q = 2
		x.append([x1 + p, y1 + q])
		x.append([x1 - p, y1 - q])
		x.append([x1 + p, y1 - q])
		x.append([x1 - p, y1 + q])
		y.append([x2 + p, y2 + q])
		y.append([x2 - p, y2 - q])
		y.append([x2 + p, y2 - q])
		y.append([x2 - p, y2 + q])
	ans = 'NO'
	an = [0, 0]
	for i in x:
		if i in y and (not (i[0] > 8 or i[1] < 1 or i[1] > 8 or (i[0] < 1))):
			ans = 'YES'
			an = i
			break
	print(ans)


def check(x1, y1, x2, y2):
	dx = [2, -2, 1, -1, -1, 1, -2, 2]
	dy = [-1, 1, -2, 2, -2, 2, -1, 1]
	m1 = []
	m2 = []
	for i in range(8):
		x = x1 + dx[i]
		y = y1 + dy[i]
		if x >= 1 and x <= 8 and (y <= 8) and (y >= 1):
			m1.append([x, y])
	for i in range(8):
		x = x2 + dx[i]
		y = y2 + dy[i]
		if x >= 1 and x <= 8 and (y <= 8) and (y >= 1):
			m2.append([x, y])
	for i in m1:
		if i in m2:
			return True
	return False
t = int(input())
for i in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	check(x1, y1, x2, y2)
	isPossible = check(x1, y1, x2, y2)
	if isPossible:
		print('YES')
	else:
		print('NO')


def pos(x, y):
	ls = []
	if x > 1 and y > 2:
		ls.append([x - 1, y - 2])
	if x < 8 and y > 2:
		ls.append([x + 1, y - 2])
	if x > 2 and y > 1:
		ls.append([x - 2, y - 1])
	if x < 7 and y > 1:
		ls.append([x + 2, y - 1])
	if x > 2 and y < 8:
		ls.append([x - 2, y + 1])
	if x < 7 and y < 8:
		ls.append([x + 2, y + 1])
	if x > 1 and y < 7:
		ls.append([x - 1, y + 2])
	if x < 8 and y < 7:
		ls.append([x + 1, y + 2])
	return ls
for t in range(int(input())):
	f = 0
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	p1 = pos(x1, y1)
	p2 = pos(x2, y2)
	for p in p1:
		if p in p2:
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


directions = [(1, 2), (-1, 2), (1, -2), (-1, -2), (2, 1), (-2, 1), (2, -1), (-2, -1)]
for _ in range(int(input())):
	found = False
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	for i in range(1, 9):
		for j in range(1, 9):
			cells = list(map(lambda dir: (i + dir[0], j + dir[1]), directions))
			if (x1, y1) in cells and (x2, y2) in cells:
				print('YES')
				found = True
				break
		if found:
			break
	if not found:
		print('NO')


T = int(input())
ans = []
for i in range(T):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	if x1 > x2:
		a = x1 - x2
	else:
		a = x2 - x1
	if y1 > y2:
		b = y1 - y2
	else:
		b = y2 - y1
	if a > 4 or b > 4:
		ans.append('NO')
	elif (x1 == 1 and y1 == 1 or (x2 == 1 and y2 == 1) or (x1 == 1 and y1 == 8) or (x2 == 1 and y2 == 8) or (x1 == 8 and y1 == 8) or (x2 == 8 and y2 == 8) or (x1 == 8 and y1 == 1) or (x2 == 8 and y2 == 1)) and a == 1 and (b == 1):
		ans.append('NO')
	elif b == 2 and a == 2 or (b == 4 and a == 4) or (a == 0 and b == 0):
		ans.append('NO')
	elif a % 2 == 0 and b % 2 == 0:
		ans.append('YES')
	elif a % 2 == 1 and b % 2 == 1:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


import math as m

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return abs(a)

def ncr(N, R):
	return m.factorial(N) // (m.factorial(R) * m.factorial(N - R))

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

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

def chk(r, c):
	if (r > 0 and c > 0) and (r < 9 and c < 9):
		return True
	return False

def findpair(a, b):
	mypairs = set()
	r = a - 2
	c = b - 1
	if chk(r, c):
		mypairs.add((r, c))
	r = a - 1
	c = b - 2
	if chk(r, c):
		mypairs.add((r, c))
	r = a - 2
	c = b + 1
	if chk(r, c):
		mypairs.add((r, c))
	r = a - 1
	c = b + 2
	if chk(r, c):
		mypairs.add((r, c))
	r = a + 2
	c = b - 1
	if chk(r, c):
		mypairs.add((r, c))
	r = a + 1
	c = b - 2
	if chk(r, c):
		mypairs.add((r, c))
	r = a + 2
	c = b + 1
	if chk(r, c):
		mypairs.add((r, c))
	r = a + 1
	c = b + 2
	if chk(r, c):
		mypairs.add((r, c))
	return mypairs

def solve():
	(a, b) = getL()
	(x, y) = getL()
	p1 = findpair(a, b)
	p2 = findpair(x, y)
	if len(p1.intersection(p2)) == 0:
		print('NO')
	else:
		print('YES')
for _ in range(getInt()):
	solve()


for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	flag = 0
	for i in range(1, 9):
		for j in range(1, 9):
			if ((x1 - i == 1 or x1 - i == -1) and (y1 - j == 2 or y1 - j == -2) or ((x1 - i == 2 or x1 - i == -2) and (y1 - j == 1 or y1 - j == -1))) and ((x2 - i == 1 or x2 - i == -1) and (y2 - j == 2 or y2 - j == -2) or ((x2 - i == 2 or x2 - i == -2) and (y2 - j == 1 or y2 - j == -1))):
				flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(p, q) = map(int, input().split())
	l = []
	k = []
	for i in [-2, +2]:
		for j in [-1, +1]:
			l.append((a + i, b + j))
			k.append((p + i, q + j))
			l.append((a + j, b + i))
			k.append((p + j, q + i))
	f = 0
	for (v, s) in k:
		if (v, s) in l and v > 0 and (v < 9) and (s > 0) and (s < 9):
			f = 1
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	h = [2, 2, -2, -2, 1, 1, -1, -1]
	v = [1, -1, -1, 1, 2, -2, 2, -2]
	s = set()
	for i in range(8):
		nx = x1 + h[i]
		ny = y1 + v[i]
		if nx >= 1 and ny >= 1 and (nx <= 8) and (ny <= 8):
			s.add(tuple([nx, ny]))
	ff = 0
	for i in range(8):
		nx = x2 + h[i]
		ny = y2 + v[i]
		if nx >= 1 and ny >= 1 and (nx <= 8) and (ny <= 8):
			if tuple([nx, ny]) in s:
				ff = 1
				break
	if ff == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin
from sys import stdout
T = int(stdin.readline())
for i in range(0, T):
	(X1, Y1) = map(int, stdin.readline().split())
	(X2, Y2) = map(int, stdin.readline().split())
	piece1 = [(X1 - 2, Y1 - 1), (X1 - 2, Y1 + 1), (X1 - 1, Y1 + 2), (X1 + 1, Y1 + 2), (X1 + 2, Y1 + 1), (X1 + 2, Y1 - 1), (X1 - 1, Y1 - 2), (X1 + 1, Y1 - 2)]
	piece2 = [(X2 - 2, Y2 - 1), (X2 - 2, Y2 + 1), (X2 - 1, Y2 + 2), (X2 + 1, Y2 + 2), (X2 + 2, Y2 + 1), (X2 + 2, Y2 - 1), (X2 - 1, Y2 - 2), (X2 + 1, Y2 - 2)]
	ans = 'NO'
	while ans == 'NO':
		for i in piece1:
			if 1 <= i[0] <= 8 and 1 <= i[1] <= 8:
				for j in piece2:
					if 1 <= j[0] <= 8 and 1 <= j[1] <= 8 and (i == j):
						ans = 'YES'
		break
	print(ans)


def main():
	T = int(input())
	for _ in range(T):
		(x1, y1) = map(int, input().split())
		(x2, y2) = map(int, input().split())
		attackPosFirst = set([(x1 - 1, y1 - 2), (x1 - 1, y1 + 2), (x1 + 1, y1 - 2), (x1 + 1, y1 + 2), (x1 - 2, y1 - 1), (x1 + 2, y1 - 1), (x1 - 2, y1 + 1), (x1 + 2, y1 + 1)])
		attackPosSecond = set([(x2 - 1, y2 - 2), (x2 - 1, y2 + 2), (x2 + 1, y2 - 2), (x2 + 1, y2 + 2), (x2 - 2, y2 - 1), (x2 + 2, y2 - 1), (x2 - 2, y2 + 1), (x2 + 2, y2 + 1)])
		ans = False
		for (x, y) in attackPosFirst:
			if 1 <= x <= 8 and 1 <= y <= 8 and ((x, y) in attackPosSecond):
				ans = True
				break
		if ans:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for T in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	psbl1 = {(x1 + 1, y1 + 2), (x1 + 2, y1 + 1), (x1 + 1, y1 - 2), (x1 + 2, y1 - 1), (x1 - 1, y1 + 2), (x1 - 2, y1 + 1), (x1 - 1, y1 - 2), (x1 - 2, y1 - 1)}
	psbl2 = {(x2 + 1, y2 + 2), (x2 + 2, y2 + 1), (x2 + 1, y2 - 2), (x2 + 2, y2 - 1), (x2 - 1, y2 + 2), (x2 - 2, y2 + 1), (x2 - 1, y2 - 2), (x2 - 2, y2 - 1)}
	k = True
	for (i, j) in psbl1:
		if i in range(1, 9) and j in range(1, 9):
			if (i, j) in psbl2:
				print('YES')
				k = False
				break
	if k:
		print('NO')


def knight(x1, y1, x2, y2):
	dx = [2, 2, -2, -2, 1, 1, -1, -1]
	dy = [1, -1, 1, -1, 2, -2, 2, -2]
	flag = 0
	mp = {}
	n = len(dy)
	for i in range(n):
		x = x1 + dx[i]
		y = y1 + dy[i]
		if x <= 0 or x > 8 or y <= 0 or (y > 8):
			continue
		else:
			mp[x, y] = i + 1
	for i in range(n):
		x = x2 + dx[i]
		y = y2 + dy[i]
		if x <= 0 or x > 8 or y <= 0 or (y > 8):
			continue
		elif (x, y) in mp:
			flag = 1
	if flag == 1:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	print(knight(x1, y1, x2, y2))


for i in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	x = [2, 2, -2, -2, 1, -1, 1, -1]
	y = [1, -1, 1, -1, 2, 2, -2, -2]
	d = {}
	for i in range(8):
		tx1 = x1 + x[i]
		ty1 = y1 + y[i]
		if 8 >= tx1 >= 1 and 8 >= ty1 >= 1:
			d[tx1, ty1] = d.get((tx1, ty1), 1)
	for i in range(8):
		tx2 = x2 + x[i]
		ty2 = y2 + y[i]
		if 8 >= tx2 >= 1 and 8 >= ty2 >= 1:
			if d.get((tx2, ty2), 0) == 1:
				print('YES')
				break
	else:
		print('NO')


for _ in range(int(input())):
	cnt = 0
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	ans = []
	li = []
	if x1 - 2 >= 1:
		if y1 - 1 >= 1:
			t = [x1 - 2, y1 - 1]
			ans.append(t)
		if y1 + 1 <= 8:
			t = [x1 - 2, y1 + 1]
			ans.append(t)
	if x1 - 1 >= 1:
		if y1 - 2 >= 1:
			t = [x1 - 1, y1 - 2]
			ans.append(t)
		if y1 + 2 <= 8:
			t = [x1 - 1, y1 + 2]
			ans.append(t)
	if x1 + 2 <= 8:
		if y1 - 1 >= 1:
			t = [x1 + 2, y1 - 1]
			ans.append(t)
		if y1 + 1 <= 8:
			t = [x1 + 2, y1 + 1]
			ans.append(t)
	if x1 + 1 <= 8:
		if y1 - 2 >= 1:
			t = [x1 + 1, y1 - 2]
			ans.append(t)
		if y1 + 2 <= 8:
			t = [x1 + 1, y1 + 2]
			ans.append(t)
	if x2 - 2 >= 1:
		if y2 - 1 >= 1:
			t = [x2 - 2, y2 - 1]
			li.append(t)
		if y2 + 1 <= 8:
			t = [x2 - 2, y2 + 1]
			li.append(t)
	if x2 - 1 >= 1:
		if y2 - 2 >= 1:
			t = [x2 - 1, y2 - 2]
			li.append(t)
		if y2 + 2 <= 8:
			t = [x2 - 1, y2 + 2]
			li.append(t)
	if x2 + 2 <= 8:
		if y2 - 1 >= 1:
			t = [x2 + 2, y2 - 1]
			li.append(t)
		if y2 + 1 <= 8:
			t = [x2 + 2, y2 + 1]
			li.append(t)
	if x2 + 1 <= 8:
		if y2 - 2 >= 1:
			t = [x2 + 1, y2 - 2]
			li.append(t)
		if y2 + 2 <= 8:
			t = [x2 + 1, y2 + 2]
			li.append(t)
	for i in ans:
		if i in li:
			print('YES')
			cnt = 1
			break
	if cnt == 0:
		print('NO')


for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	ans = 'NO'
	for x in range(1, 9):
		for y in range(1, 9):
			mask = 0
			for dx in [1, -1, 2, -2]:
				for dy in [1, -1, 2, -2]:
					if dx % 2 == dy % 2:
						continue
					if x + dx == x1 and y + dy == y1:
						mask |= 1
					if x + dx == x2 and y + dy == y2:
						mask |= 2
			if mask == 3:
				ans = 'YES'
	print(ans)


p = [(1, 2), (-1, -2), (-1, 2), (1, -2), (2, 1), (-2, -1), (-2, 1), (2, -1)]

def fun(x, y):
	s = set()
	for (i, j) in p:
		a = x + i
		b = y + j
		if 1 <= a <= 8 and 1 <= b <= 8:
			s.add((a, b))
	return s
t = int(input())
for i in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	s1 = fun(x1, y1)
	s2 = fun(x2, y2)
	s3 = s1.intersection(s2)
	if s3:
		print('YES')
	else:
		print('NO')


def possible(x, y):
	lst1 = [x - 1, x + 2, x - 2, x - 2, x + 1, x + 1, x - 1, x + 2]
	lst2 = [y - 2, y - 1, y + 1, y - 1, y + 2, y - 2, y + 2, y + 1]
	return set(zip(lst1, lst2))
for i in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	(l1, l2) = (possible(x1, y1), possible(x2, y2))
	s = l1.intersection(l2)
	k = set(s)
	if s == set():
		print('NO')
	else:
		for (i, j) in s:
			if i <= 0 or j <= 0 or i >= 9 or (j >= 9):
				k.remove((i, j))
		if k == set():
			print('NO')
		else:
			print('YES')


corner_points = [((1, 1), (2, 2)), ((8, 8), (7, 7)), ((8, 1), (7, 2)), ((1, 8), (2, 7))]
T = int(input())
for i in range(T):
	(x1, y1) = [int(x) for x in input().split()]
	(x2, y2) = [int(x) for x in input().split()]
	p1 = (x1, y1)
	p2 = (x2, y2)
	manhattan_distance = abs(x1 - x2) + abs(y1 - y2)
	x_manhattan = abs(x1 - x2)
	y_manhattan = abs(y1 - y2)
	flag = 0
	for p in corner_points:
		if (p1, p2) == p or (p2, p1) == p:
			print('NO')
			flag = 1
			break
	if flag == 1:
		pass
	elif manhattan_distance == 2:
		print('YES')
	elif manhattan_distance == 4:
		if x_manhattan == y_manhattan:
			print('NO')
		else:
			print('YES')
	elif manhattan_distance == 6:
		if x_manhattan == 1 or y_manhattan == 1 or x_manhattan == 0 or (y_manhattan == 0):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


def check(x1, y1, x2, y2):
	x = [2, -2, 1, -1, -1, 1, -2, 2]
	y = [-1, 1, -2, 2, -2, 2, -1, 1]
	m1 = []
	m2 = []
	for i in range(8):
		mx = x1 + x[i]
		my = y1 + y[i]
		mx1 = x2 + x[i]
		my1 = y2 + y[i]
		if mx > 0 and mx < 9 and (my > 0) and (my < 9):
			m1.append([mx, my])
		if mx1 > 0 and mx1 < 9 and (my1 > 0) and (my1 < 9):
			m2.append([mx1, my1])
	for i in m1:
		if i in m2:
			return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	print(check(x1, y1, x2, y2))


n = int(input())
for i in range(n):
	s = 0
	h = input()
	h = h.split()
	x = int(h[0])
	y = int(h[1])
	a = [[x + 2, y + 1], [x + 2, y - 1], [x - 2, y + 1], [x - 2, y - 1], [x + 1, y + 2], [x + 1, y - 2], [x - 1, y - 2], [x - 1, y + 2]]
	c = []
	d = []
	for i in range(8):
		if a[i][0] in range(1, 9) and a[i][1] in range(1, 9):
			c.append(a[i])
	p = input()
	p = p.split()
	x1 = int(p[0])
	y1 = int(p[1])
	b = [[x1 + 2, y1 + 1], [x1 + 2, y1 - 1], [x1 - 2, y1 + 1], [x1 - 2, y1 - 1], [x1 + 1, y1 + 2], [x1 + 1, y1 - 2], [x1 - 1, y1 - 2], [x1 - 1, y1 + 2]]
	for i in range(8):
		if b[i][0] in range(1, 9) and b[i][1] in range(1, 9):
			d.append(b[i])
	for i in range(len(c)):
		if c[i] in d:
			s = s + 1
			break
	if s == 0:
		print('NO')
	else:
		print('YES')


s = [[1, 1], [1, 8], [8, 1], [8, 8]]
for _ in range(int(input())):
	(r1, c1) = map(int, input().split())
	(r2, c2) = map(int, input().split())
	if r2 == r1 and abs(c2 - c1) in [2, 4]:
		print('YES')
	elif abs(c2 == c1) == 1 and abs(r2 - r1) in [2, 4]:
		print('YES')
	elif abs(r2 - r1) == 2 and abs(c2 - c1) == 4:
		print('YES')
	elif abs(r2 - r1) == 4 and abs(c2 - c1) == 2:
		print('YES')
	elif abs(r2 - r1) == 3 and abs(c2 - c1) == 3:
		print('YES')
	elif abs(r2 - r1) == 1 and abs(c2 - c1) == 3:
		print('YES')
	elif abs(r2 - r1) == 3 and abs(c2 - c1) == 1:
		print('YES')
	elif abs(r2 - r1) == 1 and abs(c2 - c1) == 1 and ([r1, c1] not in s) and ([r2, c2] not in s):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(X1, Y1) = map(int, input().split())
	(X2, Y2) = map(int, input().split())
	X1 -= 1
	Y1 -= 1
	X2 -= 1
	Y2 -= 1
	found = False
	dx = [-2, -2, 2, 2, 1, 1, -1, -1]
	dy = [1, -1, 1, -1, -2, 2, 2, -2]
	moves = {}
	for (x, y) in zip(dx, dy):
		if 0 <= X1 + x <= 7 and 0 <= Y1 + y <= 7:
			moves[str((X1 + x, Y1 + y))] = [X1 + x, Y1 + y]
	for (x, y) in zip(dx, dy):
		if 0 <= X2 + x <= 7 and 0 <= Y2 + y <= 7:
			k = str((X2 + x, Y2 + y))
			if k in moves:
				val = moves[k]
				if val[0] != X2 and val[1] != Y2:
					found = True
					break
	if found:
		print('YES')
	else:
		print('NO')
	t -= 1


T = int(input())
for tx in range(T):
	(X1, Y1) = map(int, input().split())
	(X2, Y2) = map(int, input().split())
	delt = sorted([abs(X1 - X2), abs(Y1 - Y2)])
	if delt in [[0, 2], [0, 4], [1, 3], [2, 4], [3, 3]]:
		print('YES')
	elif delt == [1, 1]:
		if X1 in [1, 8] and Y1 in [1, 8] or (X2 in [1, 8] and Y2 in [1, 8]):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t1 = int(input())
for _ in range(t1):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	l = [[2, 1], [1, 2], [2, -1], [-1, 2], [-2, 1], [1, -2], [-2, -1], [-1, -2]]
	flag = 0
	for i in l:
		for j in l:
			if x1 + i[0] == x2 + j[0] and y1 + i[1] == y2 + j[1] and (1 <= x1 + i[0] <= 8) and (1 <= y1 + i[1] <= 8):
				print('YES')
				flag = 1
				break
		if flag:
			break
	if not flag:
		print('NO')


T = int(input())
for _ in range(T):
	ans = 'NO'
	(X1, Y1) = map(int, input().split(' '))
	(X2, Y2) = map(int, input().split(' '))
	dx = [2, 2, 1, 1, -2, -2, -1, -1]
	dy = [1, -1, 2, -2, 1, -1, 2, -2]
	list_xy1 = []
	list_xy2 = []
	for i in range(8):
		x1 = X1 + dx[i]
		y1 = Y1 + dy[i]
		if 1 <= x1 <= 8 and 1 <= y1 <= 8:
			l1 = [x1, y1]
			list_xy1.append(l1)
	for j in range(8):
		x2 = X2 + dx[j]
		y2 = Y2 + dy[j]
		if 1 <= x2 <= 8 and 1 <= y2 <= 8:
			l2 = [x2, y2]
			list_xy2.append(l2)
	for k in range(len(list_xy1)):
		for l in range(len(list_xy2)):
			if list_xy1[k] == list_xy2[l]:
				ans = 'YES'
	print(ans)


import math
import os
import random
import re
import sys
for _ in range(int(input())):
	(x1, y1) = list(map(int, input().split()))
	(x2, y2) = list(map(int, input().split()))
	ans = 'NO'
	for i in range(1, 9):
		for j in range(1, 9):
			count = 0
			for x in [1, -1, 2, -2]:
				for y in [1, -1, 2, -2]:
					if x % 2 == y % 2:
						continue
					if i + x == x1 and j + y == y1:
						count |= 1
					if i + x == x2 and j + y == y2:
						count |= 2
			if count == 3:
				ans = 'YES'
	print(ans)


def movePossible(x, y):
	if 1 <= x <= 8 and 1 <= y <= 8:
		return True
	return False

def generateMoves(x, y):
	possible_places = [(-2, -1), (-1, -2), (1, -2), (2, -1), (2, 1), (1, 2), (-1, 2), (-2, 1)]
	threat_places = []
	for (a, b) in possible_places:
		p = x + a
		q = y + b
		if movePossible(p, q):
			threat_places.append((p, q))
	return threat_places
t = int(input())
for _ in range(t):
	(x1, y1) = list(map(int, input().split()))
	(x2, y2) = list(map(int, input().split()))
	threats = []
	threats.extend(generateMoves(x1, y1))
	threats.extend(generateMoves(x2, y2))
	setThreats = set(threats)
	if len(threats) > len(setThreats):
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	resp = 'NO'
	(x1, y1) = map(int, input().split(' '))
	(x2, y2) = map(int, input().split(' '))
	for i in range(1, 9):
		for j in range(1, 9):
			if (abs(i - x1) == 2 and abs(j - y1) == 1 or (abs(i - x1) == 1 and abs(j - y1) == 2)) and (abs(i - x2) == 2 and abs(j - y2) == 1 or (abs(i - x2) == 1 and abs(j - y2) == 2)):
				resp = 'YES'
				break
		if resp == 'YES':
			break
	print(resp)


t = int(input())
for i in range(t):
	(x1, y1) = list(map(int, input().split()))
	(x2, y2) = list(map(int, input().split()))
	if (abs(x1 - x2) == 2 or abs(x1 - x2) == 4) and y1 == y2 or ((abs(y1 - y2) == 2 or abs(y1 - y2) == 4) and x1 == x2):
		print('YES')
	elif abs(x1 - x2) == 2 and abs(y1 - y2) == 4 or (abs(y1 - y2) == 2 and abs(x1 - x2) == 4):
		print('YES')
	elif (abs(x1 - x2) == 1 and abs(y1 - y2) == 1) and ((x1, y1) not in ((1, 1), (8, 8), (1, 8), (8, 1)) and (x2, y2) not in ((1, 1), (8, 8), (1, 8), (8, 1))):
		print('YES')
	elif abs(x1 - x2) == 1 and abs(y1 - y2) == 3 or (abs(y1 - y2) == 1 and abs(x1 - x2) == 3):
		print('YES')
	elif abs(x1 - x2) == 3 and abs(y1 - y2) == 3:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	m = [(2, 1), (2, -1), (-2, 1), (-2, -1)]
	(a, b) = (set(), set())
	for (x, y) in m:
		a.add((x1 + x, y1 + y))
		a.add((x1 + y, y1 + x))
		b.add((x2 + x, y2 + y))
		b.add((x2 + y, y2 + x))
	a = set(((x, y) for (x, y) in a if x > 0 and y > 0 and (x < 9) and (y < 9)))
	b = set(((x, y) for (x, y) in b if x > 0 and y > 0 and (x < 9) and (y < 9)))
	if a.intersection(b):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(x1, y1) = map(int, input().split())
	(x2, y2) = map(int, input().split())
	c = abs(x1 - x2)
	d = abs(y1 - y2)
	a = c + d
	if a == 2:
		if 0 < x1 + 2 <= 8 and 0 < y1 + 1 <= 8 and (x1 + 2 == x2 + 1) and (y1 + 1 == y2 + 2) or (0 < x1 + 1 <= 8 and 0 < y1 + 2 <= 8 and (x1 + 1 == x2 + 2) and (y1 + 2 == y2 + 1)):
			print('YES')
		elif 0 < x1 - 2 <= 8 and 0 < y1 - 1 <= 8 and (x1 - 2 == x2 - 1) and (y1 - 1 == y2 - 2) or (0 < x1 - 1 <= 8 and 0 < y1 - 2 <= 8 and (x1 - 1 == x2 - 2) and (y1 - 2 == y2 - 1)):
			print('YES')
		elif 0 < x1 - 2 <= 8 and 0 < y1 + 1 <= 8 and (x1 - 2 == x2 - 1) and (y1 + 1 == y2 + 2) or (0 < x1 - 1 <= 8 and 0 < y1 + 2 <= 8 and (x1 - 1 == x2 - 2) and (y1 + 2 == y2 + 1)):
			print('YES')
		elif 0 < x1 + 2 <= 8 and 0 < y1 - 1 <= 8 and (x1 + 2 == x2 + 1) and (y1 - 1 == y2 - 2) or (0 < x1 + 1 <= 8 and 0 < y1 - 2 <= 8 and (x1 + 1 == x2 + 2) and (y1 - 2 == y2 - 1)):
			print('YES')
		elif c == 0 and d == 2 or (c == 2 or d == 0):
			print('YES')
		else:
			print('NO')
	elif a == 4 and c != 2 and (d != 2):
		print('YES')
	elif a == 6 and c > 0 and (d > 0) and (c != 5) and (d != 5):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(X1, Y1) = map(int, input().split())
	(X2, Y2) = map(int, input().split())
	res = 'NO'
	for row in range(1, 9):
		for col in range(1, 9):
			if (abs(row - X1) == 1 and abs(col - Y1) == 2 or (abs(row - X1) == 2 and abs(col - Y1) == 1)) and (abs(row - X2) == 1 and abs(col - Y2) == 2 or (abs(row - X2) == 2 and abs(col - Y2) == 1)):
				res = 'YES'
	print(res)