#include <bits/stdc++.h>
using namespace std;
template <class T>
void dumpBetween(const T& a, const T& b) {
  for (T it = a; it != b; it++) cout << *it << " ";
  cout << endl;
}
template <class T>
void dumpAll(const T& a) {
  dumpBetween((a).begin(), (a).end());
}
template <class T>
void minify(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void maxify(T& a, const T& b) {
  if (a < b) a = b;
}
int n;
int x[100008], k[100008];
void readInput() {
  scanf("%d", &(n));
  for (int i = 0; i < ((int)n); i++) scanf("%d%d", &(x[i]), &(k[i]));
}
int rec[100008];
void tc() {
  readInput();
  fill(rec, rec + 100008, -1);
  for (int i = 0; i < ((int)n); i++) {
    if (x[i] - rec[k[i]] > 1) {
      printf("NO\n");
      return;
    }
    maxify(rec[k[i]], x[i]);
  }
  printf("YES\n");
}
int main() { tc(); }
