#include <bits/stdc++.h>
using namespace std;
map<long long int, int> vis;
const long long int k = 1000000;
int main() {
  long long int n, a, b;
  cin >> n;
  int flag = 1;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a != 0 && vis[b * k + a - 1] == 0) flag = 0;
    vis[b * k + a] = 1;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
