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