#include <bits/stdc++.h>
using namespace std;
struct node {
  int point;
  char name[15];
} p1[1005], p2[1005];
int n, m;
char ans[1005][2][15], *d[5] = {"noob", "random", "average", "hardcore", "pro"};
bool cmp1(const node& a, const node& b) {
  if (!strcmp(a.name, b.name)) return a.point > b.point;
  if (strcmp(a.name, b.name) > 0) return 0;
  return 1;
}
bool cmp2(const node& a, const node& b) { return a.point < b.point; }
void init() {
  int i, j;
  for (i = 0; i < n; i++) cin >> p1[i].name >> p1[i].point;
  sort(p1, p1 + n, cmp1);
  m = 1;
  p2[0] = p1[0];
  for (i = 1; i < n; i++)
    if (strcmp(p1[i].name, p1[i - 1].name)) p2[m++] = p1[i];
}
void solve() {
  int i, j, k;
  double wor;
  k = 0;
  for (i = 0; i < m; i++) {
    wor = 0;
    for (j = 0; j < m; j++)
      if (p2[j].point > p2[i].point) wor = wor + 1;
    wor /= m;
    strcpy(ans[++k][0], p2[i].name);
    if (wor > 0.5)
      strcpy(ans[k][1], d[0]);
    else if (wor > 0.2)
      strcpy(ans[k][1], d[1]);
    else if (wor > 0.1)
      strcpy(ans[k][1], d[2]);
    else if (wor > 0.01)
      strcpy(ans[k][1], d[3]);
    else
      strcpy(ans[k][1], d[4]);
  }
  cout << k << endl;
  for (i = 1; i <= k; i++) cout << ans[i][0] << ' ' << ans[i][1] << endl;
}
int main() {
  while (~scanf("%d", &n)) {
    init();
    solve();
  }
  return 0;
}
