#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, string> a[3001];
vector<pair<int, string> > ans;
int h[3001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i].second >> a[i].first;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (a[i].first > (i - 1)) {
      cout << -1;
      return 0;
    }
    h[i] = n - (i - 1);
    ans.insert(ans.begin() + a[i].first, make_pair(h[i], a[i].second));
  }
  for (vector<pair<int, string> >::iterator it = ans.begin(); it != ans.end();
       ++it) {
    cout << (*it).second << ' ' << (*it).first << endl;
  }
}
