import sys import math input = sys.stdin.readline k = int(input()) N = [tuple(map(int, input().split())) for _ in range(k)] lgN = sum(math.log(p) * e for p, e in N) p = N[-1][0] lg = 0.0 err = math.inf r_ans = -1 for r in range(p): lg += math.log(p - r) lg -= math.log(r + 1) if err > abs(lg - lgN): err = abs(lg - lgN) r_ans = r + 1 if err < 1e-10 * lgN: print(p, r_ans) else: print(-1, -1)