{ NOTE: it is recommended to use this even if you don't understand the following code }

var
    T, i, test : LongInt;
    board      : Array[0..8-1] of AnsiString;
    ans        : AnsiString;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(T);
    for test:=1 to T do begin
        ReadLn();
        for i:=0 to 8-1 do
            Read(board[i]);
        ReadLn();
        
        ans := 'YES';
        
        { INSERT YOUR CODE HERE }
        
        
        WriteLn(ans);
    end;

end.
