P15444 「IXOI R1」No Name

Background

![](https://cdn.luogu.com.cn/upload/image_hosting/qi81tt0r.png?x-oss-process=image/resize,m_lfit,h_300,w_300) 这是空银子,她非常可爱。 现在她给了你一道题,如果你能做出来,就可以和你约会。 这正是你一直想要的,而这道题肯定难不到你啦。

Description

You are given a sequence $a_i(i\in[1,n])$ of positive rational numbers of length $n$, we define an operation as: Choose an index $j$, then $\forall i\in[1,n]$, let $a_i\gets\frac{a_i}{a_j}$. Find out the minimum value of the sequence after operations are carried out any number of times.

Input Format

The first line of the input contains a single positive integer $n$: the length of the sequence. Then the next $n$ lines, line $i+1$ contains two space separated positive integers $x_i,y_i$, indicating that $a_i=\frac{x_i}{y_i}$.

Output Format

One line, two positive integers $x,y$, indicating that the minimum value is $\frac{x}{y}$. Note that the fraction you output must be the simplest fraction. In particular, if the simplified result is an integer, $y$ is expected to be $1$.

Explanation/Hint

### Example Explanation Carry out operations for $4$ times, selecting indices $5,4,1,2$. The minimum value is $\frac{4}{363}$, it can be proved that no smaller value exists. ### Constraints **This problem uses bundled testing.** |Subtask Id|$n\le$|Points| |:-:|:-:|:-:| |$0$|$10$|$20$| |$1$|$5000$|$20$| |$2$|$10^6$|$60$| For all data, it is guaranteed that: $2\le n\le 10^6$,$\forall i\in[1,n],0