#include <bits/stdc++.h>
using namespace std;
int limit[100005] = {0};
int main() {
  ios::sync_with_stdio(false);
  memset(limit, 0, sizeof(limit));
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (x == limit[k])
      limit[k]++;
    else if (x > limit[k]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
