#include <bits/stdc++.h>
using namespace std;
int t[] = {99, 90, 80, 50, 0};
string sk[] = {"pro", "hardcore", "average", "random", "noob"};
string skill(int x, int n) {
  int i;
  for (i = 0; i < 5; ++i)
    if (x * 100 >= n * t[i]) return sk[i];
  while (1) {
  }
}
map<string, int> pts;
int main() {
  int n;
  cin >> n;
  int i;
  string name;
  int p;
  for (i = 0; i < n; ++i) {
    cin >> name >> p;
    pts[name] = max(pts[name], p);
  }
  vector<pair<int, string> > v(pts.size());
  i = 0;
  for (map<string, int>::iterator it = pts.begin(); it != pts.end(); ++it) {
    v[i].first = it->second;
    v[i].second = it->first;
    ++i;
  }
  sort(v.begin(), v.end());
  n = v.size();
  int j;
  cout << n << endl;
  for (i = 0; i < n; ++i) {
    for (j = i + 1; j < n && v[j].first == v[i].first; ++j)
      ;
    cout << v[i].second << ' ' << skill(j, n) << endl;
    ;
  }
  return 0;
}
