#!/usr/bin/python3
# -*- coding: utf-8 -*-
# †
from collections import namedtuple
from heapq import heappush, heappop
Tup = namedtuple('Tup', 'cnt, num')
def sieve(N):
is_prime = [False, False] + [True] * (N-1)
sq = int(N ** .5)
for i in range(2, sq+1):
if is_prime[i]:
for j in range(i*i, N+1, i):
is_prime[j] = False
return [i for i, p in enumerate(is_prime) if p]
primes = sieve(50)
N = len(primes)
LIMIT = 10**18
pq = []
cnt = 1
x = 1
# 約数の個数、値そのもの、i番目の素数を、icnt個使う
heappush(pq, (cnt, x, 0, 0))
max_cnt = cnt
resArr = []
while len(pq):
cnt, x, i, icnt = heappop(pq)
if max_cnt < cnt:
resArr.append(Tup(cnt, x))
max_cnt = cnt
if x * primes[i] < LIMIT:
# i 番目を icnt 個から 1 個増やして icnt+1 個にする
heappush(pq, (cnt*(icnt+2)//(icnt+1), x*primes[i], i, icnt+1))
if i + 1 < N and x * primes[i+1] < LIMIT:
# i+1 番目を新たに 1 個使う
heappush(pq, (cnt*2, x*primes[i+1], i+1, 1))
# 値で昇順になるように情報をオミットして出力する。
resArr.sort(key=lambda tup: tup.num)
max_cnt = 0
for cnt, num in resArr:
if max_cnt < cnt:
max_cnt = cnt
# 約数の個数, 値
print(cnt, num)
IyEvdXNyL2Jpbi9weXRob24zCiMgLSotIGNvZGluZzogdXRmLTggLSotCiMg4oCgCmZyb20gY29sbGVjdGlvbnMgaW1wb3J0IG5hbWVkdHVwbGUKZnJvbSBoZWFwcSBpbXBvcnQgaGVhcHB1c2gsIGhlYXBwb3AKVHVwID0gbmFtZWR0dXBsZSgnVHVwJywgJ2NudCwgbnVtJykKCmRlZiBzaWV2ZShOKToKICAgIGlzX3ByaW1lID0gW0ZhbHNlLCBGYWxzZV0gKyBbVHJ1ZV0gKiAoTi0xKQogICAgc3EgPSBpbnQoTiAqKiAuNSkKICAgIGZvciBpIGluIHJhbmdlKDIsIHNxKzEpOgogICAgICAgIGlmIGlzX3ByaW1lW2ldOgogICAgICAgICAgICBmb3IgaiBpbiByYW5nZShpKmksIE4rMSwgaSk6CiAgICAgICAgICAgICAgICBpc19wcmltZVtqXSA9IEZhbHNlCiAgICByZXR1cm4gW2kgZm9yIGksIHAgaW4gZW51bWVyYXRlKGlzX3ByaW1lKSBpZiBwXQoKcHJpbWVzID0gc2lldmUoNTApCk4gPSBsZW4ocHJpbWVzKQpMSU1JVCA9IDEwKioxOAoKcHEgPSBbXQpjbnQgPSAxCnggPSAxCiMg57SE5pWw44Gu5YCL5pWw44CB5YCk44Gd44Gu44KC44Gu44CBaeeVquebruOBrue0oOaVsOOCkuOAgWljbnTlgIvkvb/jgYYKaGVhcHB1c2gocHEsIChjbnQsIHgsIDAsIDApKQptYXhfY250ID0gY250CnJlc0FyciA9IFtdCndoaWxlIGxlbihwcSk6CiAgICBjbnQsIHgsIGksIGljbnQgPSBoZWFwcG9wKHBxKQogICAgaWYgbWF4X2NudCA8IGNudDoKICAgICAgICByZXNBcnIuYXBwZW5kKFR1cChjbnQsIHgpKQogICAgICAgIG1heF9jbnQgPSBjbnQKICAgIGlmIHggKiBwcmltZXNbaV0gPCBMSU1JVDoKICAgICAgICAjIGkg55Wq55uu44KSIGljbnQg5YCL44GL44KJIDEg5YCL5aKX44KE44GX44GmIGljbnQrMSDlgIvjgavjgZnjgosKICAgICAgICBoZWFwcHVzaChwcSwgKGNudCooaWNudCsyKS8vKGljbnQrMSksIHgqcHJpbWVzW2ldLCBpLCBpY250KzEpKQogICAgaWYgaSArIDEgPCBOIGFuZCB4ICogcHJpbWVzW2krMV0gPCBMSU1JVDoKICAgICAgICAjIGkrMSDnlarnm67jgpLmlrDjgZ/jgasgMSDlgIvkvb/jgYYKICAgICAgICBoZWFwcHVzaChwcSwgKGNudCoyLCB4KnByaW1lc1tpKzFdLCBpKzEsIDEpKQoKIyDlgKTjgafmmIfpoIbjgavjgarjgovjgojjgYbjgavmg4XloLHjgpLjgqrjg5/jg4Pjg4jjgZfjgablh7rlipvjgZnjgovjgIIKcmVzQXJyLnNvcnQoa2V5PWxhbWJkYSB0dXA6IHR1cC5udW0pCm1heF9jbnQgPSAwCmZvciBjbnQsIG51bSBpbiByZXNBcnI6CiAgICBpZiBtYXhfY250IDwgY250OgogICAgICAgIG1heF9jbnQgPSBjbnQKICAgICAgICAjIOe0hOaVsOOBruWAi+aVsCwg5YCkCiAgICAgICAgcHJpbnQoY250LCBudW0pCg==