#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int count[100009] = {0};
  int k, x;
  cin >> n;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (count[k] < x) {
      flag = false;
    } else {
      if (count[k] == x) count[k]++;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
