#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
const int N = (int)2e5 + 4;
const int NN = (int)1e7 + 3;
const long double eps = 1e-12;
const int M = 1501;
const long long inf = (long long)1e9 + 7;
const long double pi = acos(-1.0);
const long long P = 29;
const long long Q = 31;
map<string, int> m;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    string s;
    int a;
    cin >> s >> a;
    m[s] = max(m[s], a);
  }
  vector<pair<string, int> > a;
  for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it)
    a.push_back(*it);
  n = (int)a.size();
  cout << n << '\n';
  for (int i = 0; i < n; ++i) {
    int x = 0;
    for (int j = 0; j < n; ++j)
      if (a[j].second > a[i].second) ++x;
    if (10 * x > 5 * n) {
      cout << a[i].first << " noob\n";
      continue;
    }
    if (10 * x > 2 * n) {
      cout << a[i].first << " random\n";
      continue;
    }
    if (10 * x > n) {
      cout << a[i].first << " average\n";
      continue;
    }
    if (100 * x > n) {
      cout << a[i].first << " hardcore\n";
      continue;
    }
    cout << a[i].first << " pro\n";
  }
  return 0;
}
