#include <bits/stdc++.h>
using namespace std;
int n, a[100003];
int main() {
  int i, j, x, k;
  scanf("%d", &n);
  for (i = 0; i <= 100001; ++i) a[i] = -1;
  while (n--) {
    scanf("%d%d", &x, &k);
    if (a[k] < x - 1) {
      cout << "NO" << endl;
      return 0;
    }
    a[k] = max(a[k], x);
  }
  cout << "YES\n";
  return 0;
}
