#include <bits/stdc++.h>
using namespace std;
int caseno = 0;
void yesno(bool okk) { cout << (okk ? "YES" : "NO") << '\n'; }
const int primemod = 1000000007;
const long long maxsize = 1 * 1000000 + 9;
const double eps = 1e-10;
const int N = 210;
int freq[maxsize];
bool sortbysec(pair<string, int> a, pair<string, int> b) {
  return a.second < b.second;
}
long long n;
void solve() {
  cin >> n;
  vector<pair<string, int>> v(n + 1);
  for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
       i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin() + 1, v.end(), sortbysec);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    if (v[i + 1].second > i) {
      cout << -1 << '\n';
      return;
    }
  }
  vector<int> ans(n + 1, 1);
  for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
       i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
    ans[i] = 0 - v[i].second + i;
    for (__typeof(i) j = (1) - ((1) > (i)); j != (i) - ((1) > (i));
         j += 1 - 2 * ((1) > (i))) {
      if (ans[j] >= ans[i]) ans[j]++;
    }
  }
  for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
       i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1)))
    cout << v[i].first << " " << ans[i] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
