#include <bits/stdc++.h>
const long long inf = 1e18 + 44;
const int MAX = 3e5 + 9;
const long long int MOD = 1e9 + 7;
const double eps = 1e-1;
double const PI = 3.1415926535897931;
using namespace std;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  string s;
  cin >> n;
  vector<pair<int, string> > v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> s >> x;
    v.push_back({x, s});
  }
  int ans[n + 1];
  sort(v.begin(), v.end());
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < n; i++) {
    if (i < v[i].first) {
      cout << -1;
      return 0;
    }
    ans[i] = i - v[i].first;
    for (int j = 0; j < i; j++)
      if (ans[j] >= ans[i]) ans[j]++;
  }
  for (int i = 0; i < n; i++)
    cout << v[i].second << " " << +180 + ans[i] << endl;
}
