#include <bits/stdc++.h>
using namespace std;
bool is_noob(vector<int> &scores, int &cont, int score) {
  cont = 0;
  int n = scores.size();
  for (int i = 0; i < n; i++) cont += scores[i] > score;
  return cont > n * 50.0 / 100.0;
}
bool is_random(vector<int> &scores, int cont) {
  int n = scores.size();
  return cont > n * 20.0 / 100.0;
}
bool is_average(vector<int> &scores, int cont) {
  int n = scores.size();
  return cont > n * 10.0 / 100.0;
}
bool is_hardcore(vector<int> &scores, int cont) {
  int n = scores.size();
  return cont > n / 100.0;
}
int main() {
  int n;
  int cont;
  string name;
  int points;
  map<string, int> players;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> name >> points;
    players[name] = max(points, players[name]);
  }
  vector<int> scores;
  for (map<string, int>::iterator it = players.begin(); it != players.end();
       it++)
    scores.push_back(it->second);
  cout << players.size() << endl;
  for (map<string, int>::iterator it = players.begin(); it != players.end();
       it++) {
    cout << it->first << " "
         << (is_noob(scores, cont, it->second) ? "noob"
             : is_random(scores, cont)         ? "random"
             : is_average(scores, cont)        ? "average"
             : is_hardcore(scores, cont)       ? "hardcore"
                                               : "pro")
         << endl;
  }
  return 0;
}
