#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  if (y < 0) return 0;
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (ans * x);
    y = y >> 1;
    x = x * x;
  }
  return ans;
}
int bit(long long n) {
  int c = 0;
  while (n > 0) {
    c++;
    n /= 2;
  }
  return c;
}
vector<int> v;
bool prime[100001];
void SieveOfEratosthenes(int n) {
  memset(prime, true, sizeof(prime));
  prime[1] = false;
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) v.push_back(p);
}
long long maxSubArraySum(long long a[], int n) {
  long long mx = LLONG_MIN, mx1 = 0;
  for (int i = 0; i < n; i++) {
    mx1 = mx1 + a[i];
    if (mx < mx1) mx = mx1;
    if (mx1 < 0) mx1 = 0;
  }
  return mx;
}
void ans_nikalo() {
  int n;
  cin >> n;
  map<int, set<int>> m;
  while (n--) {
    int x, k;
    cin >> x >> k;
    int sz = m[k].size();
    if (x > 0 && m[k].find(x - 1) == m[k].end()) {
      cout << "NO\n";
      return;
    }
    m[k].insert(x);
  }
  cout << "YES\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ans_nikalo();
  return 0;
}
