#include <bits/stdc++.h>
using namespace std;
map<string, int> scores;
vector<int> all_scores;
int main() {
  int n, score;
  cin >> n;
  string name;
  for (int i = 0; i < n; i++) {
    cin >> name >> score;
    if (score > scores[name]) scores[name] = score;
  }
  for (auto it = scores.begin(); it != scores.end(); it++)
    all_scores.push_back(it->second);
  sort(all_scores.begin(), all_scores.end());
  cout << scores.size() << endl;
  for (auto it = scores.begin(); it != scores.end(); it++) {
    score = it->second;
    auto ub = upper_bound(all_scores.begin(), all_scores.end(), score);
    cout << it->first << ' ';
    if (static_cast<double>(all_scores.end() - ub) / all_scores.size() > 0.5)
      cout << "noob";
    else if (static_cast<double>(all_scores.end() - ub) / all_scores.size() <=
                 0.5 &&
             static_cast<double>(all_scores.end() - ub) / all_scores.size() >
                 0.2)
      cout << "random";
    else if (static_cast<double>(all_scores.end() - ub) / all_scores.size() <=
                 0.2 &&
             static_cast<double>(all_scores.end() - ub) / all_scores.size() >
                 0.1)
      cout << "average";
    else if (static_cast<double>(all_scores.end() - ub) / all_scores.size() <=
                 0.1 &&
             static_cast<double>(all_scores.end() - ub) / all_scores.size() >
                 0.01)
      cout << "hardcore";
    else
      cout << "pro";
    cout << endl;
  }
}
