#include <bits/stdc++.h>
int main(int argc, char *argv[]) {
  unsigned n, ok = 1, i, a, b;
  unsigned k[100000] = {0};
  scanf("%u", &n);
  for (i = 0; i < n; i++) {
    scanf("%u %u", &a, &b);
    b--;
    if (k[b] < a) {
      ok = 0;
      break;
    } else if (k[b] == a) {
      k[b]++;
    }
  }
  if (ok)
    printf("YES\n");
  else
    printf("NO\n");
  return EXIT_SUCCESS;
}
