#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
const int N = 2e5 + 5;
vector<int> e[N];
int vis[N];
int pr[N];
map<int, int> prefix;
int a;
long long binpow(long long a, long long b) {
  if (a == 0) return a;
  if (b == 0) return 1;
  if (b == 1) return a % mod;
  long long temp = binpow(a, b / 2) % mod;
  if (b & 1) return (a * temp * temp) % mod;
  return (temp * temp) % mod;
}
void dfs(int i, int p, int h, int n) {
  if (vis[i] == 3 - h) {
    vis[n + 1] = -1;
    return;
  }
  if (vis[i]) return;
  vis[i] = h;
  for (auto j : e[i]) {
    dfs(j, i, 3 - h, n);
  }
  return;
}
long long nck(long long n, long long k) {
  long long g = 1;
  map<long long, long long> m;
  for (long long i = n - k + 1; i <= n; i++) {
    g *= i;
    for (long long j = 2; j <= k; j++) {
      if (m[j] == 0 && g % j == 0) {
        g /= j;
        m[j]++;
      }
    }
  }
  return g;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    int n;
    cin >> n;
    map<string, int> m;
    for (int i = 0; i < n; i++) {
      string s;
      int p;
      cin >> s >> p;
      m[s] = max(m[s], p);
    }
    vector<int> v;
    auto j = m.begin();
    while (j != m.end()) {
      v.push_back(j->second);
      j++;
    }
    sort(v.begin(), v.end());
    map<int, long double> mp;
    map<int, int> p;
    for (int i = v.size() - 1; i >= 0; i--) {
      if (p[v[i]] == 0) {
        long double g = i + 1, h = v.size();
        long double r = (g * 100) / h;
        mp[v[i]] = r;
        p[v[i]]++;
      }
    }
    j = m.begin();
    cout << m.size() << endl;
    while (j != m.end()) {
      if (mp[j->second] < 50)
        cout << j->first << " noob" << endl;
      else if (mp[j->second] < 80)
        cout << j->first << " random" << endl;
      else if (mp[j->second] < 90)
        cout << j->first << " average" << endl;
      else if (mp[j->second] < 99)
        cout << j->first << " hardcore" << endl;
      else
        cout << j->first << " pro" << endl;
      j++;
    }
  }
}
