from fractions import Fraction
from functools import reduce
from fractions import gcd


def product(fracs):
    n = reduce(lambda x, y: Fraction(x.numerator*y.numerator, 1), fracs)
    d = reduce(lambda x, y: Fraction(1, x.denominator*y.denominator), fracs)
    g = gcd(n.numerator, d.denominator)
    return n.numerator//g, d.denominator//g

if __name__ == '__main__':
    fracs = []
    for _ in range(int(input())):
        fracs.append(Fraction(*map(int, input().split())))
    result = product(fracs)
    print(*result)
