#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  int n, p;
  cin >> n;
  string s;
  map<string, int> points;
  for (int i = 0; i < n; i++) {
    cin >> s >> p;
    points[s] = max(points[s], p);
  }
  int c;
  double perc;
  int res = points.size();
  cout << res << '\n';
  for (auto v1 : points) {
    c = 0;
    for (auto v2 : points) {
      if (v2.second <= v1.second) c++;
    }
    cout << v1.first << " ";
    if (100 * c >= 99 * res)
      cout << "pro" << '\n';
    else if (100 * c >= 90 * res)
      cout << "hardcore" << '\n';
    else if (100 * c >= 80 * res)
      cout << "average" << '\n';
    else if (100 * c >= 50 * res)
      cout << "random" << '\n';
    else
      cout << "noob" << '\n';
  }
}
