#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
const int infi = 1e9 + 2;
const long long Linfi = (long long)1e18;
int n, x, k, maxk = -1;
vector<int> V[500005];
void solve() {
  for (int i = 1; i <= maxk; i++) {
    int cnt = 0;
    for (int j = 0; j < V[i].size(); j++) {
      int tmp = V[i][j];
      if (tmp == cnt)
        cnt++;
      else if (tmp > cnt) {
        cout << "NO" << endl;
        return;
      }
    }
  }
  cout << "YES" << endl;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &x, &k);
    maxk = max(maxk, k);
    V[k].push_back(x);
  }
  solve();
  return 0;
}
