#include <bits/stdc++.h>
int s[100001];
using namespace std;
int main() {
  memset(s, -1, sizeof(s));
  int n;
  cin >> n;
  bool is = 0;
  for (int i = 0; i < n; i++) {
    int x, k;
    cin >> x >> k;
    if (s[k] + 1 < x) is = 1;
    s[k] = s[k] > x ? s[k] : x;
  }
  if (is)
    cout << "NO";
  else
    cout << "YES";
  cout << endl;
  return 0;
}
