#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
template <typename first>
inline first abs(const first& a) {
  return a < 0 ? -a : a;
}
template <typename first>
inline first sqr(const first& a) {
  return a * a;
}
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
const int INF = 1000 * 1000 * 1000;
int n;
map<string, int> score;
string verdict(int cnt, int total) {
  if (2 * cnt < total) return "noob";
  if (2 * cnt >= total && 5 * (total - cnt) > total) return "random";
  if (5 * cnt >= 4 * total && 10 * (total - cnt) > total) return "average";
  if (10 * cnt >= 9 * total && 100 * (total - cnt) > total) return "hardcore";
  if (100 * cnt >= 99 * total) return "pro";
  throw;
}
int main() {
  cin >> n;
  for (int i = 0; i < int(n); i++) {
    string name;
    int val;
    cin >> name >> val;
    score[name] = max(score[name], val);
  }
  vector<pair<string, int> > men;
  for (map<string, int>::iterator it = score.begin(); it != score.end(); it++)
    men.push_back(make_pair((it->first), (it->second)));
  cout << int((men).size()) << endl;
  for (int i = 0; i < int(int((men).size())); i++) {
    int cnt = 0;
    for (int j = 0; j < int(int((men).size())); j++)
      if (men[i].second >= men[j].second) cnt++;
    printf("%s ", men[i].first.c_str());
    puts(verdict(cnt, int((men).size())).c_str());
  }
  return 0;
}
