#include <bits/stdc++.h>
using namespace std;
const int maxn = 3011;
int n;
vector<pair<int, string>> p;
int h[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    string name;
    cin >> name;
    int num;
    cin >> num;
    p.push_back(make_pair(num, name));
  }
  sort(p.begin(), p.end());
  for (int i = 0; i < n; i++) {
    if (i < p[i].first) {
      cout << -1 << endl;
      return 0;
    }
  }
  vector<pair<string, int>> heights;
  int i = 0;
  for (auto x : p) {
    heights.insert(heights.begin() + x.first, make_pair(x.second, 1e9 - i));
    i++;
  }
  for (auto x : heights) {
    cout << x.first << " " << x.second << endl;
  }
  return 0;
}
