#include <bits/stdc++.h>
using namespace std;
long long int arr[750000];
int main() {
  int t, a, b;
  cin >> t;
  int arr[100005];
  memset(arr, -1, sizeof(arr));
  while (t--) {
    cin >> a >> b;
    if (a == 0 and arr[b] == -1)
      arr[b] = 0;
    else {
      if (arr[b] == a - 1)
        arr[b] = a;
      else if (arr[b] >= a)
        continue;
      else {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
  return 0;
}
