#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  map<string, int> score;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string name;
    int sc;
    cin >> name >> sc;
    score[name] = max(sc, score[name]);
  }
  vector<pair<string, int>> v;
  for (auto x : score) {
    v.emplace_back(x.first, x.second);
  }
  if (v.size() == 1) {
    cout << "1\n";
    cout << v[0].first << " "
         << "pro\n";
    return 0;
  }
  vector<pair<string, string>> ans;
  for (int i = 0; i < v.size(); i++) {
    int cnt_greater = 0;
    int cnt_less_eq = 0;
    for (int j = 0; j < v.size(); j++) {
      if (v[j].second > v[i].second) {
        cnt_greater++;
      }
      if (v[i].second >= v[j].second) {
        cnt_less_eq++;
      }
    }
    double percentage_greater = double(cnt_greater) / (v.size()) * 100;
    double percentage_less_eq = double(cnt_less_eq) / (v.size()) * 100;
    if (percentage_greater > 50) {
      ans.emplace_back(v[i].first, "noob");
    } else if (percentage_less_eq >= 50 && percentage_greater > 20) {
      ans.emplace_back(v[i].first, "random");
    } else if (percentage_less_eq >= 80 && percentage_greater > 10) {
      ans.emplace_back(v[i].first, "average");
    } else if (percentage_less_eq >= 90 && percentage_greater > 1) {
      ans.emplace_back(v[i].first, "hardcore");
    } else {
      ans.emplace_back(v[i].first, "pro");
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) {
    cout << x.first << " " << x.second << "\n";
  }
}
