import java.io.*; class person { public String name; public double price; public boolean seller; public person(String name, double price, boolean seller) { this.name = name; this.price = price; this.seller = seller; } } class issuer { public String name; public person[] persons; public issuer(String name, int n) { this.name = name; persons = new person[n]; } public void iCompare() { System.out.println(this.name); for(int i =0; i < persons.length; i++){ String out = ""; for(int k = 0; k< persons.length; k++){ if(persons[i].seller){ if (!persons[k].seller) { if(persons[k].price >= persons[i].price){ out += " " + persons[k].name; } } }else{ if (persons[k].seller) { if(persons[k].price <= persons[i].price){ out += " " + persons[k].name; } } } } if (out.compareTo("") == 0) out = " NO-ONE"; System.out.println(persons[i].name + ":" + out); } } } public class exchange { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line1; try { while ((line1 = br.readLine()) != null) { if (line1.compareTo("0 END") == 0) break; String s2[] = line1.split(" "); int count = 0; try { count = Integer.parseInt(s2[0]); }catch(NumberFormatException e) { break; } if(count > 1000) continue; issuer is = new issuer(s2[1], count); for (int i = 0; i < count; i++) { String l2 = br.readLine(); String p[] = l2.split(" "); person per; /* if (p.length < 2) break; if (p[1].compareTo("buy") == 0) { try{ per = new person(p[0], Double.parseDouble(p[2]), false); is.persons[i]= per; }catch(NumberFormatException e){} } else { try{ per = new person(p[0], Double.parseDouble(p[2]), true); is.persons[i]= per; }catch(NumberFormatException e){} }*/ } // is.iCompare(); } } catch (IOException e) { } return; } }