#include <bits/stdc++.h>
using namespace std;
template <typename T>
double DIS(T va, T vb) {
  return sqrt((double)(va.x - vb.x) * (va.x - vb.x) +
              (va.y - vb.y) * (va.y - vb.y));
}
template <class T>
inline T INT_LEN(T v) {
  int len = 1;
  while (v /= 10) ++len;
  return len;
}
typedef struct {
  string s;
  int v;
} re;
re ar[1005];
string tb[1005];
int N, k;
int get_id(re &va) {
  int i;
  for (i = 0; i < k; i++) {
    if (va.s == ar[i].s) return i;
  }
  return -1;
}
void input(int n) {
  re tmp;
  k = 0;
  while (n--) {
    cin >> tmp.s >> tmp.v;
    int id = get_id(tmp);
    if (~id)
      ar[id].v = max(ar[id].v, tmp.v);
    else
      ar[k++] = tmp;
  }
}
bool cmp(re va, re vb) { return va.s < vb.s; }
void solve() {
  int small, equal, big;
  sort(ar, ar + k, cmp);
  printf("%d\n", k);
  for (int i = 0; i < k; i++) {
    small = equal = big = 0LL;
    for (int j = 0; j < k; j++) {
      if (ar[i].v > ar[j].v)
        small++;
      else if (ar[i].v == ar[j].v)
        equal++;
      else
        big++;
    }
    if (big * 2 > small + equal + big)
      cout << ar[i].s << " "
           << "noob" << endl;
    else if (big * 2 <= small + equal + big && big * 5 > small + equal + big)
      cout << ar[i].s << " "
           << "random" << endl;
    else if (big * 5 <= small + equal + big && big * 10 > small + equal + big)
      cout << ar[i].s << " "
           << "average" << endl;
    else if (big * 10 <= small + equal + big && big * 100 > small + equal + big)
      cout << ar[i].s << " "
           << "hardcore" << endl;
    else
      cout << ar[i].s << " "
           << "pro" << endl;
  }
}
int main(void) {
  while (~scanf("%d", &N)) {
    input(N);
    solve();
  }
  return 0;
}
