#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e3 + 9;
int n, m, x, u[MAX];
string s;
map<string, int> pt;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s >> x, pt[s] = max(pt[s], x);
  for (auto& c : pt) u[m++] = c.second;
  sort(u, u + m);
  cout << n << '\n';
  for (auto& c : pt) {
    cout << c.first << ' ';
    x = u + m - upper_bound(u, u + m, c.second);
    if (2 * x > m)
      cout << "noob\n";
    else if (5 * x > m)
      cout << "random\n";
    else if (10 * x > m)
      cout << "average\n";
    else if (100 * x > m)
      cout << "hardcore\n";
    else
      cout << "pro\n";
  }
}
