#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<int> a[111111];
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (x == 0) {
      a[k].insert(x);
      continue;
    }
    if (a[k].find(x - 1) == a[k].end()) {
      ok = 0;
    }
    a[k].insert(x);
  }
  (ok) ? puts("YES") : puts("NO");
  return 0;
}
