#include <bits/stdc++.h>
int main() {
  long m[100001] = {0};
  long n, i, key = 1, a, b;
  scanf("%ld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%ld%ld", &a, &b);
    if (m[b] == a)
      m[b]++;
    else if (m[b] < a)
      key = 0;
  }
  if (key == 0)
    printf("NO");
  else
    printf("YES");
  return 0;
}
