Problem

Source: Ukrainian Mathematical Olympiad 2024. Day 1, Problem 11.2

Tags: number theory, geometry, combinatorics, game



You are given positive integers $m, n>1$. Vasyl and Petryk play the following game: they take turns marking on the coordinate plane yet unmarked points of the form $(x, y)$, where $x, y$ are positive integers with $1 \leq x \leq m, 1 \leq y \leq n$. The player loses if after his move there are two marked points, the distance between which is not a positive integer. Who will win this game if Vasyl moves first and each player wants to win? Proposed by Mykyta Kharin