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