#include <bits/stdc++.h>
using namespace std;
set<int> p[100001];
int main() {
  int n, i, x, k;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (x != 0 && p[k].find(x - 1) == p[k].end()) {
      cout << "NO" << endl;
      return 0;
    }
    p[k].insert(x);
  }
  cout << "YES" << endl;
  return 0;
}
