#include <bits/stdc++.h>
using namespace std;
void task();
int main() {
  task();
  return 0;
}
const int N = (int)1e6 + 10;
const long long int MODULO = (long long int)1e9 + 7;
const int INF = (int)1e9;
const int BUF_SIZE = (int)1e5 + 10;
int n;
pair<int, string> a[3010];
char buf[100];
void task() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s %d", buf, &a[i].first);
    a[i].second = buf;
  }
  sort(a, a + n);
  list<pair<string, int> > ans;
  int i = 0, min_gr = 5000;
  auto it = ans.begin();
  while (i < n && a[i].first == 0) {
    ans.insert(it, {a[i].second, min_gr});
    ++it;
    ++i;
  }
  for (; i < n; ++i) {
    if (a[i].first > (int)ans.size()) {
      printf("-1");
      return;
    }
    --min_gr;
    it = ans.begin();
    for (int j = 0; j < a[i].first; ++j, ++it)
      ;
    ans.insert(it, {a[i].second, min_gr});
  }
  for (auto x : ans) printf("%s %d\n", x.first.c_str(), x.second);
}
