#include <iostream>
#include <vector>

using namespace std;

float calculateBodyMassIndex (int height, int weight);
void rateLevelOfObesityBasedOnBmi (float bmi, string forename, vector <string>& peopleWithUnderweight,
                                   vector <string>& peopleWithCorrectWeight,
                                   vector <string>& peopleWtihOverweight);
void showObesityClassificationsOfPeople (vector <string>& peopleWithUnderweight,
        vector <string>& peopleWithCorrectWeight,
        vector <string>& peopleWtihOverweight);

int main()
{
    int numberOfPeople;
    cin >> numberOfPeople;
    string forename;
    int weight, height;

    vector <string> peopleWithUnderweight;
    vector <string> peopleWithCorrectWeight;
    vector <string> peopleWtihOverweight;

    for(int i = 0; i < numberOfPeople; i++)
    {
        cin >> forename;

        float bmi = calculateBodyMassIndex (height, weight);
        rateLevelOfObesityBasedOnBmi (bmi, forename, peopleWithUnderweight, peopleWithCorrectWeight, peopleWtihOverweight);
    }
    if (numberOfPeople == 0)
        return 0;
    showObesityClassificationsOfPeople (peopleWithUnderweight, peopleWithCorrectWeight, peopleWtihOverweight);

    return 0;
}

float calculateBodyMassIndex (int height, int weight)
{
    do
        cin >> weight;
    while (weight <= 0);
    do
        cin >> height;
    while (height <= 0);

    float bmi = (weight/((height/100)*(height/100)));
    return bmi;
}

void rateLevelOfObesityBasedOnBmi (float bmi, string forename, vector <string>& peopleWithUnderweight,
                                   vector <string>& peopleWithCorrectWeight,
                                   vector <string>& peopleWtihOverweight)
{
    if (bmi < 18.5)
        peopleWithUnderweight.push_back(forename);
    else if ((bmi >= 18.5) && (bmi < 25))
        peopleWithCorrectWeight.push_back(forename);
    else if (bmi >= 25)
        peopleWtihOverweight.push_back(forename);
}

void showObesityClassificationsOfPeople (vector <string>& peopleWithUnderweight,
        vector <string>& peopleWithCorrectWeight,
        vector <string>& peopleWtihOverweight)
{
    cout << "niedowaga" << endl;
    for(int i = 0; i < peopleWithUnderweight.size(); i++)
        cout << peopleWithUnderweight[i] << endl;

    cout << '\n';
    cout << "waga prawidlowa" << endl;
    for(int i = 0; i < peopleWithCorrectWeight.size(); i++)
        cout << peopleWithCorrectWeight[i] << endl;

    cout << '\n';
    cout << "nadwaga" << endl;
    for(int i = 0; i < peopleWtihOverweight.size(); i++)
        cout << peopleWtihOverweight[i] << endl;
}
