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