In africa jungle , there were zebra's who liked to spit.
There owner watched them for whole day and noted in his sheet where each zebra spitted.
Now he's in a confusion and wants to know if in the jungle there are two zebra's which spitted at each other.
Help him solve this task.
If the zebra is present in position a spits b metres right , he can hit only zebra in position a+b , if such a zebra exists.

-----Input:-----
- The first line contains integer t(1<=t<100)- amount of zebras in jungle.
- Each of following t lines contains two integers a(i) and b(i)(-10^4<=x(i)<=10^4,1<|d(i)|<=2.10^4) - records in owner sheet.
- a(i) is the position of i-th zebra and b(i) is distance at which the i-th camel spitted.
Positive values of d(i) correspond to spits right, negative values correspond to spit left.No two zebras may stand in the same position.

-----Output:-----
If there are two zebras , which spitted at each other , output YES, otherwise , output NO.

-----Sample Input:-----
2
0 1
1 -1

-----Sample Output:-----
YES

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
i = 0
a = 0
d = dict()
while i < t:
	l = input().split()
	d[int(l[0])] = int(l[0]) + int(l[1])
	i += 1
for k in d:
	if d[k] in d:
		if d[d[k]] == k:
			a = 1
			break
if a == 1:
	print('YES')
else:
	print('NO')


(s1, s2) = ([], [])
flag = 0
for _ in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	s1.append(x)
	s2.append(x + y)
for _ in range(len(s1)):
	for __ in range(len(s2)):
		if _ != __ and s1[__] == s2[_] and (s1[_] == s2[__]):
			flag = 1
			print('YES')
			break
	if flag == 1:
		break
if flag == 0:
	print('NO')


t = int(input())
a = list()
for _ in range(t):
	a.append(list(map(int, input().split())))
count = 0
for i in range(t):
	for j in range(i + 1, t):
		if a[i][1] + a[j][1] == 0:
			count += 1
			print('YES')
			break
	if count != 0:
		break
if count == 0:
	print('NO')


t = int(input())
lst1 = []
lst = []
for i in range(t):
	(a, b) = list(map(int, input().split()))
	lst.append((a, b))
for i in range(0, t):
	temp = lst[i][0] + lst[i][1]
	for j in lst:
		if j != lst[i] and j[0] == temp:
			temp1 = j[0] + j[1]
			if temp1 == lst[i][0]:
				lst1.append(1)
				break
			break
if len(lst1) == 0:
	print('NO')
else:
	print('YES')


n = int(input())
a = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append([x, x + y])
ans = False
for i in range(n):
	for j in range(n):
		if i == j:
			continue
		if a[i][1] == a[j][0] and a[i][0] == a[j][1]:
			ans = True
			break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
a = list()
for i in range(n):
	a.append(list(map(int, input().split())))
c = 0
for i in range(n):
	for j in range(i + 1, n):
		if a[i][1] + a[j][1] == 0:
			c += 1
			print('YES')
			break
	if c != 0:
		break
if c == 0:
	print('NO')


try:
	t = int(input())
	a = []
	b = []
	for i in range(t):
		(x, y) = map(int, input().split())
		a.append(x)
		b.append(y)
	flag = 0
	for i in range(len(a) - 1):
		for j in range(i + 1, len(a)):
			a1 = a[i]
			b1 = b[i]
			a2 = a[j]
			b2 = b[j]
			if a1 + b1 == a2 and a2 + b2 == a1:
				flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')
except Exception:
	pass


no_zeb = int(input())
lst = []
for _ in range(no_zeb):
	(position, dist) = list(map(int, input().split()))
	lst.append((position, dist))
for j in lst:
	spit_i = j[0] + j[1]
	for l in lst:
		if l[0] == spit_i and l[0] + l[1] == j[0]:
			print('YES')
			return
print('NO')


n = int(input())
s = set()
for i in range(n):
	(x, d) = map(int, input().split())
	if (x + d, -d) in s:
		print('YES')
		return
	s.add((x, d))
print('NO')


a = []
b = []
c = 0
for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	z = x + y
	a.append(z)
	b.append(x)
for i in range(len(a)):
	z = a[i]
	z1 = b[i]
	for j in range(len(a)):
		if j != i:
			z2 = a[j]
			z3 = b[j]
			if z == z3 and z1 == z2:
				c = 1
				break
if c == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = []
f = 0
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(len(a)):
	for j in range(len(a)):
		if i == j:
			continue
		if i == a[-1]:
			break
		if sum(a[i]) == a[j][0] and sum(a[j]) == a[i][0]:
			f = 1
			break
if f:
	print('YES')
else:
	print('NO')


t = int(input())
lst = []
lst2 = []
stat = False
for x in range(t):
	lst.append(list(map(int, input().split())))
for j in range(len(lst)):
	for i in range(len(lst)):
		if i == j:
			continue
		if j == lst[-1]:
			break
		if sum(lst[j]) == lst[i][0] and sum(lst[i]) == lst[j][0]:
			stat = True
			break
if stat:
	print('YES')
else:
	print('NO')


def check(a, b):
	for i in range(t):
		if a[i] + b[i] in a:
			idx = a.index(a[i] + b[i])
			if a[idx] + b[idx] == a[i]:
				print('YES')
				return
	print('NO')
t = int(input())
a = []
b = []
for _ in range(t):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
check(a, b)


n = int(input())
A = []
B = []
spit = False
for i in range(n):
	(a, b) = map(int, input().split())
	A.append(a)
	B.append(b)
for j in range(n):
	for k in range(j, n):
		if B[j] == A[k] and B[k] + A[k] == A[j]:
			spit = True
			break
		elif B[k] + A[k] == A[j] and B[j] + A[j] == A[k]:
			spit = True
			break
	if spit:
		break
if spit:
	print('YES')
else:
	print('NO')


from collections import deque, defaultdict
from math import sqrt, ceil
import sys
import copy

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

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

def input():
	return sys.stdin.readline().strip()
n = int(input())
d = dict()
flag = 0
for i in range(n):
	(x, y) = get_ints()
	d[x] = y
for x in list(d.keys()):
	res = x + d[x]
	if res in list(d.keys()):
		if res + d[res] == x:
			flag = 1
			break
if flag == 1:
	print('YES')
else:
	print('NO')


l = []
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	l.append((a, b))
for i in l:
	for j in l:
		if i[0] + i[1] == j[0] and j[0] + j[1] == i[0]:
			print('YES')
			return
print('NO')


def fun(t):
	s = []
	a = []
	b = []
	for _ in range(t):
		(x, y) = list(map(int, input().split()))
		s.append(x + y)
		a.append(x)
		b.append(y)
	for i in range(t):
		if s[i] in a:
			yy = a.index(s[i])
			xx = a[yy] + b[yy]
			if xx == a[i]:
				return 'YES'
	return 'NO'
t = int(input())
print(fun(t))


try:
	t = int(input())
	l = []
	flag = 0
	for k in range(0, t):
		(n, m) = (int(i) for i in input().split(' '))
		l.append([n, m])
	for i in range(0, t):
		s = l[i][0] + l[i][1]
		for j in range(i + 1, t):
			if s == l[j][0] and l[i][0] == l[j][0] + l[j][1]:
				flag = 1
				print('YES')
				break
	if flag == 0:
		print('NO')
except:
	pass


T = int(input())
mat = []
for _ in range(T):
	a = list(map(int, input().split()))
	mat.append(a)
f = 0
for i in range(T):
	ch = mat[i][0] + mat[i][1]
	for j in range(T):
		if ch == mat[j][0] and mat[i][0] == mat[j][0] + mat[j][1]:
			f = 1
			break
if f:
	print('YES')
else:
	print('NO')


a = []
b = []
n = int(input())
for i in range(n):
	(c, d) = list(map(int, input().split()))
	a.append(c)
	b.append(c + d)
spit = 0
for j in range(0, len(a)):
	for k in range(0, len(b)):
		if a[j] == b[k] and a[k] == b[j]:
			spit = spit + 1
			break
if spit > 0:
	print('YES')
else:
	print('NO')