#include <bits/stdc++.h>
int main() {
  int a[100004], n, x, k;
  memset(a, -1, sizeof(a));
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &x, &k);
    if (a[k] == x - 1 || a[k] >= x) {
      if (x > a[k]) a[k] = x;
      continue;
    } else {
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}
