#include <bits/stdc++.h>
using namespace std;
int a[101500];
int n;
void solve(void) {
  bool flag = true;
  memset(a, 0, sizeof(a));
  for (int i = (1); i <= (n); i++) {
    int x, k;
    scanf("%d%d", &x, &k);
    if (!flag) continue;
    if (a[k] < x) flag = false;
    a[k] = ((a[k]) > (x + 1) ? (a[k]) : (x + 1));
  }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
}
int main(void) {
  while (EOF != scanf("%d", &n)) solve();
  return 0;
}
