#include <bits/stdc++.h>
using namespace std;
void solve(int ncase) {
  int n;
  cin >> n;
  vector<int> lastSolution(100010, -1);
  bool isChron = true;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (lastSolution[k] != -1 && lastSolution[k] >= x) {
      continue;
    }
    if (lastSolution[k] != x - 1) {
      isChron = false;
      break;
    }
    lastSolution[k] = x;
  }
  cout << (isChron ? "YES" : "NO") << endl;
}
int main() {
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}
