#include <bits/stdc++.h>
using namespace std;
struct guy {
  string s;
  int a;
};
inline bool operator<(guy left, guy right) { return left.a < right.a; }
vector<guy> ppl;
int b[3010], h[3010];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string tmp;
    int temp;
    cin >> tmp >> temp;
    guy wat;
    wat.s = tmp;
    wat.a = temp;
    ppl.push_back(wat);
  }
  sort(ppl.begin(), ppl.end());
  for (int k = 0; k < n; k++)
    if (ppl[k].a > k) {
      cout << -1;
      return 0;
    }
  for (int k = 0; k < n; k++) b[k] = k;
  for (int k = 1; k < n; k++)
    for (int i = k - 1; i >= ppl[k].a; i--) swap(b[i + 1], b[i]);
  for (int k = 0; k < n; k++) h[b[k]] = n - k;
  for (int k = 0; k < n; k++) cout << ppl[k].s << " " << h[k] << '\n';
  return 0;
}
