##################################
#                                #
# Last modified 7/9/2009         # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

from sets import Set

def run():

    for i in range(100,999):
        if '0' in str(i):
            continue
        if len(Set(str(i))) < 3:
            continue
        for j in range(100,999):
            if '0' in str(j):
                continue
            if len(Set(str(j))) < 3:
                continue
            k = i + j
            if k > 999 or '0' in str(k):
                continue
            if len(Set(str(k))) < 3:
                continue
            ti1 = Set(str(i))
            tj1 = Set(str(j))
            tk1 = Set(str(k))
            ti2 = Set(str(i))
            if Set(str(i)) != Set(str(j)) and Set(str(i)) != Set(str(k)) and Set(str(k)) != Set(str(j)):
#                print ti1, len(ti1), ti2, len(ti2), tj1, len(tj1)
                ti1.intersection_update(tj1)
                ti2.intersection_update(tk1)
                tj1.intersection_update(tk1)
#                print ti1, len(ti1), ti2, len(ti2), tj1, len(tj1)
                if len(ti1) == 0 and len(ti2) == 0 and len(tj1) == 0:
                    print i,j,k

run()

