#define f(x)+9*pos(#x,s) var s:string;begin readln;repeat readln(s);if length(s)f(P)f(O)f(W)f(D)f(Y)=6then writeln(s)until 0>0end.