#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, k, num;
};
int n;
P p[100005];
int cmp(const P &a, const P &b) {
  if (a.k < b.k)
    return 1;
  else if (a.k == b.k) {
    if (a.x < b.x)
      return 1;
    else if (a.x == b.x) {
      if (a.num < b.num)
        return 1;
      else
        return 0;
    } else
      return 0;
  } else
    return 0;
}
int main() {
  int i, cnt;
  bool flag;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &p[i].x, &p[i].k);
    p[i].num = i;
  }
  sort(p, p + n, cmp);
  cnt = 0;
  for (i = 1; i < n; i++)
    if (p[i].x == p[i - 1].x && p[i].k == p[i - 1].k)
      continue;
    else {
      cnt++;
      p[cnt] = p[i];
    }
  flag = true;
  if (p[0].x != 0) flag = false;
  for (i = 1; i <= cnt; i++)
    if (p[i].k == p[i - 1].k) {
      if (p[i].x != p[i - 1].x + 1) {
        flag = false;
        break;
      }
      if (p[i].num < p[i - 1].num) {
        flag = false;
        break;
      }
    } else {
      if (p[i].x != 0) {
        flag = false;
        break;
      }
    }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
