#include <bits/stdc++.h>
using namespace std;
long er, ans[200000], n, a, b;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i <= 100000; i++) ans[i] = -1;
  er = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (ans[b] < a - 1) er = 1;
    ans[b] = max(ans[b], a);
  }
  if (er)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  cin.get();
  cin.get();
  return 0;
}
