#include <bits/stdc++.h>
using namespace std;
int n, x, cnt;
string s;
map<string, int> mp;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  while (n--) cin >> s >> x, mp[s] = max(mp[s], x);
  n = mp.size();
  cout << n << endl;
  for (auto i : mp) {
    cnt = 0;
    for (auto j : mp) cnt += (i.second < j.second);
    cout << i.first << " ";
    if (2 * cnt > n)
      cout << "noob\n";
    else if (5 * cnt > n)
      cout << "random\n";
    else if (10 * cnt > n)
      cout << "average\n";
    else if (100 * cnt > n)
      cout << "hardcore\n";
    else
      cout << "pro\n";
  }
  return 0;
}
