Bedtime Reading II

Find all aliquot (bess) cycles starting in [start,end] whose first element is the chain minimum, skipping any chain where a value exceeds 2,000,000.

Medium6Number theoryImplementationMathSimulationNo attempts yetTime limit2sMemory limit512 MB

Problem

For a positive integer nn, let bess(n)\mathrm{bess}(n) be the sum of the divisors of nn with nn itself left out. For example bess(12)=1+2+3+4+6=16\mathrm{bess}(12) = 1 + 2 + 3 + 4 + 6 = 16, and continuing from there, bess(16)=1+2+4+8=15\mathrm{bess}(16) = 1 + 2 + 4 + 8 = 15, bess(15)=1+3+5=9\mathrm{bess}(15) = 1 + 3 + 5 = 9, bess(9)=1+3=4\mathrm{bess}(9) = 1 + 3 = 4, bess(4)=1+2=3\mathrm{bess}(4) = 1 + 2 = 3, and bess(3)=1\mathrm{bess}(3) = 1. By definition bess(1)=0\mathrm{bess}(1) = 0.

Start at a positive integer xx and follow the values xx, bess(x)\mathrm{bess}(x), bess(bess(x))\mathrm{bess}(\mathrm{bess}(x)) and so on. If xx ever comes back, the values listed in order up to the step just before the return form the chain of xx. Since bess(6)=1+2+3=6\mathrm{bess}(6) = 1 + 2 + 3 = 6, the chain of 6 is the single element 6. Since bess(220)=284\mathrm{bess}(220) = 284 and bess(284)=220\mathrm{bess}(284) = 220, the chain of 220 is 220 284. Longer chains exist too.

You are given two integers start and end. Find every chain whose first element lies between start and end, inclusive. Report a chain only when its first element is the smallest element of that chain. If any other element of the chain is smaller than the first element, the chain is not reported.

If a value larger than 2,000,000 shows up while you follow the values, treat that starting point as producing no chain. A value in the middle of a chain may exceed end. No chain has more than 50 elements.

Input

The first line contains two integers start and end separated by one space. 1startend1,000,0001 \le \text{start} \le \text{end} \le 1{,}000{,}000.

Output

Print the chains you found, one per line, ordered by their first element from smallest to largest. On each line print the elements of the chain in order, separated by one space. If no chain satisfies the conditions, print nothing.