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