#include <bits/stdc++.h>
using namespace std;
void sprint(string s) {
  for (int i = 0; i < s.size(); ++i) printf("%c", s[i]);
  printf("\n");
}
int main() {
  int n;
  scanf("%d", &n);
  string name[n];
  int val[n], h[n];
  pair<int, int> p[n];
  for (int i = 0; i < n; ++i) {
    cin >> name[i];
    scanf("%d", &val[i]);
    p[i] = {val[i], i};
  }
  sort(p, p + n);
  set<int> s;
  for (int i = 0; i < n; ++i) {
    s.insert(i + 1);
  }
  for (int i = n - 1; i >= 0; --i) {
    int x = p[i].first;
    if (x > i) {
      printf("-1\n");
      return 0;
    }
    auto it = s.begin();
    advance(it, i - x);
    h[i] = *it;
    s.erase(it);
  }
  for (int i = 0; i < n; ++i) {
    cout << name[p[i].second] << " " << h[i] << endl;
  }
  return 0;
}
