#include <bits/stdc++.h>
using namespace std;
map<string, int> score;
int M;
enum { NOOB = 0, RAND, AVG, HARD, PRO };
void solve() {
  int S[1001], less[1001], more[1001];
  int res[1001];
  memset(&S, 0, 1001 * sizeof(int));
  memset(&less, 0, 1001 * sizeof(int));
  memset(&more, 0, 1001 * sizeof(int));
  for (map<string, int>::iterator it = score.begin(); it != score.end(); it++) {
    S[it->second] += 100;
  }
  int total = M * 100;
  less[0] = 0;
  for (int i = 1; i < 1001; i++) {
    less[i] = less[i - 1] + S[i - 1];
  }
  more[1000] = 0;
  for (int i = 999; i >= 0; i--) {
    more[i] = more[i + 1] + S[i + 1];
  }
  for (int i = 1000; i >= 0; i--) {
    if (less[i] + S[i] >= 99 * M) {
      res[i] = PRO;
    } else if (less[i] + S[i] >= 90 * M && more[i] > M) {
      res[i] = HARD;
    } else if (less[i] + S[i] >= 80 * M && more[i] > 10 * M) {
      res[i] = AVG;
    } else if (less[i] + S[i] >= 50 * M && more[i] > 20 * M) {
      res[i] = RAND;
    } else {
      res[i] = NOOB;
    }
  }
  for (map<string, int>::iterator it = score.begin(); it != score.end(); it++) {
    int s = it->second;
    if (res[s] == NOOB) {
      cout << it->first << " "
           << "noob" << endl;
    } else if (res[s] == RAND) {
      cout << it->first << " "
           << "random" << endl;
    } else if (res[s] == AVG) {
      cout << it->first << " "
           << "average" << endl;
    } else if (res[s] == HARD) {
      cout << it->first << " "
           << "hardcore" << endl;
    } else if (res[s] == PRO) {
      cout << it->first << " "
           << "pro" << endl;
    }
  }
}
int main() {
  int N;
  cin >> N;
  string s;
  int x;
  for (int i = 0; i < N; i++) {
    cin >> s >> x;
    if (score.find(s) == score.end()) {
      score[s] = x;
    } else {
      score[s] = max(score[s], x);
    }
  }
  M = score.size();
  cout << M << "\n";
  solve();
  return 0;
}
