#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s;
    int a;
    cin >> s >> a;
    mp[s] = max(mp[s], a);
  }
  vector<pair<int, string>> vec;
  for (auto p : mp) vec.push_back(make_pair(p.second, p.first));
  sort((vec).begin(), (vec).end());
  cout << ((int)(vec).size()) << endl;
  for (int i = 0, j = 0; i < ((int)(vec).size()); i++) {
    while (j < ((int)(vec).size()) && vec[i].first == vec[j].first) j++;
    if (j * 100 < 50 * ((int)(vec).size()))
      cout << vec[i].second << " noob\n";
    else if (j * 100 < 80 * ((int)(vec).size()))
      cout << vec[i].second << " random\n";
    else if (j * 100 < 90 * ((int)(vec).size()))
      cout << vec[i].second << " average\n";
    else if (j * 100 < 99 * ((int)(vec).size()))
      cout << vec[i].second << " hardcore\n";
    else
      cout << vec[i].second << " pro\n";
  }
  return 0;
}
