Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6379
@blackshadows 6329
@mb1973 5358
@Quandray 5231
@akhayrutdinov 5111
@saiujwal13083 4510
@sanjay05 3762
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3357
@KshamaGupta 3318
Complete Leaderboard
Next Optimal Move in Tic Tac Toe
Hard Accuracy: 24.37% Submissions: 517 Points: 8

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)

Input:
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.

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

Constraints:
1<=T<=100

Example:
Input:

1
o _ _
_ _ _
_ _ _

Output:
1 1

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Next Optimal Move in Tic Tac Toe

Output Window