#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3001;
const long long MODN = 1000000007;
int N;
string s;
int a;
vector<pair<int, string>> peeps;
vector<pair<int, string>> heigs;
int h[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> s >> a;
    peeps.push_back(make_pair(a, s));
  }
  sort(peeps.begin(), peeps.end());
  bool works = true;
  for (int i = 0; i < N; i++) {
    int newPos = heigs.size() - peeps[i].first;
    if (newPos < 0) {
      works = false;
      break;
    } else {
      heigs.insert(heigs.begin() + newPos, peeps[i]);
    }
  }
  if (works) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < heigs.size(); j++) {
        if (peeps[i] == heigs[j]) {
          cout << peeps[i].second << " " << (j + 1) << endl;
          break;
        }
      }
    }
  } else {
    cout << -1 << endl;
  }
}
