#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> i, pair<int, int> j) { return i.first > j.first; }
int main() {
  int n, i;
  pair<int, int> x[1001];
  vector<string> a;
  for (cin >> n, i = 0; i < n; i++) {
    string t;
    cin >> t;
    vector<string>::iterator it = find(a.begin(), a.end(), t);
    if (it == a.end()) {
      a.push_back(t);
      it = a.end() - 1;
      x[it - a.begin()].first = 0;
    }
    int k;
    cin >> k;
    x[it - a.begin()].first =
        k > x[it - a.begin()].first ? k : x[it - a.begin()].first;
    x[it - a.begin()].second = it - a.begin();
  }
  sort(x, x + a.size(), cmp);
  cout << a.size();
  string ans = "";
  for (i = 0; i < a.size(); i++) {
    if (i == 0 || x[i].first != x[i - 1].first) {
      int res = (a.size() - i) * 100;
      res /= a.size();
      if (res >= 99)
        ans = "pro";
      else if (res >= 90)
        ans = "hardcore";
      else if (res >= 80)
        ans = "average";
      else if (res >= 50)
        ans = "random";
      else
        ans = "noob";
    }
    cout << endl << a[x[i].second] << ' ' << ans;
  }
  return 0;
}
