#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int N, M(0);
struct player {
  string s;
  int sco;
} pla[maxn], te[maxn];
inline bool cmp(const player &i, const player &j) {
  if (i.s == j.s) return (i.sco > j.sco);
  return (i.s < j.s);
}
inline bool cmp1(const player &i, const player &j) { return i.sco < j.sco; }
inline string calc(int v) {
  if (v >= M * 0.99 - 1e-10)
    return "pro";
  else if (v >= M * 0.9 - 1e-10)
    return "hardcore";
  else if (v >= M * 0.8 - 1e-10)
    return "average";
  else if (v >= M * 0.5 - 1e-10)
    return "random";
  return "noob";
}
int main() {
  scanf("%d%*c", &N);
  for (int i = 1; i <= N; ++i) {
    cin >> te[i].s >> te[i].sco;
    cerr << te[i].s << ' ' << te[i].sco << endl;
  }
  cerr << 1 << endl;
  sort(te + 1, te + N + 1, cmp);
  cerr << 2 << endl;
  int i(1);
  while (i <= N) {
    pla[++M] = te[i];
    while ((i <= N) && (te[i].s == pla[M].s)) ++i;
  }
  cerr << 3 << endl;
  cout << M << endl;
  sort(pla + 1, pla + M + 1, cmp1);
  i = 1;
  while (i <= M) {
    int j = i;
    while ((j < M) && (pla[j + 1].sco == pla[i].sco)) ++j;
    string t = calc(j);
    for (int k = i; k <= j; ++k) cout << pla[k].s << ' ' << t << endl;
    i = j + 1;
  }
  cerr << 4 << endl;
}
