#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000;
int a[100002];
int main() {
  int n, x, y;
  for (int i = 1; i <= maxn; i++) a[i] = -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    if (a[y] >= (x - 1))
      a[y] = max(a[y], x);
    else
      return printf("NO\n"), 0;
  }
  printf("YES\n");
  return 0;
}
