#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> m;
int main() {
  long n;
  cin >> n;
  for (auto i = 0; i < n; i++) {
    long x, k;
    cin >> x >> k;
    if (x and !m[{x - 1, k}]) return cout << "NO", 0;
    m[{x, k}] = 1;
  }
  return cout << "YES", 0;
}
