#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 + 321;
map<int, int> m;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int d, k;
    cin >> d >> k;
    if (m[k] < d) {
      cout << "NO" << endl;
      return 0;
    } else {
      if (m[k] == d) m[k]++;
    }
  }
  cout << "YES" << endl;
  return 0;
}
