#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int i;
  for (i = 1; i <= 100000; i++) a[i] = -1;
  int n, x, k;
  scanf("%d", &n);
  int valid = 1;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &x, &k);
    if (a[k] < x - 1)
      valid = 0;
    else
      a[k] = max(a[k], x);
  }
  if (valid)
    printf("YES\n");
  else
    printf("NO\n");
}
