#include <bits/stdc++.h>
using namespace std;
int const INF = 100000;
int p[INF + 1];
int M[INF + 1];
int main() {
  memset(p, -1, sizeof(p));
  memset(M, -1, sizeof(M));
  set<pair<int, int> > S;
  int n, x, k;
  cin >> n;
  while (n--) {
    cin >> x >> k;
    if (p[k] < x) {
      p[k] = x;
      M[k] = max(M[k], x);
      S.insert(pair<int, int>(x, k));
    } else {
      if (S.find(pair<int, int>(x, k)) != S.end())
        continue;
      else {
        cout << "NO";
        return 0;
      }
    }
  }
  long long cmp = 0;
  for (int i = 0; i <= INF; i++) cmp += (M[i] + 1);
  if (cmp == S.size())
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
