GCD on a grid

Problem Name:
GCD on a grid
Site:CodeForces
Links:
Tags:
Problem setters: