from math import sqrt

def premiers(n):
  prem=list(range(2,n+1))
  k=2
  nRacine=sqrt(n)
  while k<nRacine:
    prem=[p for p in prem if p<=k or p%k!=0]
    k=prem[prem.index(k)+1]  # nouveau nombre premier
  return prem

prem = premiers(100000)

sol = list()
E = 1

while len(sol)<4 and E < max(prem):
    for c in prem:
        if 2 * c**2 > E:
            break
        if E%(c**2)==0 and E//(c**2) in prem:
            if len(sol) == 0 or sol[-1]+2 == E:
                sol.append(E)
                if len(sol) > 1:
                    print(sol, end=' ')
            else:
                if len(sol) > 1:
                    print("NOK")
                sol = list()
                sol.append(E)
    E += 2

print("\n\n")
print(sol)