#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tot = 0;
  string s;
  int x;
  cin >> n;
  map<string, int> player;
  for (int i = 0; i < n; i++) {
    cin >> s >> x;
    if (player.count(s))
      player[s] = max(player[s], x);
    else
      player[s] = x, tot++;
  }
  n = tot;
  vector<pair<string, int> > v;
  for (map<string, int>::iterator it = player.begin(); it != player.end();
       it++) {
    v.push_back(make_pair(it->first, it->second));
  }
  cout << n << "\n";
  for (int i = 0; i < n; i++) {
    int small = 0, big_eq = 0;
    for (int j = 0; j < n; j++) {
      if (v[i].second >= v[j].second)
        big_eq++;
      else
        small++;
    }
    if (big_eq * 100 >= 99 * n) {
      cout << v[i].first << " pro\n";
    } else if (big_eq * 100 >= 90 * n && small * 100 > 1 * n) {
      cout << v[i].first << " hardcore\n";
    } else if (big_eq * 100 >= 80 * n && small * 100 > 10 * n) {
      cout << v[i].first << " average\n";
    } else if (big_eq * 100 >= 50 * n && small * 100 > 20 * n) {
      cout << v[i].first << " random\n";
    } else if (big_eq * 100 < 50 * n) {
      cout << v[i].first << " noob\n";
    }
  }
}
