#include <bits/stdc++.h>
using namespace std;
using psi = pair<string, int>;
using vpsi = vector<psi>;
int main() {
  int N = 0;
  cin >> N;
  vpsi people;
  people.reserve(N);
  for (int i = 0; i < N; i++) {
    string s;
    int appo;
    cin >> s >> appo;
    people.emplace_back(s, appo);
  }
  sort(people.begin(), people.end(),
       [](const psi& l, const psi& r) { return l.second < r.second; });
  for (int i = 0; i < N; i++) {
    if (people[i].second > i) {
      cout << "-1\n";
      return 0;
    }
  }
  vpsi answers(N);
  int i = N - 1;
  int h = 1;
  while (i >= 0) {
    int V = people[i].second;
    int j = i;
    while (people[j].second == V && j >= 0) --j;
    int free_idx = V;
    for (int k = j + 1; k < i + 1; ++k) {
      while (answers[free_idx].second != 0 && free_idx < N) {
        free_idx++;
      }
      answers[free_idx] = psi(people[k].first, h);
      ++h;
    }
    i = j;
  }
  for (int i = 0; i < N; i++) {
    cout << answers[i].first << " " << answers[i].second << "\n";
  }
  return 0;
}
