#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3000;
pair<int, string> t[MAX_N];
pair<long long, string> h[MAX_N];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    char name[100];
    int a;
    cin >> name >> a;
    t[i] = make_pair(a, name);
  }
  sort(t, t + n);
  for (int i = 0; i < n; i++)
    if (t[i].first > i) {
      cout << "-1"
           << "\n";
      return 0;
    }
  int d;
  for (int i = 0; i < n; i++) {
    d = i - t[i].first;
    for (int j = 0; j < i; j++) {
      if (h[j].first >= d) h[j].first++;
    }
    h[i] = make_pair(d, t[i].second);
  }
  for (int i = 0; i < n; i++) {
    cout << h[i].second << " " << h[i].first + 1 << "\n";
  }
  return 0;
}
