#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string x;
  map<string, int> s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> k;
    if (s[x] < k) s[x] = k;
  }
  int sz = (int)s.size();
  cout << sz << "\n";
  for (map<string, int>::iterator i = s.begin(); i != s.end(); i++) {
    int b = 0, r = 0, b_libo_r, m_libo_r, m;
    for (map<string, int>::iterator j = s.begin(); j != s.end(); j++)
      if (j->second > i->second)
        b++;
      else if (j->second == i->second)
        r++;
    b_libo_r = b + r;
    m = sz - b_libo_r;
    m_libo_r = m + r;
    cout << i->first << " ";
    if (100 * m_libo_r >= 99 * sz)
      cout << "pro";
    else if (100 * m_libo_r >= 90 * sz && 100 * b > sz)
      cout << "hardcore";
    else if (100 * m_libo_r >= 80 * sz && 100 * b > 10 * sz)
      cout << "average";
    else if (100 * m_libo_r >= 50 * sz && 100 * b > 20 * sz)
      cout << "random";
    else
      cout << "noob";
    cout << "\n";
  }
  return 0;
}
