#include <bits/stdc++.h>
using namespace std;
void loadData(void);
void proc(void);
void printRes(void);
typedef struct Player {
  string name;
  int best;
  string res;
} player;
int n;
vector<player> players;
vector<int> scores;
int getNameIndex(const string &names);
string getRes(int better, int best, int);
bool lyb_debug = false;
int main(int argc, char **argv) {
  loadData();
  proc();
  printRes();
  return 0;
}
string getRes(int better, int best, int index) {
  double betterrate = (double)better / scores.size();
  int score50 = scores.size() % 2 == 0 ? scores[scores.size() / 2 - 1]
                                       : scores[scores.size() / 2];
  int score80 = scores.size() * 4 % 5 == 0 ? scores[scores.size() * 4 / 5 - 1]
                                           : scores[scores.size() * 4 / 5];
  int score90 = scores.size() * 9 % 10 == 0 ? scores[scores.size() * 9 / 10 - 1]
                                            : scores[scores.size() * 9 / 10];
  int score99 = scores.size() * 99 % 100 == 0
                    ? scores[scores.size() * 99 / 100 - 1]
                    : scores[scores.size() * 99 / 100];
  if (lyb_debug) {
    printf(
        "check %s: betterrate = %lf score = %d score50:%d score80:%d "
        "score90:%d score99:%d\n",
        players[index].name.c_str(), betterrate, players[index].best, score50,
        score80, score90, score99);
  }
  if (betterrate > 0.5) return "noob";
  if (best >= score50 && betterrate > 0.2) return "random";
  if (best >= score80 && betterrate > 0.1) return "average";
  if (best >= score90 && betterrate > 0.01) return "hardcore";
  return "pro";
}
void proc(void) {
  sort(scores.begin(), scores.end());
  for (int i = 0; i < players.size(); i++) {
    int better = scores.end() -
                 upper_bound(scores.begin(), scores.end(), players[i].best);
    players[i].res = getRes(better, players[i].best, i);
  }
  return;
}
int getNameIndex(const string &names) {
  for (int i = 0; i < players.size(); i++)
    if (players[i].name == names) return i;
  return players.size();
}
void loadData(void) {
  char enter;
  char nameInput[11];
  string names;
  int scoreInput;
  players.clear();
  scanf("%d%c", &n, &enter);
  for (int i = 0; i < n; i++) {
    scanf("%s%c%d%c", nameInput, &enter, &scoreInput, &enter);
    names = nameInput;
    int nameIndex = getNameIndex(names);
    if (nameIndex < players.size()) {
      players[nameIndex].best = max(players[nameIndex].best, scoreInput);
    } else {
      player newPlayer;
      newPlayer.name = names;
      newPlayer.best = scoreInput;
      players.push_back(newPlayer);
    }
  }
  scores.clear();
  for (int i = 0; i < players.size(); i++) scores.push_back(players[i].best);
  return;
}
void printRes(void) {
  printf("%d\n", players.size());
  for (int i = 0; i < players.size(); i++)
    printf("%s %s\n", players[i].name.c_str(), players[i].res.c_str());
  return;
}
