#include <bits/stdc++.h>
using namespace std;
int a[2000];
map<string, int> s;
int main() {
  int n;
  cin >> n;
  int m = 0;
  for (int i = 0; i < n; i++) {
    string name;
    cin >> name;
    int t;
    cin >> t;
    if (s.count(name) == 0) {
      s[name] = t;
    } else if (s[name] < t)
      s[name] = t;
  }
  map<string, int>::iterator l;
  for (l = s.begin(); l != s.end(); l++) a[m++] = l->second;
  sort(a, a + m);
  int rd, av, ha, pr;
  if (m % 2 == 0)
    rd = a[m / 2 - 1];
  else
    rd = a[m / 2];
  if (m * 80 % 100 == 0)
    av = a[m * 80 / 100 - 1];
  else
    av = a[m * 80 / 100];
  if (m * 90 % 100 == 0)
    ha = a[m * 90 / 100 - 1];
  else
    ha = a[m * 90 / 100];
  if (m * 99 % 100 == 0)
    pr = a[m * 99 / 100 - 1];
  else
    pr = a[m * 99 / 100];
  cout << m << endl;
  for (l = s.begin(); l != s.end(); l++) {
    cout << l->first << ' ';
    if (pr <= l->second)
      cout << "pro" << endl;
    else if (ha <= l->second)
      cout << "hardcore" << endl;
    else if (av <= l->second)
      cout << "average" << endl;
    else if (rd <= l->second)
      cout << "random" << endl;
    else
      cout << "noob" << endl;
  }
  m++;
  m--;
}
