Game of Guessing Her Password!

This is an interactive problem.

Like everyone, Nubu the random coder girl, has a secret password. One day some of her friends wanted to guess her password. They call it a guessing game! To make the guessing game more interesting, she reveals them that the password is an integer number between $1$ and $10^3$. Let’s say, her secret password is $n$. Her friends can tell her a positive integer number, $m$. In return, she will tell them the value of $gcd(n, m)$. But the friends can not ask more than $Q$ times. The friends can not figure out how they can do it. So they have come to you!


This is a companion discussion topic for the original entry at https://toph.co/p/game-of-guessing-her-password