#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int N = 1E5 + 5;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<int> adj[N];
int main() {
  fast();
  int n;
  cin >> n;
  map<pair<int, int>, int> mp;
  for (int i = 0; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[v].push_back(u);
  }
  bool f = true;
  for (int i = 0; i < N; i++) {
    int c = 0;
    for (int j = 0; j < adj[i].size(); j++) {
      if (adj[i][j] > c) {
        f = false;
        break;
      } else if (adj[i][j] == c)
        c++;
    }
    if (!f) break;
  }
  if (!f)
    cout << "NO"
         << "\n";
  else
    cout << "YES"
         << "\n";
}
