Hide

Problem I
GCD and LCM

It is known that the greatest common divisor of two integers $a$ and $b$ is $x$, and that their lowest common multiple is $y$. Given $x$ and $y$, determine all possible pairs $(a, b)$.

Input

The first and only line contains the integers $x$ and $y$ ($1 \le x, y \le 10^{14}$).

Output

Output a series of lines with the possible pairs $a$ and $b$, first in increasing order of $a$ and among those with the same $a$, in increasing order of $b$.

Sample Input 1 Sample Output 1
1 10
1 10
2 5
5 2
10 1
Sample Input 2 Sample Output 2
3 12
3 12
12 3
Sample Input 3 Sample Output 3
2 217143601824
2 217143601824
6 72381200608
32 13571475114
96 4523825038
146 2974569888
218 1992143136
438 991523296
654 664047712
2336 185910618
3488 124508946
7008 61970206
10464 41502982
15914 27289632
47742 9096544
254624 1705602
568534 763872
763872 568534
1705602 254624
9096544 47742
27289632 15914
41502982 10464
61970206 7008
124508946 3488
185910618 2336
664047712 654
991523296 438
1992143136 218
2974569888 146
4523825038 96
13571475114 32
72381200608 6
217143601824 2

Please log in to submit a solution to this problem

Log in