#include <bits/stdc++.h>
using namespace std;
int n;
int a[100010] = {0};
int main() {
  int x, k;
  cin >> n;
  while (n--) {
    cin >> x >> k;
    if (a[k] < x) {
      cout << "NO\n";
      return 0;
    }
    a[k] = max(a[k], x + 1);
  }
  cout << "YES\n";
  return 0;
}
