#include <bits/stdc++.h>
using namespace std;
int MAX = 2e9, MIN = -2e9;
int a[133700];
int main() {
  int n, x, k;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (a[k] == x) a[k]++;
    if (a[k] < x) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
