#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> asd;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, k;
    cin >> x >> k;
    ++x;
    if (asd[k] + 1 < x) {
      cout << "NO";
      return 0;
    }
    if (asd[k] == x - 1) asd[k] = x;
  }
  cout << "YES";
  return 0;
}
