#include <bits/stdc++.h>
using namespace std;
int cnt[100010];
int main() {
  int n, m, c, d, k, i, x;
  scanf("%d", &n);
  memset(cnt, -1, sizeof(cnt));
  int f = 1;
  for (i = 0; i < n; ++i) {
    scanf("%d%d", &x, &k);
    if (cnt[k] == x - 1)
      cnt[k] = x;
    else if (cnt[k] >= x)
      continue;
    else
      f = 0;
  }
  if (f == 0)
    puts("NO");
  else
    puts("YES");
  return 0;
}
