Hide

Problem G
rsafact

Factor an RSA modulus given the encryption and decryption exponents.

Input

Each line of the input consists of a space-separated list of: one integer RSA modulus $N$ (product of two odd and distinct primes $p$ and $q$), an integer encryption exponent $e$, and an integer decryption exponent $d$, such that $ed = 1\bmod (p-1)(q-1)$. All integers are positive and given in decimal with at most 2000 digits.

Output

For each input line, output a line containing the two factors $p$ and $q$ of the challenge RSA modulus $N$ separated by a space (smallest factor first). The output integers should be given in decimal.

Sample Input 1 Sample Output 1
299 5 53
85 3 43
22 3 7
899 11 611
55 3 27
13 23
5 17
2 11
29 31
5 11

Please log in to submit a solution to this problem

Log in