def TwoPairs(p): f=first(p) c=classification(f) if sorted(classification(f).values())==[1,2,2]: t=[] for i in c.keys(): if c[i]==2:t.append(i) x,y=sorted(t) del c[x] del c[y] z=list(c.keys()) return [y,x]+z else:return [0,0,0]
def Fhouse(p): f=first(p) c=classification(f) if sorted(c.values())==[2,3]: for i in c.keys(): if c[i]==3:x=i else:y=i return [x,y] else:return [0,0]
def Four(p): f=first(p) c=classification(f) if max(c.values())==4: for i in c.keys(): if c[i]==4:t=i else: tt=i return [t,tt] else:return [0,0]
def Three(p): f=first(p) c=classification(f) if sorted(c.values())==[1,1,3]: for i in c.keys(): if c[i]==3:t=i del c[i] x,y=sorted(c.keys()) return [t,y,x] else:return [0,0,0]
def OnePair(p): f=first(p) c=classification(f) if sorted(c.values())==[1,1,1,2]: for i in c.keys(): if c[i]==2: t=i break del c[t] z=sorted(c.keys()) z.reverse() return [t]+z else:return [0]*4
def flush(p): s=second(p) if len(classification(s).keys())==1:return 1 else:return 0