n,a,b=map(int,input().split()) ball=[tuple(map(int,input().split())) for i in range(n)] g=1 q=[[[0]*n for j in range(n)] for i in range(1<0: x1,y1,k1=ball[i] x2,y2,k2=ball[j] for k in range(n): if (p>>k)&1==0: x3,y3,k3=ball[k] if a<=abs(x3-x1)+abs(y3-y1)+abs(x3-x2)+abs(y3-y2) or b<=abs(k3-k1): q[p+(1<