for i in range(998001,888888,-1): num = str(i) start = 0 end = -1 if num[start] == num[end]: start += 1 end -= 1 if num[start] == num[end]: start += 1 end -= 1 if num[start] == num[end]: start += 1 end -= 1 for i in range(999,900,-1): for j in range(999,900,-1): if i*j == int(num): print(num) print(i,j) else:continue