def makeP(x):
  p = [2]
  P = [2]
  n = 3
  while n < x:
    for i in p:
      if n % i == 0:
        break
    else:
      P.append(n)
    n += 2
    while p[-1] ** 2 < n:
      p.append(P[len(p)])
  return P

prime = makeP(1000)

def factor(x):
  dic = {}
  for i in prime:
    if i ** 2 > x:
      break
    if x % i == 0:
      tmp = 0
      while x % i == 0:
        tmp += 1
        x /= i
      dic.update({i:tmp})
  if x != 1:
    dic.update({x:1})
  return dic


def phi(x):
  ff = factor(x)
  out = 1
  for i in ff.keys():
    #print (i - 1) * i ** (ff.get(i) - 1)
    out *= (i - 1) * i ** (ff.get(i) - 1)
  return out



maxx = [0, 0]
for i in xrange(2, 1000001):
  if i % 100000 == 0:
    print i
  tmp = float(i) / phi(i)
  if tmp > maxx[0]:
    maxx = [tmp, i]
print maxx