#include <bits/stdc++.h>
using namespace std;
int p[1000009];
int main() {
  int n, count = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (x > p[k]) count = 1;
    if (p[k] == x) p[k]++;
  }
  (count == 0) ? cout << "YES" << endl : cout << "NO" << endl;
}
