#include <iostream>
using namespace std;
struct information
{
string name;
float hot;
int ikun;
};
int main()
{
int a;
cin>>a;
information w[a];
for(int i=0;i<a;i++)
{
cin>>w[i].name>>w[i].hot>>w[i].ikun;
}
for(int i=0;i<a;i++)
{
if((w[i].hot>=37.5)&&(w[i].ikun=1))
{
cout <<w[i].name<< endl;
}
}
return 0;
}