#include <bits/stdc++.h>
using namespace std;
vector<int> s[100050];
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, x, k;
  cin >> n;
  int flag = 1;
  for (int i = (1); i <= (n); ++i) {
    cin >> x >> k;
    if (x == 0) {
      if (s[k].empty()) s[k].push_back(0);
    } else {
      if (s[k].empty())
        flag = 0;
      else if (s[k].back() + 1 == x)
        s[k].push_back(x);
      else if (s[k].back() + 1 < x)
        flag = 0;
    }
  }
  cout << (flag > 0 ? "YES\n" : "NO\n");
  return 0;
}
