#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
long N;
int main(void) {
  long i, j, v;
  string s;
  ios_base::sync_with_stdio(0);
  cin >> N;
  map<string, long> Map;
  for (i = 1; i <= N; i++) {
    cin >> s >> v;
    if (Map.find(s) == Map.end())
      Map[s] = v;
    else
      Map[s] = max(Map[s], v);
  }
  map<string, long>::iterator p = Map.begin();
  vector<string> Name(1);
  vector<long> Pt(1);
  N = 0;
  while (p != Map.end()) {
    Name.push_back(p->first);
    Pt.push_back(p->second);
    p++;
    N++;
  }
  cout << N << endl;
  for (i = 1; i <= N; i++) {
    long Gt = 0, Ls = 0;
    for (j = 1; j <= N; j++) {
      if (Pt[j] > Pt[i]) Gt++;
      if (Pt[j] < Pt[i]) Ls++;
    }
    cout << Name[i] << " ";
    double PerG = (Gt * 100.0) / N;
    double PerL = (Ls * 100.0) / N;
    if (PerG > 50)
      cout << "noob" << endl;
    else if (PerG > 20)
      cout << "random" << endl;
    else if (PerG > 10)
      cout << "average" << endl;
    else if (PerG > 1)
      cout << "hardcore" << endl;
    else
      cout << "pro" << endl;
  }
  return 0;
}
