Vasya wants to buy a new refrigerator. He believes that a refrigerator should be a rectangular parallelepiped with integer edge lengths. Vasya calculated that for daily use he will need a refrigerator with volume of at least *V*. Moreover, Vasya is a minimalist by nature, so the volume should be no more than *V*, either — why take up extra space in the apartment? Having made up his mind about the volume of the refrigerator, Vasya faced a new challenge — for a fixed volume of *V* the refrigerator must have the minimum surface area so that it is easier to clean.

The volume and the surface area of a refrigerator with edges *a*, *b*, *c* are equal to *V* = *abc* and *S* = 2(*ab* + *bc* + *ca*), correspondingly.

Given the volume *V*, help Vasya find the integer lengths for the refrigerator's edges *a*, *b*, *c* so that the refrigerator's volume equals *V* and its surface area *S* is minimized.
The first line contains a single integer *t* (1 ≤ *t* ≤ 500) — the number of data sets.

The description of *t* data sets follows. Each set consists of a single integer *V* (2 ≤ *V* ≤ 10<sup class="upper-index">18</sup>), given by its factorization as follows.

Let *V* = *p*<sub class="lower-index">1</sub><sup class="upper-index">*a*<sub class="lower-index">1</sub></sup>*p*<sub class="lower-index">2</sub><sup class="upper-index">*a*<sub class="lower-index">2</sub></sup>... *p*<sub class="lower-index">*k*</sub><sup class="upper-index">*a*<sub class="lower-index">*k*</sub></sup>, where *p*<sub class="lower-index">*i*</sub> are different prime numbers and *a*<sub class="lower-index">*i*</sub> are positive integer powers. 

Then the first line describing a data set contains a single positive integer *k* — the number of different prime divisors of *V*. Next *k* lines contain prime numbers *p*<sub class="lower-index">*i*</sub> and their powers *a*<sub class="lower-index">*i*</sub>, separated by spaces. All *p*<sub class="lower-index">*i*</sub> are different, all *a*<sub class="lower-index">*i*</sub> &gt; 0.
print("_RANDOM_GUESS_1689431160.02709")# 1689431160.02711