#include <bits/stdc++.h>
using namespace std;
pair<string, int> a[3005];
vector<pair<string, int> > ans;
bool cmp(pair<string, int> a, pair<string, int> b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++)
    if (a[i].second > i) {
      cout << "-1\n";
      return 0;
    }
  for (int i = 0; i < n; i++) ans.insert(ans.begin() + a[i].second, a[i]);
  for (int i = 0; i < n; i++)
    cout << ans[i].first << ' ' << n - ans[i].second << '\n';
  return 0;
}
