#include <bits/stdc++.h>
using namespace std;
int n;
set<pair<int, int> > arb;
int main() {
  int x, k, ok = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &k);
    if (arb.find(make_pair(x, k)) == arb.end()) {
      if (x > 0 && arb.find(make_pair(x - 1, k)) == arb.end()) ok = 0;
      arb.insert(make_pair(x, k));
    }
  }
  if (ok)
    printf("YES");
  else
    printf("NO");
  return 0;
}
