#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  int sz[100005];
  while (~scanf("%d", &n)) {
    for (int i = 0; i <= 100000; i++) sz[i] = -1;
    int out = 1;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &a, &b);
      if (a > sz[b] + 1)
        out = 0;
      else if (a == sz[b] + 1)
        sz[b]++;
    }
    if (out == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
