#include <bits/stdc++.h>
using namespace std;
map<string, int> m;
map<string, int>::iterator it;
vector<int> v;
int main(int argc, char** argv) {
  int n;
  char a[30];
  int s;
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; ++i) {
    scanf("%s %d", a, &s);
    it = m.find(a);
    if (it != m.end()) {
      if (s > it->second) {
        it->second = s;
      }
    } else {
      m.insert(pair<string, int>(a, s));
    }
  }
  for (it = m.begin(); it != m.end(); it++) {
    v.push_back(it->second);
  }
  sort(v.begin(), v.end());
  int len = v.size();
  printf("%d\n", len);
  for (it = m.begin(); it != m.end(); it++) {
    int pos = upper_bound(v.begin(), v.end(), it->second) - v.begin();
    double k = pos * 1.0 / len;
    cout << it->first;
    if (k < 0.5) {
      cout << " noob" << endl;
    } else if (k < 0.8) {
      cout << " random" << endl;
    } else if (k < 0.9) {
      cout << " average" << endl;
    } else if (k < 0.99) {
      cout << " hardcore" << endl;
    } else {
      cout << " pro" << endl;
    }
  }
  return 0;
}
