#include <bits/stdc++.h>
using namespace std;
struct person {
  string s;
  int v;
};
bool cmp1(person a, person b) {
  if (a.s < b.s) return true;
  if (b.s < a.s) return false;
  return a.v > b.v;
}
bool cmp2(person a, person b) { return a.v < b.v; }
int main() {
  int n;
  cin >> n;
  vector<person> persons(n);
  for (int i = 0; i < n; i++) cin >> persons[i].s >> persons[i].v;
  sort(persons.begin(), persons.end(), cmp1);
  vector<person> finals;
  string na = "";
  for (int i = 0; i < n; i++) {
    if (na == persons[i].s) continue;
    finals.push_back(persons[i]);
    na = persons[i].s;
  }
  sort(finals.begin(), finals.end(), cmp2);
  int m = finals.size();
  cout << m << endl;
  for (int i = 0; i < m; i++) {
    int nw = 0, be = 0;
    for (int j = 0; j < m; j++) {
      if (finals[j].v <= finals[i].v) nw++;
      if (finals[j].v > finals[i].v) be++;
    }
    cout << finals[i].s << " ";
    if (be / (double)m > 0.5 + 1e-5)
      cout << "noob" << endl;
    else if (be / (double)m > 0.2 + 1e-5 && nw / (double)m >= 0.5 - 1e-5)
      cout << "random" << endl;
    else if (be / (double)m > 0.1 + 1e-5 && nw / (double)m >= 0.8 - 1e-5)
      cout << "average" << endl;
    else if (be / (double)m > 0.01 + 1e-5 && nw / (double)m >= 0.9 - 1e-5)
      cout << "hardcore" << endl;
    else
      cout << "pro" << endl;
  }
  return 0;
}
