#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  map<int, map<int, int> > vis;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (!x && vis[k].empty() || vis[k][x - 1] || vis[k][x])
      vis[k][x] = 1;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
