#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  ;
  int i, j;
  int MX = 1e5;
  vector<int> arr(MX, -1);
  bool succ = true;
  for (i = 0; i < n; i++) {
    int x;
    cin >> x;
    ;
    int k;
    cin >> k;
    ;
    if (arr[k - 1] == x - 1) {
      arr[k - 1] = x;
    } else if (arr[k - 1] >= x) {
    } else
      succ = false;
  }
  if (succ)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
