#P29A. Spit Problem

Spit Problem

问题描述

在Berland的动物园中有一个圈养的骆驼围栏。众所周知,骆驼喜欢吐痰。鲍勃整天观察这些有趣的动物并在记事本中记录每个动物的吐痰位置。现在他想知道动物园中是否有两只骆驼,它们会互相吐痰。帮助他解决这个任务。

骆驼吐痰的轨迹是一个弧线,即如果在位置x的骆驼向右吐出d米,它只会命中位置在x + d的骆驼,如果存在的话。

输入

第一行包含整数n1 ≤ n ≤ 100)— 动物园中的骆驼数量。接下来的n行中,每行包含两个整数xidi - 104 ≤ xi ≤ 104, 1 ≤ |di| ≤ 2·104)— 鲍勃记事本中的记录。其中,xi表示第i只骆驼的位置,di表示第i只骆驼吐痰的距离。正值的di对应向右吐痰,负值的di对应向左吐痰。两只骆驼不能站在同一位置。

输出

如果有两只相互吐痰的骆驼,输出YES。否则,输出NO

样例

2
0 1
1 -1
YES
3
0 1
1 1
2 -2
NO
5
2 -10
3 10
0 5
5 -5
10 1
YES

Description

In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know if in the zoo there are two camels, which spitted at each other. Help him to solve this task.

The trajectory of a camel's spit is an arc, i.e. if the camel in position x spits d meters right, he can hit only the camel in position x + d, if such a camel exists.

The first line contains integer n (1 ≤ n ≤ 100) — the amount of camels in the zoo. Each of the following n lines contains two integers xi and di ( - 104 ≤ xi ≤ 104, 1 ≤ |di| ≤ 2·104) — records in Bob's notepad. xi is a position of the i-th camel, and di is a distance at which the i-th camel spitted. Positive values of di correspond to the spits right, negative values correspond to the spits left. No two camels may stand in the same position.

If there are two camels, which spitted at each other, output YES. Otherwise, output NO.

Input

The first line contains integer n (1 ≤ n ≤ 100) — the amount of camels in the zoo. Each of the following n lines contains two integers xi and di ( - 104 ≤ xi ≤ 104, 1 ≤ |di| ≤ 2·104) — records in Bob's notepad. xi is a position of the i-th camel, and di is a distance at which the i-th camel spitted. Positive values of di correspond to the spits right, negative values correspond to the spits left. No two camels may stand in the same position.

Output

If there are two camels, which spitted at each other, output YES. Otherwise, output NO.

Samples

2
0 1
1 -1
YES
3
0 1
1 1
2 -2
NO
5
2 -10
3 10
0 5
5 -5
10 1
YES