#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
using namespace std;
double EPS = 1e-7;
map<string, int> m;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    int x;
    cin >> s >> x;
    m[s] = max(m[s], x);
  }
  n = m.size();
  cout << n << endl;
  for (map<string, int>::iterator i = m.begin(); i != m.end(); i++) {
    int cnt1 = 0, cnt2 = 0;
    for (map<string, int>::iterator j = m.begin(); j != m.end(); j++) {
      if (j->second > i->second) cnt1++;
      if (j->second == i->second) cnt2++;
    }
    int cnt = cnt1;
    cout << i->first << ' ';
    cnt *= 100;
    if (n * 50 < cnt)
      cout << "noob" << endl;
    else if (n * 20 < cnt)
      cout << "random" << endl;
    else if (n * 10 < cnt)
      cout << "average" << endl;
    else if (n * 1 < cnt)
      cout << "hardcore" << endl;
    else
      cout << "pro" << endl;
  }
}
