#include <bits/stdc++.h>
using namespace std;
typedef struct node_t {
  string name;
  int h;
} node_t;
int n;
node_t node[3010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> node[i].name >> node[i].h;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (node[i].h > node[j].h) {
        string str = node[i].name;
        int h = node[i].h;
        node[i].name = node[j].name;
        node[i].h = node[j].h;
        node[j].name = str;
        node[j].h = h;
      }
    }
  }
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    if (i - node[i].h < 1) {
      flag = false;
      break;
    }
    node[i].h = i - node[i].h;
    for (int j = 1; j < i; j++) {
      if (node[j].h >= node[i].h) {
        node[j].h = node[j].h + 1;
      }
    }
  }
  if (!flag) {
    cout << -1;
  } else {
    for (int i = 1; i <= n; i++) {
      cout << node[i].name << " " << node[i].h << endl;
    }
  }
  return 0;
}
