#include <bits/stdc++.h>
using namespace std;
bool EQ(double a, double b) { return abs(a - b) < (1e-10); }
int n;
map<string, int> scs;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string nm;
    int sc;
    cin >> nm >> sc;
    scs[nm];
    scs[nm] = max(scs[nm], sc);
  }
  if (scs.size() == 1) {
    cout << scs.size() << endl;
    cout << (scs.begin())->first << " pro" << endl;
    return 0;
  }
  cout << scs.size() << endl;
  for (map<string, int>::iterator it = scs.begin(); it != scs.end(); it++) {
    double wper = 0;
    double bper = 0;
    for (map<string, int>::iterator iit = scs.begin(); iit != scs.end();
         iit++) {
      if (iit->second <= it->second) wper += 1;
      if (iit->second > it->second) bper += 1;
    }
    wper /= (scs.size());
    wper *= 100;
    bper /= (scs.size());
    bper *= 100;
    cout << it->first << " ";
    if (!EQ(bper, 50) && bper > 50)
      cout << "noob";
    else if ((EQ(wper, 50) || wper > 50) && (!EQ(bper, 20) && bper > 20))
      cout << "random";
    else if ((EQ(wper, 80) || wper > 80) && (!EQ(bper, 10) && bper > 10))
      cout << "average";
    else if ((EQ(wper, 90) || wper > 90) && (!EQ(bper, 1) && bper > 1))
      cout << "hardcore";
    else if (EQ(wper, 99) || wper > 99)
      cout << "pro";
    cout << endl;
  }
  return 0;
}
