#include using namespace std; struct agent { char name[21] ; bool sell ; float prize ; } ; int main() { int count ; char issuer[11] ; char temp[5] ; agent agents[1000] ; while (true) { cin >> count >> issuer ; if (count == 0 && strcmp(issuer, "END") == 0) break ; cout << issuer << endl ; for (int i = 0 ; i < count ; i++) { cin >> agents[i].name ; cin >> temp ; if (strcmp(temp, "sell") == 0) agents[i].sell = true ; else agents[i].sell = false ; cin >> agents[i].prize ; } bool neco ; for (int i = 0 ; i < count ; i++) { cout << agents[i].name << ":" ; neco = false ; for (int j = 0 ; j < count ; j++) { if (((agents[i].sell && !agents[j].sell) && (agents[i].prize <= agents[j].prize)) || ((!agents[i].sell && agents[j].sell) && (agents[i].prize >= agents[j].prize))) { neco = true ; cout << " " << agents[j].name ; } } if (!neco) cout << " NO-ONE" ; cout << endl ; } } return 0 ; }