#include <bits/stdc++.h>
using namespace std;
map<string, int> m;
char s[20];
int n, p;
vector<int> q;
string cat(int b, int w) {
  if (2 * b > n) return "noob";
  if (5 * b > n) return "random";
  if (10 * b > n) return "average";
  if (100 * b > n) return "hardcore";
  return "pro";
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); i++) {
    scanf("%s%d", s, &p);
    m[s] = max(m[s], p);
  }
  for (map<string, int>::iterator i = m.begin(); i != m.end(); i++)
    q.push_back(i->second);
  n = q.size();
  printf("%d\n", n);
  for (map<string, int>::iterator i = m.begin(); i != m.end(); i++) {
    p = i->second;
    int l = 0, x = 0;
    for (int j = 0; j < (q.size()); j++)
      if (q[j] > p)
        l++;
      else
        x++;
    printf("%s %s\n", i->first.c_str(), (cat(l, x)).c_str());
  }
}
