#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int main() {
  int n, a, b;
  scanf("%d", &n);
  bool flag = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    if (a == 0) {
      if (v[b].size() == 0) v[b].push_back(a);
    } else {
      if (v[b].size() == 0) {
        flag = 0;
        break;
      } else {
        if (v[b][v[b].size() - 1] < a - 1) {
          flag = 0;
          break;
        } else {
          if (a == v[b][v[b].size() - 1] + 1) v[b].push_back(a);
        }
      }
    }
  }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
