#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  bool f = true;
  int n, x, k;
  map<int, vector<int>> V;
  map<pair<int, int>, bool> U;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (!f) continue;
    if (x == 0 || U.find(pair<int, int>(x, k)) != U.end() ||
        U.find(pair<int, int>(x - 1, k)) != U.end()) {
      U[pair<int, int>(x, k)] = 1;
    } else {
      f = false;
    }
  }
  if (f)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
