#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dx[8] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
vector<int> adj[100010], vis(100010, 0), dis(100010, 0);
void solve() {
  int n;
  cin >> n;
  vector<int> v[n + 1];
  vector<int> pre;
  map<int, int> mt;
  multimap<int, string> ms;
  for (long long i = 0; i < n; i++) {
    string s;
    int a;
    cin >> s >> a;
    pre.push_back(a);
    ms.insert({a, s});
    mt[a]++;
  }
  sort((pre).begin(), (pre).end());
  for (int i = 0; i < (int)pre.size(); i++) {
    if (pre[i] > i) {
      cout << -1 << '\n';
      return;
    }
  }
  vector<int> ans;
  vector<int> aux;
  auto itr = mt.begin();
  int cnt = 0;
  while (itr != mt.end()) {
    auto itk = itr;
    itk++;
    if (itk != mt.end()) {
      int num = itk->first - cnt;
      if (num <= itr->second) {
        for (int i = 0; i < num; i++) {
          ans.push_back(itr->first);
        }
        for (int i = num; i < itr->second; i++) {
          aux.push_back(itr->first);
        }
      } else {
        for (int i = 0; i < itr->second; i++) {
          ans.push_back(itr->first);
        }
        for (int i = itr->second; i < num; i++) {
          ans.push_back(aux.back());
          aux.pop_back();
        }
      }
      cnt = cnt + num;
    } else {
      for (int i = 0; i < itr->second; i++) {
        ans.push_back(itr->first);
      }
      while (!aux.empty()) {
        ans.push_back(aux.back());
        aux.pop_back();
      }
    }
    itr++;
  }
  int height = 1e9;
  vector<pair<string, int>> md;
  for (int i = 0; i < (int)ans.size(); i++) {
    auto itr = ms.find(ans[i]);
    md.push_back({itr->second, height - itr->first});
    ms.erase(itr);
  }
  auto itf = md.begin();
  while (itf != md.end()) {
    cout << itf->first << " " << itf->second << '\n';
    itf++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q = 1;
  while (q--) {
    solve();
  }
}
