#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
const double EPS = 1E-9;
const int INF = 2 * (1e+9) + 1;
const int NMAX = 1000000;
const int MOD = (1e+9) + 7;
int n;
int id[100100];
int main() {
  cin >> n;
  for (int i = 0; i < (100100); ++i) id[i] = -1;
  for (int i = 0; i < (n); ++i) {
    int x, k;
    cin >> x >> k;
    if (x > 0 && id[k] < x - 1) {
      cout << "NO";
      return 0;
    }
    if (x > id[k]) id[k] = x;
  }
  cout << "YES";
}
