import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for(int i=0;i<t;i++){
            int[][] check = new int[3][3];
            for(int j=0;j<3;j++){
                String s = in.next();
                check[j][0]=Character.compare(s.charAt(0),'o')==0?0:Character.compare(s.charAt(0),'*')==0?1:2;
                check[j][1]=Character.compare(s.charAt(1),'o')==0?0:Character.compare(s.charAt(1),'*')==0?1:2;
                check[j][2]=Character.compare(s.charAt(2),'o')==0?0:Character.compare(s.charAt(2),'*')==0?1:2;
            }
            // 定义两个变量,用来定义是否有夹吃
            boolean red = false;
            boolean pruple = false;
            // 从上到下
            for(int j=0;j<3;j++){
                if(check[j][0]==check[j][2] && check[j][1]!=2 && check[j][0]!=2 && check[j][0]!=check[j][1]){
                    if(check[j][0]==1){
                        red = true;
                    }else{
                        pruple = true;
                    }
                }
            }
            // 从左到右
            for(int j=0;j<3;j++){
                if(check[0][j] == check[2][j] && check[1][j]!=2 && check[0][j]!=2 && check[0][j]!=check[1][j])
                if(check[0][j]==1){
                    red=true;
                }else{
                    pruple = true;
                }
            }
            if((red && pruple)||(!red && !pruple)){
                System.out.println("draw");
            }else{
                System.out.println(red?"kou":"yukari");
            }
        }
    }
}