#include <bits/stdc++.h>
using namespace std;
pair<int, string> T[3000];
int H[3000];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> T[i].second >> T[i].first;
  sort(T, T + n);
  if (T[0].first > 0) {
    cout << -1 << endl;
    return 0;
  }
  H[0] = 0;
  for (int i = 1; i < n; ++i) {
    int a = T[i].first;
    if (a > i) {
      cout << -1 << endl;
      return 0;
    }
    H[i] = a;
    for (int j = 0; j < i; ++j)
      if (H[j] >= a) H[j]++;
  }
  for (int i = 0; i < n; ++i) cout << T[i].second << ' ' << 3002 - H[i] << endl;
  return 0;
}
