#include <bits/stdc++.h>
using namespace std;
int n, x, k;
map<int, int> a[300003];
bool check = 1;
int main() {
  ios::sync_with_stdio(0);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (x != 0) {
      if (a[k][x - 1] == 0) {
        check = 0;
      }
    }
    a[k][x] = 1;
  }
  if (check)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
