#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, k;
} qu[100005];
int vis[100005], ans[100005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    memset(ans, 0, sizeof(ans));
    int flag = 1;
    for (int i = 0; i < 100005; i++) ans[i] = -1;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &qu[i].x, &qu[i].k);
      vis[qu[i].k] = qu[i].x;
      if (vis[qu[i].k] <= ans[qu[i].k] + 1) {
        if (ans[qu[i].k] + 1 == vis[qu[i].k]) ans[qu[i].k]++;
      } else
        flag = 0;
    }
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
