#include <bits/stdc++.h>
int c[100007];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(c, 0, sizeof(c));
    int flag = 0, x, k;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &x, &k);
      if (x < c[k])
        continue;
      else if (x == c[k])
        c[k]++;
      else
        flag = 1;
    }
    if (flag)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
