#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000 + 5;
int n;
char nam[maxn][20];
struct People {
  int idx;
  int a;
  inline bool operator<(const People &b) const { return a < b.a; }
};
People pep[maxn];
vector<int> hlst;
int h[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    pep[i].idx = i;
    scanf("%s%d", nam[i], &pep[i].a);
  }
  sort(pep + 1, pep + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (hlst.size() < pep[i].a) {
      puts("-1");
      return 0;
    }
    hlst.insert(hlst.begin() + pep[i].a, pep[i].idx);
  }
  for (int i = 0, ht = 10000000; i < hlst.size(); ++i, ht -= 10) {
    h[hlst[i]] = ht;
  }
  for (int i = 1; i <= n; ++i)
    printf("%s %d\n", nam[pep[i].idx], h[pep[i].idx]);
  return 0;
}
