#include <bits/stdc++.h>
using namespace std;
template <class T>
int len(const T& c) {
  return (int)c.size();
}
int n;
map<string, int> M;
string nm;
int sc;
int main() {
  double d;
  vector<pair<int, string> > v;
  cin >> n;
  for (int i(0), _n(n); i < _n; ++i) {
    cin >> nm >> sc;
    M[nm] = max(M[nm], sc);
  }
  v.push_back(make_pair(-1, "dummy"));
  for (__typeof((M).begin()) i = (M).begin(); i != (M).end(); ++i) {
    v.push_back(make_pair((*i).second, (*i).first));
  }
  sort(v.begin(), v.end());
  n = len(v) - 1;
  cout << n << endl;
  for (int i(1), _b(len(v)); i < _b; ++i) {
    sc = i;
    while ((sc + 1) < len(v) && v[sc].first == v[sc + 1].first) sc++;
    d = 1.0 * sc / n;
    d += 1e-7;
    if (d < .5) {
      cout << v[i].second << " "
           << "noob" << endl;
    } else if (d > .99) {
      cout << v[i].second << " "
           << "pro" << endl;
    } else if (d > .9) {
      cout << v[i].second << " "
           << "hardcore" << endl;
    } else if (d > .8) {
      cout << v[i].second << " "
           << "average" << endl;
    } else {
      cout << v[i].second << " "
           << "random" << endl;
    }
  }
}
