#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int main() {
  int n;
  while (cin >> n) {
    string name;
    int pt;
    map<string, int> mp;
    for (int i = 0; i < n; i++) {
      cin >> name >> pt;
      mp[name] = max(mp[name], pt);
    }
    vector<int> v;
    for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
      v.push_back(it->second);
    }
    int m = mp.size();
    cout << m << endl;
    for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
      int cnt = 0;
      for (int i = 0; i < v.size(); i++) {
        if (v[i] > it->second) cnt++;
      }
      double f = 1.0 * cnt / m;
      if (f > 0.5) {
        cout << it->first << " "
             << "noob" << endl;
      } else if (f > 0.2) {
        cout << it->first << " "
             << "random" << endl;
      } else if (f > 0.1) {
        cout << it->first << " "
             << "average" << endl;
      } else if (f > 0.01) {
        cout << it->first << " "
             << "hardcore" << endl;
      } else {
        cout << it->first << " "
             << "pro" << endl;
      }
    }
  }
  return 0;
}
