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