#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > v;
string s[3000];
int main() {
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> s[i] >> x;
    v.push_back(make_pair(x, i));
  }
  sort(v.begin(), v.end());
  vector<int> ans, res(n);
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first > i) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) ans.insert(ans.begin() + v[i].first, v[i].second);
  for (int i = 0; i < n; i++) res[ans[i]] = i;
  for (int i = 0; i < n; i++)
    cout << s[v[i].second] << " " << n + 1 - res[v[i].second] << endl;
  return 0;
}
