#include <bits/stdc++.h>
using namespace std;
set<int> s[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  bool f = false;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 0)
      s[b].insert(a);
    else if (s[b].find(a - 1) == s[b].end())
      f = true;
    else
      s[b].insert(a);
  }
  if (f)
    cout << "NO\n";
  else
    cout << "YES\n";
  return 0;
}
