#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:25600000")
using namespace std;
int n;
map<string, int> mp;
vector<pair<int, string> > vv;
int ls[1024];
int mr[1024];
int main() {
  int n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    string s;
    int x;
    cin >> s >> x;
    if (mp.find(s) == mp.end()) mp[s] = x;
    mp[s] = max(mp[s], x);
  }
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
    vv.push_back(make_pair(it->second, it->first));
  }
  sort((vv).begin(), (vv).end());
  n = vv.size();
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++)
      if (vv[j].first <= vv[i].first)
        ++ls[i];
      else
        ++mr[i];
  cout << n << endl;
  for (long long i = 0; i < n; i++) {
    cout << vv[i].second << " ";
    if (ls[i] * 100 >= 99 * n) {
      cout << "pro\n";
      continue;
    }
    if (ls[i] * 100 >= 90 * n && mr[i] * 100 > 1 * n) {
      cout << "hardcore\n";
      continue;
    }
    if (ls[i] * 100 >= 80 * n && mr[i] * 100 > 10 * n) {
      cout << "average\n";
      continue;
    }
    if (ls[i] * 100 >= 50 * n && mr[i] * 100 > 20 * n) {
      cout << "random\n";
      continue;
    }
    if (mr[i] * 100 > n * 50) {
      cout << "noob\n";
      continue;
    }
  }
}
