#include <bits/stdc++.h>
using namespace std;
int n, x, k;
map<int, int> m;
int main() {
  int flag = 0;
  scanf("%d\n", &n);
  while (n--) {
    scanf("%d%d", &x, &k);
    x++;
    if (x == m[k] + 1)
      m[k]++;
    else if (x > m[k])
      flag = 1;
  }
  if (flag == 1)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
