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