#include <bits/stdc++.h>
using namespace std;
string proc(int a, int b) {
  if (a * 2 > b) return "noob";
  if (a * 5 > b) return "random";
  if (a * 10 > b) return "average";
  if (a * 100 > b) return "hardcore";
  return "pro";
}
int main() {
  int i, n, x;
  string s;
  map<string, int> score;
  cin >> n;
  while (n--) {
    cin >> s >> x;
    if (score.find(s) == score.end()) score[s] = 0;
    score[s] = max(score[s], x);
  }
  vector<int> list;
  for (typeof(score.begin()) it = score.begin(); it != score.end(); it++)
    list.push_back(it->second);
  sort(list.rbegin(), list.rend());
  cout << ((int)score.size()) << endl;
  for (typeof(score.begin()) it = score.begin(); it != score.end(); it++) {
    for (i = 0; i < (int)(((int)list.size())); i++)
      if (list[i] == it->second) break;
    cout << it->first << " " << proc(i, ((int)list.size())) << endl;
  }
  return 0;
}
