#include <bits/stdc++.h>
using namespace std;
int inline ABS(int a) {
  if (a > 0)
    return a;
  else
    return -a;
}
int GCD(int a, int b) {
  if (!a) return b;
  return GCD(b % a, a);
}
map<string, int> M;
map<string, string> A;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string a;
    cin >> a;
    int b;
    cin >> b;
    M[a] = max(M[a], b);
  }
  n = M.size();
  for (typeof(M.begin()) ii = M.begin(); ii != M.end(); ii++) {
    int w = 0, m = 0;
    for (typeof(M.begin()) ij = M.begin(); ij != M.end(); ij++) {
      if (ii->second < ij->second) w++;
      if (ii->second > ij->second) m++;
    }
    int nw = n - w;
    double worse = (double)w / (double)n * 100.0;
    double nworse = (double)(n - w) / (double)n * 100.0;
    double more = (double)m / (double)n * 100.0;
    if (worse > 50.0) {
      A[ii->first] = "noob";
    } else if (!(worse > 50.0) && worse > 20.0) {
      A[ii->first] = "random";
    } else if (!(worse > 80.0) && worse > 10.0) {
      A[ii->first] = "average";
    } else if (!(worse > 90.0) && worse > 1.0) {
      A[ii->first] = "hardcore";
    } else if (!(worse > 99.0)) {
      A[ii->first] = "pro";
    }
  }
  cout << A.size() << "\n";
  for (typeof(A.begin()) ii = A.begin(); ii != A.end(); ii++) {
    cout << ii->first << " " << ii->second << "\n";
  }
  return 0;
}
