#include <bits/stdc++.h>
using namespace std;
int a, x, y;
int b[100009];
int main() {
  scanf("%d", &a);
  for (int i = 0; i < a; i++) {
    scanf("%d %d", &x, &y);
    if (b[y] < x) {
      printf("NO");
      return 0;
    }
    if (b[y] == x) b[y]++;
  }
  printf("YES");
}
