#include <bits/stdc++.h>
using namespace std;
struct person {
  string name;
  int pos;
} a[3010];
vector<person> res;
int n, cnt;
bool operator<(person p1, person p2) { return p1.pos < p2.pos; }
int main() {
  cin >> n;
  int i;
  for (i = 1; i <= n; i++) cin >> a[i].name >> a[i].pos;
  sort(a + 1, a + 1 + n);
  cnt = n + 1;
  for (i = 1; i <= n; i++) {
    if (res.size() < a[i].pos) {
      cout << -1;
      return 0;
    }
    person np;
    np.name = a[i].name;
    np.pos = cnt--;
    res.insert(res.begin() + a[i].pos, np);
    int j;
  }
  for (i = 0; i < res.size(); i++)
    cout << res[i].name << " " << res[i].pos << endl;
}
