#include <bits/stdc++.h>
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int x, k, flag = 1;
    int MX[100005];
    for (int i = 0; i < 100005; i++) MX[i] = -1;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &x, &k);
      if (flag == 0) continue;
      if (x > MX[k] + 1)
        flag = 0;
      else if (x == MX[k] + 1)
        MX[k] = x;
    }
    if (flag == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
