#include <bits/stdc++.h>
using namespace std;
int N, M;
int part[int(1e5) + 100];
int main() {
  fill(part, part + int(1e5) + 10, -1);
  int N;
  bool flag = true;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    if (a - part[b] > 1) {
      flag = false;
    } else
      part[b] = max(part[b], a);
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
