#include <bits/stdc++.h>
using namespace std;
map<string, int> mymap;
int m, p[1050];
char output[10][20] = {"pro", "hardcore", "average", "random", "noob"};
int cal(int pos) {
  pos *= 100;
  if (pos <= m)
    return 0;
  else if (pos <= m * 10)
    return 1;
  else if (pos <= m * 20)
    return 2;
  else if (pos <= m * 50)
    return 3;
  else
    return 4;
}
int main() {
  int n, second;
  string name;
  while (cin >> n) {
    mymap.clear();
    while (n--) {
      cin >> name >> second;
      if (mymap.find(name) == mymap.end() || mymap[name] < second)
        mymap[name] = second;
    }
    m = 0;
    for (map<string, int>::iterator it = mymap.begin(); it != mymap.end(); it++)
      p[m++] = (*it).second;
    sort(p, p + m);
    p[m] = p[m - 1] + 1;
    cout << m << endl;
    for (map<string, int>::iterator it = mymap.begin(); it != mymap.end();
         it++) {
      name = (*it).first;
      second = (*it).second;
      second = m - (upper_bound(p, p + m + 1, second) - p);
      cout << name + " " + output[cal(second)] << endl;
    }
    cout << endl;
    ;
  }
}
