Under construction

Still being built. Things may change

Six Equations

Interview

Time limit1sMemory limit128 MB

Summary
Recover six bounded primes from six pairwise products by taking gcds of the pairs that share a prime.
Level

Easy3 of 10

Topics
Number theory
Solved
No attempts yet

Problem

Six simple equations are given. The unknowns x1x_1, x2x_2, x3x_3, x5x_5, x6x_6, x7x_7 are all primes that are at least 2 and at most 20,000,000.

  • c1=x1x2c_1 = x_1 x_2
  • x4=c4x1x_4 = \dfrac{c_4}{x_1}
  • c3=x6x7c_3 = x_6 x_7
  • x8=c2x7x_8 = \dfrac{c_2}{x_7}
  • c5=x2x3c_5 = x_2 x_3
  • c6=x6x5c_6 = x_6 x_5

Every c1c_1 through c6c_6 is a positive integer that does not exceed 20,000,000 squared. The values x4x_4 and x8x_8 are fixed by the two equations above. Nothing requires them to be prime, and they are not printed.

Given c1c_1, c2c_2, c3c_3, c4c_4, c5c_5, c6c_6, write a program that finds x1x_1, x2x_2, x3x_3, x5x_5, x6x_6, x7x_7. Only inputs that have a solution are given.

Input

The first line contains c1c_1, c2c_2, c3c_3, c4c_4, c5c_5, c6c_6 separated by spaces. Here c1≠c5c_1 \neq c_5 and c3≠c6c_3 \neq c_6.

Output

Print x1x_1, x2x_2, x3x_3, x5x_5, x6x_6, x7x_7 in this order on one line, separated by single spaces. Because c1≠c5c_1 \neq c_5 and c3≠c6c_3 \neq c_6, the six values are determined uniquely.

Examples1

  1. Example 1

    Input
    6 20 35 10 39 77
    
    Expected output
    2 3 13 11 7 5