#include <bits/stdc++.h>
#pragma optimize("O3")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  pair<int, string> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  vector<pair<int, string> > ans;
  int hi = 4000;
  for (int i = 0; i < n; i++) {
    if (a[i].first > i) {
      cout << "-1\n";
      return 0;
    } else {
      if (i == 0 or a[i].first != a[i - 1].first) hi -= 1;
      for (int j = 0; j <= ans.size(); j++) {
        if (a[i].first == j) {
          ans.insert(ans.begin() + j, make_pair(hi, a[i].second));
          break;
        }
      }
    }
  }
  for (auto x : ans) cout << x.second << " " << x.first << "\n";
  return 0;
}
