Question:
A number X is said to be magical number for N and M if X satisfies the following equation for N and M:
(N*X) mod M = 1
Your task is to write a program to find the magical for all given pair of N and M.
Input:
Output:
For each pair of N and M print magical number X in new line.
Constraints: