#include <bits/stdc++.h>
using namespace std;
int f[1000];
void qs(int q, int w) {
  int e = q, r = w, t = f[q + (rand() % (w - q + 1))], y;
  do {
    while (f[e] < t) e++;
    while (f[r] > t) r--;
    if (e <= r) {
      y = f[e];
      f[e] = f[r];
      f[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs(q, r);
  if (e < w) qs(e, w);
}
int main() {
  int q, w, e, r, t = 0, c, s[1000];
  char a[1000][11];
  char d[11];
  cin >> q;
  bool x;
  for (w = 0; w < 1000; w++) s[w] = 0;
  for (w = 0; w < q; w++) {
    cin >> d;
    r = strlen(d);
    for (e = 0; e < t; e++) {
      x = 1;
      for (c = 0; c <= r; c++)
        if (a[e][c] != d[c]) {
          x = 0;
          break;
        }
      if (x) break;
    }
    if (e == t) {
      for (c = 0; c <= r; c++) a[t][c] = d[c];
      t++;
    }
    cin >> r;
    if (s[e] < r) s[e] = r;
  }
  for (w = 0; w < t; w++) f[w] = s[w];
  qs(0, t - 1);
  cout << t << "\n";
  for (w = 0; w < t; w++) {
    cout << a[w] << ' ';
    e = 512;
    r = 0;
    while (e) {
      if (r + e < t)
        if (f[e + r] <= s[w]) r += e;
      e /= 2;
    }
    e = ((r + 1) * 100) / t;
    if (e < 50)
      cout << "noob\n";
    else if (e < 80)
      cout << "random\n";
    else if (e < 90)
      cout << "average\n";
    else if (e < 99)
      cout << "hardcore\n";
    else
      cout << "pro\n";
  }
  return 0;
}
