#include <bits/stdc++.h>
using namespace std;
map<string, int> mapa;
struct no {
  char s[20];
  int p, menor, igual, maior, rank;
};
no v[1024];
void imprimi(int x) {
  if (x == 0) printf("noob\n");
  if (x == 1) printf("random\n");
  if (x == 2) printf("average\n");
  if (x == 3) printf("hardcore\n");
  if (x == 4) printf("pro\n");
}
int main() {
  mapa.clear();
  int n;
  scanf("%d", &n);
  int cnt = 0;
  char s[20];
  int p;
  for (int i = 0; i < n; i++) {
    scanf(" %s %d", s, &p);
    if (mapa.find(s) != mapa.end()) {
      v[mapa[s]].p = max(v[mapa[s]].p, p);
    } else {
      mapa[s] = cnt;
      strcpy(v[cnt].s, s);
      v[cnt++].p = p;
    }
  }
  n = cnt;
  printf("%d\n", n);
  for (int i = 0; i < n; i++) v[i].igual = v[i].menor = v[i].maior = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (v[i].p > v[j].p)
        v[i].menor++;
      else if (v[i].p == v[j].p)
        v[i].igual++;
      else
        v[i].maior++;
    }
  double por;
  for (int i = 0; i < n; i++) {
    if ((double)v[i].maior / n > 0.50 + 1e-6)
      v[i].rank = 0;
    else if ((double)v[i].maior / n > 0.20 + 1e-6)
      v[i].rank = 1;
    else if ((double)v[i].maior / n > 0.10 + 1e-6)
      v[i].rank = 2;
    else if ((double)v[i].maior / n > 0.10 + 1e-6)
      v[i].rank = 2;
    else if ((double)v[i].maior / n > 0.01 + 1e-6)
      v[i].rank = 3;
    else
      v[i].rank = 4;
  }
  for (int i = 0; i < n; i++) {
    printf("%s ", v[i].s);
    imprimi(v[i].rank);
  }
  return 0;
}
