#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  multimap<int, string> a;
  vector<pair<int, string>> res;
  vector<int> h;
  res.resize(n);
  h.resize(n);
  for (int i = 0; i < n; i++) {
    string s;
    int ai;
    cin >> s >> ai;
    a.insert({ai, s});
  }
  int i = 0;
  for (auto &it : a)
    if (it.first > i++) {
      cout << "-1\n";
      return 0;
    }
  for (int i = 0; i < n; i++) h[i] = n - i;
  i = 0;
  for (auto &it : a) {
    res.insert(res.begin() + it.first, {h[i++], it.second});
  }
  for (int i = 0; i < n; i++)
    cout << res[i].second << " " << res[i].first << "\n";
  return 0;
}
