#include <bits/stdc++.h>
using namespace std;
long long i, j;
vector<pair<long long, string> > v;
pair<long long, string> a[3004];
int main() {
  int tc;
  long long n;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  vector<pair<long long, string> >::iterator it;
  long long val = 1000000000;
  for (i = 0; i < n; i++) {
    if (i == 0) {
      v.push_back(make_pair(val, a[i].second));
      val--;
      continue;
    }
    if (a[i].first > i) {
      cout << "-1" << endl;
      return 0;
    }
    it = v.begin() + a[i].first;
    v.insert(it, make_pair(val, a[i].second));
    val--;
  }
  for (i = 0; i < n; i++) {
    cout << v[i].second << " " << v[i].first << endl;
  }
  return 0;
}
