#include <bits/stdc++.h>
using namespace std;
int totalCases, testNum;
int n;
map<string, int> best;
void preprocess() {}
bool input() {
  cin >> n;
  string x;
  int y;
  for (int i = 0; i < n; i++) {
    cin >> x;
    cin >> y;
    best[x] = max(best[x], y);
  }
  return true;
}
void solve() {
  int p = best.size();
  map<string, int> scores;
  for (map<string, int>::iterator it = best.begin(); it != best.end(); it++) {
    pair<string, int> cur = (*it);
    int tot = 0;
    for (map<string, int>::iterator it1 = best.begin(); it1 != best.end();
         it1++) {
      tot += (*it1).second <= cur.second;
    }
    scores[cur.first] = tot;
  }
  cout << p << endl;
  for (map<string, int>::iterator it = scores.begin(); it != scores.end();
       it++) {
    pair<string, int> cur = *it;
    if (cur.second * 100 < 50 * p) {
      cout << cur.first << " noob\n";
    } else if (cur.second * 100 < 80 * p)
      cout << cur.first << " random\n";
    else if (cur.second * 100 < 90 * p)
      cout << cur.first << " average\n";
    else if (cur.second * 100 < 99 * p)
      cout << cur.first << " hardcore\n";
    else
      cout << cur.first << " pro\n";
  }
}
int main() {
  preprocess();
  totalCases = 1;
  for (testNum = 1; testNum <= totalCases; testNum++) {
    if (!input()) break;
    solve();
  }
}
