#include <bits/stdc++.h>
using namespace std;
int c[110000];
int main() {
  int N, X, K;
  while (cin >> N) {
    memset(c, 0xff, sizeof(c));
    bool ok = true;
    while (N--) {
      int a, b;
      cin >> a;
      cin >> b;
      if (a == c[b] + 1)
        ++c[b];
      else if (a <= c[b])
        continue;
      else
        ok = false;
    }
    puts(ok ? "YES" : "NO");
  }
  return 0;
}
