#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N];
int main() {
  int n;
  int x, k;
  while (cin >> n) {
    bool flag = 0;
    memset(a, 0, sizeof(a));
    for (int i = 0; i < n; i++) {
      cin >> x >> k;
      if (a[k] < x) {
        flag = 1;
      } else {
        a[k] = max(a[k], x + 1);
      }
    }
    if (!flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
