#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000 + 10;
int n, flg;
struct node {
  int a, h;
  char na[12];
  bool operator<(const node &b) const { return a < b.a; }
} p[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%s%d", &p[i].na, &p[i].a);
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (p[i].a >= i) {
      flg = 1;
      break;
    }
    p[i].h = i - p[i].a;
    for (int j = 1; j < i; ++j)
      if (p[j].h >= p[i].h) p[j].h++;
  }
  if (flg)
    printf("-1\n");
  else
    for (int i = 1; i <= n; ++i) printf("%s %d\n", p[i].na, p[i].h + 100);
  return 0;
}
