#include <bits/stdc++.h> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { char name[100]; double B,V; while(cin>>name, strcmp(name,"END")!=0) { cin >>B >>V; printf("%s %.2lf", name, B-V); double d=B-V; if (d <-0.25) printf(" O"); else if(d < 0.0 ) printf(" B"); else if(d < 0.25) printf(" A"); else if(d < 0.5 ) printf(" F"); else if(d < 1.0 ) printf(" G"); else if(d < 1.5 ) printf(" K"); else printf(" M"); printf("\n"); } return 0; }