#include <bits/stdc++.h>
using namespace std;
const int maxl = 1000 * 100 + 5;
int mp[maxl];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (mp[k] < x) {
      cout << "NO\n";
      return 0;
    }
    mp[k] += (mp[k] == x);
  }
  cout << "YES\n";
}
