Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.

But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be distinct) which are not greater than *n*. Can you help me to find the maximum possible least common multiple of these three integers?
The first line contains an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">6</sup>) — the *n* mentioned in the statement.
import sys
import math as mt
from decimal import *
MAXN = 1000001
  
spf = [0 for i in range(MAXN)] 

def sieve(): 
    spf[1] = 1
    for i in range(2, MAXN): 
          
        # marking smallest prime factor  
        # for every number to be itself. 
        spf[i] = i 
  
    # separately marking spf for  
    # every even number as 2 
    for i in range(4, MAXN, 2): 
        spf[i] = 2
  
    for i in range(3, mt.ceil(mt.sqrt(MAXN))): 
          
        # checking if i is prime 
        if (spf[i] == i): 
              
            # marking SPF for all numbers 
            # divisible by i 
            for j in range(i * i, MAXN, i):  
                  
                # marking spf[j] if it is  
                # not previously marked 
                if (spf[j] == j): 
                    spf[j] = i 
  
def getFactorization(x): 
    factor ={} 
    while (x != 1): 
        #ret.append(spf[x])
        factor[spf[x]]=factor.get(spf[x],0)+1
        x = x // spf[x] 
  
    return factor
pr=[]
sieve()
for i in range(2,10**6):
    if spf[i]==i:
        pr.append(i)

t=1 

for __ in range(t):
    
    n=int(input())
    
    factor=getFactorization(n)
    maxi=n
    num2=n;
    for i in range(n-1,0,-1):
        maxi1=1
        factor1=getFactorization(i)
        factor2={}
        for j in factor:
            factor2[j]=factor[j]
        for j in factor1:
            factor2[j]=(max(factor1[j],factor2.get(j,0)))
        for j in factor2:
            maxi1*=(j**factor2[j])
        if maxi1>maxi:
            maxi=maxi1
            num2=i
    factor2=getFactorization(num2)
    
    for j in factor:
        factor2[j]=max(factor2.get(j,0),factor[j])
    #print(num2,factor2)
    for i in range(n-2,0,-1):
        maxi1=1
        factor3=getFactorization(i)
        for j in factor2:
            factor3[j]=max(factor3.get(j,0),factor2[j])
        for j in factor3:
            maxi1*=(j**(factor3[j]))
        if maxi1>maxi:
            #print(33,i,factor3,maxi1)
            maxi=maxi1
    print(maxi)
    
    
    