#include <bits/stdc++.h>
const int maxn = 2e5 + 10;
const int mod = 1e8 + 7;
using namespace std;
void init() {}
struct node {
  char s[15];
  int h, k;
} a[3005];
bool cmp(node x, node y) { return x.h < y.h; }
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].s >> a[i].h;
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    if (a[i].h >= i) {
      cout << -1;
      return 0;
    }
    a[i].k = i - a[i].h;
    for (int j = 1; j < i; j++)
      if (a[j].k >= a[i].k) a[j].k++;
  }
  for (int i = 1; i <= n; i++) cout << a[i].s << ' ' << a[i].k << endl;
  return 0;
}
