#include <bits/stdc++.h>
using namespace std;
const int N = 3100;
struct node {
  char s[15];
  int x;
} a[N];
bool cmp(node a, node b) { return a.x < b.x; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s%d", a[i].s, &a[i].x);
  }
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    a[i].x = i - a[i].x;
    if (a[i].x <= 0) {
      printf("-1\n");
      return 0;
    }
    for (int j = 1; j < i; j++) {
      if (a[j].x >= a[i].x) {
        a[j].x++;
      }
    }
  }
  for (int i = 1; i <= n; i++) printf("%s %d\n", a[i].s, a[i].x);
  return 0;
}
