#include <bits/stdc++.h>
int cnt[100001];
int main() {
  int n;
  scanf("%d", &n);
  int i;
  memset(cnt, 0, sizeof(cnt));
  int x, k;
  bool judge = true;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &x, &k);
    if (x > cnt[k]) judge = false;
    if (x == cnt[k]) cnt[k]++;
  }
  if (judge)
    puts("YES");
  else
    puts("NO");
  return 0;
}
