#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  ios::sync_with_stdio(0);
  int n, x, k, i;
  memset(a, -1, sizeof(a));
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> x >> k;
    if (a[k] < x - 1) {
      cout << "NO" << endl;
      return 0;
    } else {
      a[k] = max(a[k], x);
    }
  }
  cout << "YES" << endl;
  return 0;
}
