This Python code will solve the Tic-Tac-Toe-Tomek problem in CodeJam 2013's Qualification Round A.