#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int n;
struct Person {
  string name;
  int nums;
  bool operator<(const Person& other) const {
    if (nums != other.nums) return nums < other.nums;
    return name < other.name;
  }
} people[N];
int heights[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> people[i].name >> people[i].nums;
  }
  sort(people, people + n);
  for (int i = 0; i < n; i++) {
    if (i < people[i].nums) {
      cout << -1 << endl;
      return 0;
    }
  }
  vector<Person> res;
  int h = 3000;
  for (int i = 0; i < n; i++) {
    Person p;
    p.name = people[i].name;
    p.nums = h;
    res.insert(res.begin() + people[i].nums, p);
    h--;
  }
  for (int i = 0; i < n; i++) {
    cout << res[i].name << ' ' << res[i].nums << endl;
  }
  return 0;
}
