#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000], x, k, f = 0;
  cin >> n;
  for (int i = 0; i < 100000; i++) a[i] = -1;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (a[k - 1] < x - 1)
      f = 1;
    else
      a[k - 1] = max(a[k - 1], x);
  }
  if (f == 1)
    cout << "NO";
  else
    cout << "YES";
}
