#include <bits/stdc++.h>
using namespace std;
map<string, int> a;
int main() {
  char name[15];
  int n, i, points;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%s%d", name, &points);
    string s(name);
    if (a.count(s) == 0)
      a[s] = points;
    else
      a[s] = max(a[s], points);
  }
  int m = (int)a.size();
  printf("%d\n", m);
  map<string, int>::iterator it, iv;
  for (it = a.begin(); it != a.end(); it++) {
    int cnt = 0;
    for (iv = a.begin(); iv != a.end(); iv++) {
      if (iv->second > it->second) cnt++;
    }
    string ret;
    double p = cnt / (double)m;
    if (p <= 0.01)
      ret = "pro";
    else if (p <= 0.1)
      ret = "hardcore";
    else if (p <= 0.2)
      ret = "average";
    else if (p <= 0.5)
      ret = "random";
    else
      ret = "noob";
    printf("%s %s\n", it->first.c_str(), ret.c_str());
  }
  return 0;
}
