#include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 5;
int n, x, k;
int vis[Max];
int main() {
  while (cin >> n) {
    memset(vis, -1, sizeof(vis));
    int flag = 1;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &x, &k);
      if (x > vis[k] && x != vis[k] + 1) {
        flag = 0;
      } else if (x > vis[k] && x == vis[k] + 1) {
        vis[k] = x;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
