#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, mark = 0, x, y;
  scanf("%d", &n);
  memset(a, -1, sizeof(a));
  for (int i = 0, j; i < n; i++) {
    scanf("%d%d", &x, &y);
    if (a[y] < x - 1)
      mark = 1;
    else
      a[y] = max(a[y], x);
  }
  if (mark)
    cout << "NO" << '\n';
  else
    cout << "YES" << '\n';
  return 0;
}
