#include <bits/stdc++.h>
using namespace std;
inline void wait(double seconds) {
  double endtime = clock() + (seconds * CLOCKS_PER_SEC);
  while (clock() < endtime) {
    ;
  }
}
inline int fastIn() {
  register char c = 0;
  register int a = 0;
  while (c < 33) c = getchar();
  while (c > 33) {
    a = (a * 10) + (c - '0');
    c = getchar();
  }
  return a;
}
int people_count;
int point;
char name[15];
map<string, int> points;
inline void read() {
  people_count = fastIn();
  for (int i = 0, j1 = people_count; i < j1; ++i) {
    scanf(" %s %d", name, &point);
    points[name] = max(points[name], point);
  }
}
map<string, string> res;
const double eps = 1e-9;
inline void proc() {
  people_count = (int)(points).size();
  for (typeof((points).begin()) it = (points).begin(); it != (points).end();
       it++) {
    int how_many = 0;
    for (typeof((points).begin()) iit = (points).begin(); iit != (points).end();
         iit++) {
      if (it->first != iit->first && iit->second > it->second) {
        ++how_many;
      }
    }
    double percentage =
        (((double)100.0) * (how_many) + eps) / ((double)people_count);
    if (percentage - 50.0 > eps) {
      res[it->first] = "noob";
    } else {
      if (percentage - 20.0 > eps) {
        res[it->first] = "random";
      } else {
        if (percentage - 10.0 > eps) {
          res[it->first] = "average";
        } else {
          if (percentage - 1.0 > eps) {
            res[it->first] = "hardcore";
          } else {
            res[it->first] = "pro";
          }
        }
      }
    }
  }
  cout << (int)(res).size() << '\n';
  for (typeof((res).begin()) it = (res).begin(); it != (res).end(); it++) {
    cout << it->first << ' ' << it->second << '\n';
  }
}
int main() {
  int kase = 1;
  for (int i = 0, j1 = kase; i < j1; ++i) {
    read();
    proc();
  }
  return 0;
}
