The Door to the Treasure Repository

For each pair of integers, compute each key number (largest distinct prime factor minus the sum of the others) and print the one with the larger key.

Medium4Number theoryMathImplementationBrute forceInterviewNo attempts yetTime limit8sMemory limit512 MB

Problem

Jimmy has reached the last floor of the maze. Two doors stand there. One leads to the treasure repository, the other opens the gate to hell. Opening the wrong door ends the game and erases his save data, so he must never pick it.

Each door carries one positive integer, and that number is the only hint. The door whose number has the larger key number leads to the treasure repository. The key number of a positive integer nn is the largest distinct prime factor of nn minus the sum of the remaining distinct prime factors. A prime factor is counted once even if it divides nn several times.

For example, suppose the two doors carry 30 and 20. The prime factors of 30 are 2, 3, 5, so its key number is 5(2+3)=05 - (2 + 3) = 0. The prime factors of 20 are 2 and 5, so its key number is 52=35 - 2 = 3. Jimmy must open the door marked 20.

Write a program that reads the two numbers and decides which door to open.

Input

The input is a sequence of datasets. Each dataset is one line with two integers aa and bb separated by a space (2a,b1062 \le a, b \le 10^6). The key numbers of the two integers are always different.

The last line of the input holds two zeros. That line is not a dataset and must not be processed.

Output

For each dataset, print one line. Print a if the door marked aa leads to the treasure repository, and b otherwise. Print no other space or character.