#include <bits/stdc++.h>
using namespace std;
vector<pair<int, string> > p;
map<string, int> pScore;
map<string, string> pRank;
string str;
int i, j, n, score;
ifstream fin("b.in");
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    str = "";
    getline(cin, str, ' ');
    cin >> score;
    if (pScore[str] < score) pScore[str] = score;
  }
  map<string, int>::iterator it;
  for (it = pScore.begin(); it != pScore.end(); it++) {
    p.push_back(make_pair(it->second, it->first));
  }
  sort(p.begin(), p.end());
  n = p.size();
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++)
      if (p[i].first < p[j].first) break;
    if ((n - j) * 2 > n)
      pRank[p[i].second] = "noob";
    else if (j * 2 >= n && (n - j) * 5 > n)
      pRank[p[i].second] = "random";
    else if (j * 100 >= 80 * n && (n - j) * 10 > n) {
      pRank[p[i].second] = "average";
    } else if (j * 100 >= 90 * n && (n - j) * 100 > n) {
      pRank[p[i].second] = "hardcore";
    } else if (j * 100 >= 99 * n) {
      pRank[p[i].second] = "pro";
    }
  }
  cout << pRank.size();
  map<string, string>::iterator it2;
  for (it2 = pRank.begin(); it2 != pRank.end(); it2++) {
    cout << it2->first << ' ' << it2->second;
  }
  return 0;
}
