sieve = [i for i in range(3,30,2)]
primes = [2]
while sieve:
..p = sieve.pop(0)
..primes.append(p)
..sieve = [i for i in sieve if i%p]

def partitions(n,mx):
..if mx == 1 or n < 2: return 1
..res = 0
..for k in range(1,min(n,mx)+1):
....res += partitions(n-k,k)
..return res

parts = [partitions(n,n) for n in range(2,25)]

def factor(n,mn):
..if n == 1: return [[]]
..if n < mn: return []
..res = []
..for i in range(len(parts)):
....p = parts[i]
....if p < mn: continue
....if p > n: return res
....if n%p: continue
....for j in factor(n//p,p):
......res.append(j + [i+2])

for n in range(1,1001):
..res = []
..print(factor(n,1))
..for i in factor(n,1):
....num = 1
....for j in range(len(i)):
......num *= primes[j] ** i[j]
....res.append(num)
..if res: print(n,min(res))
..else: print(n,0)