#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 100, MOD = 1e9 + 7, INF = 1e18 + 7;
set<pair<long long, long long> > s;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  bool ans = true;
  for (long long i = 0; i < n; i++) {
    long long x, k;
    cin >> x >> k;
    if (x == 0)
      s.insert({x, k});
    else if (s.count({x - 1, k}))
      s.insert({x, k});
    else
      ans = false;
  }
  cout << (ans ? "YES" : "NO");
}
