#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bool correct = true;
  cin >> n;
  vector<long> check(100001);
  for (int i = 0; i < n; ++i) {
    long t1, t2;
    cin >> t1 >> t2;
    ++t1;
    --t2;
    if (t1 - 1 <= check[t2]) {
      if (t1 > check[t2]) {
        check[t2] = t1;
      }
    } else {
      correct = false;
    }
  }
  if (correct) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
