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