#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000006;
const int MAXM = 20006;
const int INF = 11521204;
const int mod = 1000000007;
int a[100030], b[100030], c[100030];
int main() {
  int n, flag = 0;
  scanf("%d", &n);
  memset(c, -1, sizeof(c));
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    if (c[b[i]] < a[i] - 1) flag = 1;
    c[b[i]] = max(a[i], c[b[i]]);
  }
  if (flag)
    puts("NO");
  else
    puts("YES");
}
