#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool ok = 1;
  vector<int> mas(100001, -1);
  for (int i = 0; i < n; i++) {
    int nom, pos;
    cin >> pos >> nom;
    if (mas[nom - 1] + 1 < pos) {
      if (ok) cout << "NO";
      ok = 0;
    }
    if (mas[nom - 1] + 1 == pos) {
      mas[nom - 1]++;
    }
  }
  if (ok) cout << "YES";
  return 0;
}
