#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, k;
  cin >> n;
  unordered_map<int, int> mm;
  for (int i = 0; i < n; ++i) {
    cin >> x >> k;
    int& y = mm[k];
    if (y < x) {
      cout << "NO\n";
      return 0;
    }
    if (y == x) ++y;
  }
  cout << "YES\n";
  return 0;
}
