#include <bits/stdc++.h>
const double PI(acos(-1.0));
const double PI_2 = PI * 2.0;
double eps = 1e-9;
using namespace std;
int main() {
  long long n, x, k;
  cin >> n;
  map<int, set<int> > m;
  for (long long(i) = (0); i <= (((long long)n) - 1); ++(i)) {
    cin >> x >> k;
    if ((((long long)m[k].size()) == 0 && x != 0) ||
        (((long long)m[k].size()) > 0 && ((*(m[k].rbegin()) != x - 1)) &&
         m[k].find(x) == m[k].end())) {
      cout << "NO" << endl;
      return 0;
    }
    m[k].insert(x);
  }
  cout << "YES";
  return 0;
}
