#include <bits/stdc++.h>
using namespace std;
int n, x, k;
vector<int> G[100005];
bool can(int idx) {
  vector<bool> seen(G[idx].size() + 10, 0);
  seen[0] = true;
  for (int i = 0; i < G[idx].size(); i++) {
    int val = G[idx][i];
    if (val >= seen.size()) return 0;
    if (!seen[val - 1]) return 0;
    seen[val] = 1;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x, &k);
    G[k].push_back(x + 1);
  }
  bool ans = 1;
  for (int i = 1; i < 100005; i++)
    if (G[i].size() > 0)
      if (can(i) == 0) {
        ans = 0;
      }
  puts(ans ? "YES" : "NO");
  return 0;
}
