import java.io.*; import java.util.*; class Clovek { public String jmeno; public boolean typ; public double hodnota; public boolean ma = false; public Clovek(String jmeno,String typ,double hodnota) { this.jmeno = jmeno; this.typ = (typ.equals("buy")); this.hodnota = hodnota; } } class Firma { Clovek[] c; public String nazev; int pocetLidi = 0; public Firma(int prvku) { c = new Clovek[prvku]; } public void add(String jmeno,String typ,double hodnota) { c[pocetLidi] = new Clovek(jmeno,typ,hodnota); pocetLidi++; } public void projdi() { System.out.println(nazev); for(Clovek cl : c) { System.out.print(cl.jmeno + ":"); for(Clovek cl2 : c) { if(cl.typ != cl2.typ) { if(cl.typ) { if(cl.hodnota >= cl2.hodnota) { System.out.print(" " + cl2.jmeno); cl.ma = true; } } else { if(cl.hodnota <= cl2.hodnota) { System.out.print(" " + cl2.jmeno); cl.ma = true; } } } } if(!cl.ma) { System.out.print(" NO-ONE"); } System.out.println(); } } } public class exchange { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; StringTokenizer st ; s = br.readLine(); st = new StringTokenizer(s); while(true) { if(s.charAt(0) == '0') break; Firma f = new Firma(Integer.valueOf(st.nextToken()).intValue()); f.nazev = st.nextToken(); while(true) { s = br.readLine(); st = new StringTokenizer(s); if(st.countTokens() == 2) break; f.add(st.nextToken(),st.nextToken(),Double.valueOf(st.nextToken())); } //f.projdi(); } } }