#include <bits/stdc++.h>
using namespace std;
long long fix(long long cur) {
  return ((cur % 1000000007) + 1000000007) % 1000000007;
}
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  string str;
  int val;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> str >> val;
    mp[str] = max(mp[str], val);
  }
  map<string, int>::iterator itr;
  vector<pair<int, string>> v;
  for (itr = mp.begin(); itr != mp.end(); itr++)
    v.push_back(make_pair(itr->second, itr->first));
  sort(v.rbegin(), v.rend());
  int greater = 0, perv = -1;
  cout << v.size() << endl;
  double percentage;
  for (int i = 0; i < v.size(); i++) {
    if (perv > v[i].first) greater = i;
    percentage = (double)(1.0 - (greater / (double)v.size()));
    perv = v[i].first;
    if (percentage < 0.5)
      cout << v[i].second << " noob" << endl;
    else if (percentage >= 0.5 && percentage < 0.8)
      cout << v[i].second << " random" << endl;
    else if (percentage >= 0.8 && percentage < 0.9)
      cout << v[i].second << " average" << endl;
    else if (percentage >= 0.9 && percentage < 0.99)
      cout << v[i].second << " hardcore" << endl;
    else
      cout << v[i].second << " pro" << endl;
  }
  return 0;
}
