#include <bits/stdc++.h>
using namespace std;
inline void PAUSE() {
  char tmp;
  cin >> tmp;
}
int M[100001];
int f[100001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= 100000; i++) {
    M[i] = -1;
  }
  int x, k;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x, &k);
    if (x - M[k] > 1) {
      cout << "NO";
      return 0;
    }
    M[k] = x > M[k] ? x : M[k];
    f[k] = 1;
  }
  cout << "YES";
  PAUSE();
  return 0;
}
