#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = ((1 << 30) - 1);
const long long LLINF = (((1LL << 60) - 1LL));
const double EPS = 1e-9;
const double PI = 3.14159265358979323846;
bool isNoob(int numLess, int numEqual, int numGreater) {
  int sumAll = numLess + numEqual + numGreater;
  if (2 * numGreater > sumAll) {
    return true;
  } else {
    return false;
  }
}
bool isRandom(int numLess, int numEqual, int numGreater) {
  int sumAll = numLess + numEqual + numGreater;
  if (2 * (numEqual + numLess) >= sumAll && 5 * numGreater > sumAll) {
    return true;
  } else {
    return false;
  }
}
bool isAverage(int numLess, int numEqual, int numGreater) {
  int sumAll = numLess + numEqual + numGreater;
  if (10 * (numEqual + numLess) >= 8 * sumAll && 10 * numGreater > sumAll) {
    return true;
  } else {
    return false;
  }
}
bool isHardcore(int numLess, int numEqual, int numGreater) {
  int sumAll = numLess + numEqual + numGreater;
  if (10 * (numEqual + numLess) >= 9 * sumAll && 100 * numGreater > sumAll) {
    return true;
  } else {
    return false;
  }
}
bool isPro(int numLess, int numEqual, int numGreater) {
  int sumAll = numLess + numEqual + numGreater;
  if (100 * (numEqual + numLess) >= 99 * sumAll) {
    return true;
  } else {
    return false;
  }
}
int main() {
  int n;
  cin >> n;
  map<string, long long> M;
  for (int i = 0; i < n; ++i) {
    string a;
    int x;
    cin >> a >> x;
    M[a] = max(M[a], (long long)x);
  }
  cout << M.size() << endl;
  vector<pair<string, int> > v((M).begin(), (M).end());
  for (int i = 0; i < v.size(); ++i) {
    int numLess = 0, numEqual = 0, numGreater = 0;
    for (int j = 0; j < v.size(); ++j) {
      if (v[j].second == v[i].second) {
        ++numEqual;
      }
      if (v[j].second < v[i].second) {
        ++numLess;
      }
      if (v[j].second > v[i].second) {
        ++numGreater;
      }
    }
    cout << v[i].first;
    if (isNoob(numLess, numEqual, numGreater)) {
      cout << " noob";
    }
    if (isRandom(numLess, numEqual, numGreater)) {
      cout << " random";
    }
    if (isAverage(numLess, numEqual, numGreater)) {
      cout << " average";
    }
    if (isHardcore(numLess, numEqual, numGreater)) {
      cout << " hardcore";
    }
    if (isPro(numLess, numEqual, numGreater)) {
      cout << " pro";
    }
    cout << endl;
  }
  return 0;
}
