#include <bits/stdc++.h>
using namespace std;
inline int signum(double x) { return (abs(x) < 1.0e-10 ? 0 : x > 0 ? 1 : -1); }
const int SIZE = 100;
string che(int win, int sum) {
  double s = (double)win / (double)sum * 100.0;
  if (s < 50)
    return "noob";
  else if (s < 80)
    return "random";
  else if (s < 90)
    return "average";
  else if (s < 99)
    return "hardcore";
  else
    return "pro";
}
int main() {
  int n;
  while (cin >> n) {
    map<string, int> point;
    string name;
    set<string> check;
    for (int i = 0; i < n; i++) {
      int p;
      cin >> name >> p;
      point[name] = max(point[name], p);
      check.insert(name);
    }
    int s = check.size();
    vector<pair<string, int> > p;
    for (__typeof((check).begin()) it = (check).begin(); it != (check).end();
         ++it) {
      p.push_back(make_pair(*it, point[*it]));
    }
    cout << s << endl;
    for (int i = 0; i < s; i++) {
      int w = 0;
      for (int j = 0; j < s; j++)
        if (p[i].second >= p[j].second) w++;
      cout << p[i].first << " " << che(w, s) << endl;
    }
  }
  return 0;
}
