#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a;
vector<string> name;
int main() {
  int n, h;
  cin >> n;
  string na;
  for (int i = 0; i < n; ++i) {
    cin >> na >> h;
    name.push_back(na);
    a.push_back(make_pair(h, i));
  }
  sort(a.begin(), a.end());
  vector<int> que;
  for (int i = 0; i < n; ++i) {
    if (a[i].first > i) {
      cout << -1 << endl;
      return 0;
    }
    if (!que.empty()) {
      que.push_back(que[i]);
      for (int j = i; j > a[i].first; --j) que[j] = que[j - 1];
      que[a[i].first] = a[i].second;
    } else
      que.push_back(a[i].second);
  }
  int r[3001];
  for (int i = 0; i < n; ++i) r[que[i]] = n - i;
  for (int i = 0; i < n; ++i)
    cout << name[a[i].second] << ' ' << r[a[i].second] << endl;
  return 0;
}
