#include <bits/stdc++.h>
using namespace std;
struct nod {
  string x;
  int y;
} a[3005], ans[3005];
bool cmp(const nod& a, const nod& b) { return a.y < b.y; }
int n, fl;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x;
    cin >> a[i].y;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (a[i].y >= i) {
      puts("-1");
      fl = 1;
      break;
    }
    for (int j = 1; j < i; j++)
      if (ans[j].y >= a[i].y) ans[j].y++;
    ans[i].x = a[i].x;
    ans[i].y = a[i].y;
  }
  if (!fl)
    for (int i = 1; i <= n; i++) {
      cout << ans[i].x << ' ' << 3005 * 2 - ans[i].y << endl;
      printf("\n");
    }
  return 0;
}
