#include <bits/stdc++.h>
using namespace std;
template <class T>
void pp(T v) {
  for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it)
    cout << *it << ' ';
  cout << endl;
}
template <class T>
void pp(T v, int n) {
  for (int i = 0; i < (int)n; i++) cout << v[i] << ' ';
  cout << endl;
}
const int INF = 1 << 28;
const double EPS = 1.0e-9;
bool solve(const vector<pair<int, string> > &data) {
  const int n = data.size();
  for (int i = 0; i < (int)n; i++) {
    if (data[i].first > i) return false;
  }
  vector<int> height(n);
  vector<int> ans;
  for (int i = 0, h = n; i < n; i++, h--) {
    ans.insert(ans.begin() + data[i].first, i);
    height[i] = h;
  }
  for (int i = 0; i < (int)n; i++) {
    cout << data[ans[i]].second << " " << height[ans[i]] << endl;
  }
  return true;
}
int main(void) {
  int n;
  cin >> n;
  vector<pair<int, string> > data(n);
  for (int i = 0; i < (int)n; i++) {
    string name;
    int a;
    cin >> name >> a;
    data[i] = make_pair(a, name);
  }
  sort((data).begin(), (data).end());
  bool ans = solve(data);
  if (ans == false) cout << -1 << endl;
  return 0;
}
