#include <bits/stdc++.h>
using namespace std;
const int MX = 100005;
int a[MX];
bool check[MX];
int main(int argc, char *argv[]) {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = (0), _b = (MX); i < (_b); ++i) a[i] = -1;
  int n, x, k;
  cin >> n;
  for (int i = (0), _b = (n); i < (_b); ++i) {
    cin >> x >> k;
    if (a[k] == -1)
      a[k] = x;
    else if (a[k] < x) {
      if (a[k] + 1 != x) {
        cout << "NO" << '\n';
        return 0;
      } else {
        a[k] = x;
        check[k] = true;
      }
    }
  }
  bool ok = true;
  for (int k = (0), _b = (MX); k < (_b); ++k) {
    if (a[k] > 0 && !check[k]) {
      ok = false;
      break;
    }
  }
  if (ok)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
  return 0;
}
