GCD and NOD

Limits: 100ms, 256 MB

Given 3 numbers, G, A and B we have to find two numbers M and N such that they satisfy the following conditions:


This is a companion discussion topic for the original entry at https://toph.co/p/gcd-and-nod