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