#include <bits/stdc++.h>
using namespace std;
int maximum(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
bool cmp(const pair<int, int>& firs, const pair<int, int>& sec) {
  return firs.first < sec.first;
}
vector<int> v[100005];
int main() {
  int n;
  int x, k, i;
  int idx = 0, flag = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    scanf("%d", &k);
    int idy;
    idy = binary_search(v[k].begin(), v[k].end(), x);
    if (idy == 0) v[k].push_back(x);
    if (x != 0) {
      idx = binary_search(v[k].begin(), v[k].end(), x - 1);
      if (idx == 0) {
        flag = 1;
        break;
      }
    }
  }
  if (flag == 0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
