#include <bits/stdc++.h>
using namespace std;
int n;
struct Node {
  int x, k;
} a[100010];
int dp[100010];
int main() {
  int i, j, k;
  memset(dp, 0, sizeof(dp));
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i].x >> a[i].k;
  for (i = 0; i < n; i++) {
    if (a[i].x > dp[a[i].k]) {
      cout << "NO" << endl;
      return 0;
    } else if (a[i].x == dp[a[i].k]) {
      dp[a[i].k]++;
    }
  }
  cout << "YES" << endl;
  return 0;
}
