#include <bits/stdc++.h>
using namespace std;
struct Man {
  string name;
  int a;
  int h;
};
vector<Man> mans;
vector<Man> res;
bool MansCompare(Man a, Man b) { return (a.a < b.a); }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    Man man;
    cin >> man.name >> man.a;
    mans.push_back(man);
  }
  sort(mans.begin(), mans.end(), MansCompare);
  for (int i = 0; i < mans.size(); i++) {
    if (mans[i].a > i) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < mans.size(); i++) {
    mans[i].h = n - i;
    res.insert(res.begin() + mans[i].a, mans[i]);
  }
  for (int i = 0; i < res.size(); i++)
    cout << res[i].name << " " << res[i].h << endl;
}
