#include <bits/stdc++.h>
using namespace std;
int n, f, s, cnt;
set<int> d[100001];
set<int>::iterator it;
int main() {
  cin >> n;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &f, &s);
    d[s].insert(f);
    if (f != 0) {
      it = d[s].find(f - 1);
      if (it != d[s].cend()) {
      } else
        flag = false;
    }
  }
  if (flag)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
