Tic Tac Toe
Tag(s):

## Easy

Problem
Editorial
Analytics
Tic-tac-toe is a pencil-and-paper game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.

Now you are going to write code to play Tic-tac-toe with others or computer bot.

Input
The input will be an 3x3 matrix consisting only of 0, 1 or 2. Then another line will follow which will contain a number 1 or 2, which is your player id.

In the given matrix, top-left is [0,0] and bottom-right is [2,2]. The x-coordinate increases from left to right, and y-coordinate increases from top to bottom.

The cell marked 0 means it doesn't contain any marks. The cell marked 1 means it contains player 1's mark which is gray in color. The cell marked 2 means it contains player 2's mark which is black in color.

Output
Print the coordinates of the cell (x, y) where you want to play your move.

Starting state
0 0 0
0 0 0
0 0 0

Scoring
The scores will be calculated by running a tournament of all submissions at the end of the contest. Your last submission will be used while running the tournament. Score will be assigned according to Elo rating system.

Example of a bot which plays the game randomly, while avoiding invalid move: http://code.hackerearth.com/bc183br
SAMPLE INPUT
1 0 0
0 0 0
0 0 0
2
SAMPLE OUTPUT
1 1
Explanation

This is player 2's turn, and the player moves at cell[1, 1].

The next state of the board after the move is following:

1 0 0
0 2 0
0 0 0

Time Limit: 1.0 sec(s) for all input files combined.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...