#include <bits/stdc++.h>
using namespace std;
const int MX = 1000000;
int n, x, k;
int nw[MX];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  memset(nw, -1, sizeof(nw));
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (x > nw[k] + 1) {
      cout << "NO" << endl;
      exit(0);
    }
    nw[k] = max(nw[k], x);
  }
  cout << "YES" << endl;
  return 0;
}
