#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
int cnt[N];
int main() {
  int n, x, k, i;
  while (~scanf("%d", &n)) {
    memset(cnt, -1, sizeof(cnt));
    bool f = true;
    for (i = 0; i < n; ++i) {
      scanf("%d%d", &x, &k);
      if (cnt[k] == x - 1)
        cnt[k] = x;
      else if (cnt[k] >= x)
        continue;
      else
        f = false;
    }
    if (f == false)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
