#include <bits/stdc++.h>
using namespace std;
map<string, int> adj;
int n, a;
string s, ss[3000];
int b[2000];
int main() {
  cin >> n;
  int nn = 0;
  for (int i = 0; i < n; i++) {
    cin >> s >> a;
    if (adj.find(s) == adj.end()) {
      adj[s] = nn++;
      b[nn - 1] = a;
      ss[nn - 1] = s;
    } else {
      int tmp = adj[s];
      b[tmp] = max(b[tmp], a);
    }
  }
  cout << nn << endl;
  int m = nn;
  for (int i = 0; i < nn; i++) {
    int sum1 = 0, sum2 = 0;
    for (int j = 0; j < nn; j++) {
      if (b[j] <= b[i]) sum1++;
      if (b[j] > b[i]) sum2++;
    }
    if (sum2 * 10 > m * 5)
      cout << ss[i] << " "
           << "noob" << endl;
    else if (sum2 * 10 > m * 2 && sum1 * 10 >= m * 5)
      cout << ss[i] << " "
           << "random" << endl;
    else if (sum2 * 10 > m && sum1 * 10 >= m * 8)
      cout << ss[i] << " "
           << "average" << endl;
    else if (sum2 * 100 > m && sum1 * 10 >= m * 9)
      cout << ss[i] << " "
           << "hardcore" << endl;
    else
      cout << ss[i] << " "
           << "pro" << endl;
  }
  return 0;
}
