#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, string> > > myvec;
vector<pair<int, pair<int, string> > > sol;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    int a;
    cin >> a;
    myvec.push_back(make_pair(a, make_pair(0, x)));
  }
  sort(myvec.begin(), myvec.end());
  int h = 3500;
  for (int i = 0; i < myvec.size(); i++) {
    myvec[i].second.first = h;
    h--;
  }
  for (int i = 0; i < myvec.size(); i++) {
    if (myvec[i].first > sol.size()) {
      cout << -1 << endl;
      return 0;
    }
    sol.insert(sol.begin() + myvec[i].first, myvec[i]);
  }
  for (int i = 0; i < sol.size(); i++) {
    cout << sol[i].second.second << " " << sol[i].second.first << endl;
  }
  return 0;
}
