#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> uniqs(100002, -1);
  bool res = true;
  for (int line = 0; line < n; ++line) {
    int x, k;
    cin >> x >> k;
    if (x > uniqs[k] + 1) {
      res = false;
    }
    if (x > uniqs[k]) {
      uniqs[k] = x;
    }
  }
  if (res)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
