R=range def J(): return map(int,input().split()) N,A,B=J() L=R(N) Z=[list(J())for i in L] P=R(1<>i==1and i==j for j in L]for i in L]for S in P] a=1 for S in P: for h in R(N**3): i,j,k=h%N,h//N%N,h//N**2 d,v,w=D[S][i][j],Z[j],Z[k] D[S|1<>k&1<1)*(d and abs(w[0]-Z[i][0])+abs(w[1]-Z[i][1])+(i!=j)*(abs(w[0]-v[0])+abs(w[1]-v[1]))>=A or abs(w[2]-v[2])>=B)) a=max(a,d) print(a)