#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
map<string, int> a;
map<string, int>::iterator ii, jj;
string s;
int main() {
  int k, i, v, u, j, n, m, d, d2, y, r, p, t1, t2, x, l, t, z, fl, to;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> s >> p;
    if (a[s] <= p) a[s] = p;
  }
  k = 0;
  for (ii = a.begin(); ii != a.end(); ii++) k++;
  cout << k << endl;
  for (ii = a.begin(); ii != a.end(); ii++) {
    t = 0;
    p = 0;
    for (jj = a.begin(); jj != a.end(); jj++) {
      if ((*ii).second >= (*jj).second) t++;
      if ((*ii).second < (*jj).second) p++;
    }
    if ((double)p / (double)k > 0.5) {
      cout << (*ii).first << " "
           << "noob" << endl;
      continue;
    }
    if ((double)t / (double)k >= 0.5 && (double)p / (double)k > 0.2) {
      cout << (*ii).first << " "
           << "random" << endl;
      continue;
    }
    if ((double)t / (double)k >= 0.8 && (double)p / (double)k > 0.1) {
      cout << (*ii).first << " "
           << "average" << endl;
      continue;
    }
    if ((double)t / (double)k >= 0.9 && (double)p / (double)k > 0.01) {
      cout << (*ii).first << " "
           << "hardcore" << endl;
      continue;
    }
    if ((double)t / (double)k >= 0.99) {
      cout << (*ii).first << " "
           << "pro" << endl;
      continue;
    }
  }
  return 0;
}
