#include <bits/stdc++.h>
using namespace std;
int n, t, a[3001], b[3001], key[3001];
bool flag;
char s[3001][101];
inline bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s%d", s[i], &a[i]);
    key[i] = i;
  }
  sort(key + 1, key + n + 1, cmp);
  flag = true;
  for (int i = n; i; i--) {
    t = 0;
    for (int j = n; j; j--)
      if (a[key[j]] == 0) {
        t = j;
        break;
      }
    if (!t) {
      flag = false;
      break;
    }
    for (int j = t; j <= n; j++) a[key[j]]--;
    b[key[t]] = i;
  }
  if (flag)
    for (int i = 1; i <= n; i++) printf("%s %d\n", s[key[i]], b[key[i]]);
  else
    puts("-1");
  return 0;
}
