#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int N = 4000;
struct T {
  string name;
  int a;
  void Read() { cin >> name >> a; }
  bool operator<(const T &x) const { return a > x.a; }
};
void NO() {
  cout << -1;
  exit(0);
}
int main() {
  int n;
  cin >> n;
  vector<T> h(n);
  vector<T> res;
  for (int i = 0; i < n; i++) h[i].Read();
  sort((h).begin(), (h).end());
  int cnt = 0;
  while (cnt < n) {
    int i;
    for (i = 0; i < (int)(h).size(); i++)
      if (h[i].a <= cnt) break;
    if (i == (int)(h).size()) {
      puts("-1");
      return 0;
    }
    h[i].a = 4000 - h[i].a;
    res.push_back(h[i]);
    h.erase(h.begin() + i);
    cnt++;
  }
  for (int i = 0; i < (int)(res).size(); i++)
    cout << res[i].name << " " << res[i].a << endl;
  return 0;
}
