#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, flag = 1;
  cin >> n;
  vector<pair<int, string>> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].second >> v[i].first;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    if (v[i].first > i) {
      flag = 0;
      break;
    }
  }
  if (!flag)
    cout << -1 << endl;
  else {
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
      ans[i] = i - v[i].first;
      for (int j = 0; j < i; j++)
        if (ans[j] >= ans[i]) ans[j]++;
    }
    for (int i = 0; i < n; i++)
      cout << v[i].second << " " << ans[i] + 1 << endl;
  }
}
