for i in range(10000,100000):
    sum = 0
    i = str(i)
    
    for j in range(4):
        a,b = i[:j+1],i[j+1:]
        sum += int(a)*int(b)
    
    if sum == int(i):
        print(i,end=' ')