#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000 + 17;
pair<int, int> P[MAXN];
string name[MAXN];
vector<pair<int, int> > ans;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> name[i] >> P[i].first;
    P[i].second = i;
  }
  sort(P + 1, P + 1 + n);
  for (int i = 1; i <= n; ++i) {
    if (P[i].first > i - 1) {
      cout << "-1\n";
      return 0;
    }
    ans.insert(ans.begin() + P[i].first, {n - i + 1, P[i].second});
  }
  for (pair<int, int> &e : ans)
    cout << name[e.second] << " " << e.first << "\n";
}
