#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<pair<string, int>> a;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string first;
    int second;
    cin >> first >> second;
    if (mp.count(first)) {
      a[mp[first]].second = max(a[mp[first]].second, second);
    } else {
      mp[first] = (int)a.size();
      a.push_back(make_pair(first, second));
    }
  }
  n = (int)a.size();
  cout << n << '\n';
  for (int i = 0; i < n; i++) {
    int lose = 0;
    for (int j = 0; j < n; j++) {
      if (a[j].second <= a[i].second) {
        lose++;
      }
    }
    string ans;
    if (lose * 100 >= n * 99) {
      ans = "pro";
    } else if (lose * 100 >= n * 90) {
      ans = "hardcore";
    } else if (lose * 100 >= n * 80) {
      ans = "average";
    } else if (lose * 100 >= n * 50) {
      ans = "random";
    } else {
      ans = "noob";
    };
    cout << a[i].first << ' ' << ans << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
