#include <bits/stdc++.h>
using namespace std;
void Yahia74() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 3e3 + 74, M = 1e5 + 74, OO = 0x3f3f3f3f;
pair<int, string> a[N];
bool vis[N];
int main() {
  Yahia74();
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; --i) {
    if (a[i].first > i) return cout << -1, 0;
    for (int j = n - a[i].first; j > 0; j--) {
      if (!vis[j]) {
        vis[j] = true;
        a[i].first = j;
        break;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << a[i].second << ' ' << a[i].first << '\n';
  }
  return 0;
}
