#include <bits/stdc++.h>
using namespace std;
int n;
int fr[100002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  memset(fr, -1, sizeof(fr));
  for (int i = 1; i <= n; ++i) {
    int a, b;
    cin >> a >> b;
    if (a <= fr[b] || a == fr[b] + 1)
      fr[b] = max(fr[b], a);
    else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
