Byteasar decided to invest in renewable energy and opened a solar panel factory. Within a few days n clients came in. Each client ordered one rectangular panel and gave a range for its width and a range for its height.
A panel is filled with square photovoltaic cells. A cell side length can be any positive integer, but all cells in one panel have the same side length. The larger the cells, the more efficient the panel, so for every order Byteasar wants the largest cell side length he can use.
For the i-th order the width is chosen as an integer in [smin,smax] and the height as an integer in [wmin,wmax]. A panel of width W and height H can be filled with cells of side length k exactly when k divides both W and H.
The first line contains one integer n (1≤n≤1000), the number of ordered panels.
Each of the next n lines describes one panel and contains four integers smin, smax, wmin, wmax separated by single spaces (1≤smin≤smax≤109, 1≤wmin≤wmax≤109). In order, they are the minimum width, the maximum width, the minimum height, and the maximum height of the i-th panel.
Print exactly n lines. Line i contains the largest cell side length that the i-th panel can be made of.
In the first example Byteasar builds panels of size 8×8 (one cell), 7×14 (two cells), 4×22 or 6×22 (22 or 33 cells), and 5×20 (four cells).