RCC 2014 Warmup (Div. 2)
B
Crash
Codeforces
1400
原题
← AC →
翻译中…

During the "Russian Code Cup" programming competition, the testing system stores all sent solutions for each participant. We know that many participants use random numbers in their programs and are often sent several solutions with the same source code to check.

翻译中…

Each participant is identified by some unique positive integer $*k*$, and each sent solution $*A*$ is characterized by two numbers: $*x*$ — the number of different solutions that are sent before the first solution identical to $*A*$, and $*k*$ — the number of the participant, who is the author of the solution. Consequently, all identical solutions have the same $*x*$.

翻译中…

It is known that the data in the testing system are stored in the chronological order, that is, if the testing system has a solution with number $*x*$ $(*x* > 0)$ of the participant with number $*k*$, then the testing system has a solution with number $*x* - 1$ of the same participant stored somewhere before.

翻译中…

During the competition the checking system crashed, but then the data of the submissions of all participants have been restored. Now the jury wants to verify that the recovered data is in chronological order. Help the jury to do so.

翻译中…

Input

翻译中…

The first line of the input contains an integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of solutions. Each of the following $*n*$ lines contains two integers separated by space $*x*$ and $*k*$ ($0 ≤ *x* ≤ 10^{5}$; $1 ≤ *k* ≤ 10^{5}$) — the number of previous unique solutions and the identifier of the participant.

翻译中…

Output

翻译中…

A single line of the output should contain «YES» if the data is in chronological order, and «NO» otherwise.

翻译中…

样例

Input #1
2
0 1
1 1
Output #1
YES
InputCopy OutputCopy
Input #2
4
0 1
1 2
1 1
0 2
Output #2
NO
InputCopy OutputCopy
Input #3
4
0 1
1 1
0 1
0 2
Output #3
YES
InputCopy OutputCopy
题目信息
题号
417B
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。