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