guess=[]
for i in itertools.product([8,7,1,3,9],[7,6,2,6,2],[4,5,3,4,5]):
guess.append(str(i[0])+str(i[1])+str(i[2]))
guess=list(set(guess))
def result(a,b)->list:
temp=[]
if a[0]==b[0] and a[1]!=b[1] and a[2]!=b[2]:
temp.append(a)
if a[0]!=b[0] and a[1]!=b[1] and a[2]==b[2]:
temp.append(a)
if a[0]!=b[0] and a[1]==b[1] and a[2]!=b[2]:
temp.append(a)
return temp
a874,a765,a123,a364,a925=[],[],[],[],[]
for i in guess:
a874=a874+result(i,'874')
a765=a765+result(i,'765')
a123=a123+result(i,'123')
a364=a364+result(i,'364')
a925=a925+result(i,'925')
set(a874)&set(a765)&set(a123)&set(a364)&set(a925)