#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
map<string, int> score;
int n;
pair<string, int> a[N];
int main() {
  cin >> n;
  string name;
  int sco, m = 0;
  for (int i = 0; i < n; i++) {
    cin >> name >> sco;
    if (score.count(name) == 0)
      score.insert(make_pair(name, sco)), a[m++] = make_pair(name, sco);
    else
      score[name] = max(score[name], sco);
  }
  for (int i = 0; i < n; i++) a[i].second = max(a[i].second, score[a[i].first]);
  n = m;
  int cnt1, cnt2;
  cout << n << endl;
  for (int i = 0; i < n; i++) {
    cout << a[i].first << " ";
    cnt1 = cnt2 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j].second <= a[i].second) cnt1++;
      if (a[j].second > a[i].second) cnt2++;
    }
    if (cnt1 * 100 >= n * 99)
      cout << "pro";
    else if (cnt1 * 100 >= n * 90 && cnt2 * 100 > n)
      cout << "hardcore";
    else if (cnt1 * 100 >= n * 80 && cnt2 * 100 > n * 10)
      cout << "average";
    else if (cnt1 * 100 >= n * 50 && cnt2 * 100 > n * 20)
      cout << "random";
    else if (cnt2 * 100 > n * 50)
      cout << "noob";
    cout << endl;
  }
  return 0;
}
