the logic which i figured out was that for any query
this set of queries should not exist
(i,j)
(j,k)
(i,k)
where (i, j ,k) belong to 1<=i,j,k<=n
as for if the element set existed , one of elements in set
(i,j)
(j,k)
which is common i.e. j is transported to other corner then too i is eaten by k
hence transportation can’t be done. please tell if possible error exist
It is true that (i,j), (j,k), (k,i) should not exist. If it does, the output should be NO… But you are neglecting other cases where a NO (or YES) is possible. That’s the reason for the WA!