import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline from operator import itemgetter # エラトステネスの篩を用いた素因数分解・約数列挙 MAX=200000+10 # 使いたい最大値を指定 # Sieve[i]で、iの最も小さい約数を返す。 Sieve=[i for i in range(MAX)] for i in range(2,MAX): if Sieve[i]!=i: continue for j in range(i,MAX,i): if Sieve[j]==j: Sieve[j]=i # 素因数分解 def fact(x): D=dict() while x!=1: k=Sieve[x] if k in D: D[k]+=1 else: D[k]=1 x//=k return D # 約数列挙 def faclist(x): LIST=[1] while x!=1: k=Sieve[x] count=0 while x%k==0: count+=1 x//=k LIST2=[] for l in LIST: for i in range(1,count+1): LIST2.append(l*k**i) LIST+=LIST2 return LIST N=int(input()) A=[list(map(int,input().split())) for i in range(N)] A.sort(key=itemgetter(1),reverse=True) A.sort(key=itemgetter(0)) ANS=0 A2=[] for a,b in A: if A2 and A2[-1][0]==a: ANS=max(ANS,b) else: A2.append((a,b)) A=A2 A.sort(key=lambda x:x[0]*x[1]) LIST=[0]*202020 SA=[[] for i in range(202020)] for a,b in A: SA[a]=faclist(a) for f in SA[a]: x=LIST[f] ANS=max(ANS,x*f//a) for f in SA[a]: LIST[f]=max(LIST[f],b) print(ANS)