#include <bits/stdc++.h>
using namespace std;
set<int> s[100005];
set<int>::iterator it;
int main() {
  int i, n, k, x;
  cin >> n;
  int flag = 0;
  for (i = 0; i < n; i++) {
    cin >> x >> k;
    if (x == 0)
      s[k].insert(x);
    else {
      it = s[k].find(x - 1);
      if (it == s[k].end()) flag = 1;
      s[k].insert(x);
    }
  }
  if (flag)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
