Difficulty Level: Hard

Submissions: 154 Accuracy:


Next Optimal Move in Tic Tac Toe

You are given a middle game situation of the game Tic Tac Toe. It is given that it is player "X's" turn and you need to give to most optimal position for the turn. The situation is given as a 3 x 3 character matrix. '_' refers to the place is empty. 'o' refers that player O marked it in his turn at some time and 'x' refers that player X marked it in his turn at some time. It is player X's turn. Tell him the most optimal solution.(Assume player O played first)

The first line contains the number of test cases T. For each test case a 3 x 3 character matrix is given in three lines one for each row with characters separated with spaces.

Print two space separated integers which refer to the most optimal move.(0 based indexing)



o _ _
_ _ _
_ _ _

1 1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shashwat Jain
Author: shashwat jain

Set Default Code

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use, generate link and share the link here.