#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> mp;
int main() {
  int n, i, x, k;
  while (scanf("%d", &n) != EOF) {
    mp.clear();
    bool flag = true;
    for (i = 1; i <= 100000; i++) mp[pair<int, int>(i, 0)] = true;
    for (i = 0; i < n; i++) {
      scanf("%d %d", &x, &k);
      if (!flag) continue;
      x++;
      if (mp[pair<int, int>(k, x - 1)])
        mp[pair<int, int>(k, x)] = true;
      else
        flag = false;
    }
    if (flag)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
