#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100 * 1000 + 5;
int n;
vector<int> arr[Maxn];
int main() {
  scanf("%d", &n);
  int x, k;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &k);
    arr[k - 1].push_back(x);
  }
  for (int i = 0; i < Maxn; i++) {
    int num = -1;
    for (int j = 0; j < (int)arr[i].size(); j++) {
      if (arr[i][j] > num + 1) {
        printf("NO\n");
        return 0;
      }
      if (arr[i][j] == num + 1) num++;
    }
  }
  printf("YES\n");
  return 0;
}
