The well-known supermarket chain X-Mart decided to cut costs by reducing the number of different products it keeps on its shelves. The marketing department worried this would hurt sales, so it decided to turn the reduction into an opportunity to improve customer relations.
X-Mart therefore ran an Internet poll in which customers could choose which products they wanted the supermarket to keep on its shelves and which products they wanted it to withdraw. The list of currently available products was published online.
To keep the poll simple, each customer may choose at most two products to vote for (the supermarket should keep selling them) and at most two products to vote against (the supermarket should stop selling them).
Once every vote is collected, the marketing department wants to know whether it can choose a new product list that pleases all voting customers. A customer is pleased when at least one of the products they voted for is actually kept, and at least one of the products they voted against is actually withdrawn. You may assume that no customer votes both for and against the same product.
Your program must process several test cases. The first line of a test case contains two integers $C$ and $P$, the number of customers and the number of products ($1 \le C \le 1000$ and $1 \le P \le 10000$). Each of the next $C$ lines describes one customer's preferences as four integers $X$, $Y$, $S$, $T$ ($0 \le X, Y, S, T \le P$). $X$ and $Y$ are products the customer wants kept, and $S$ and $T$ are products the customer wants withdrawn. A value of $0$ for any of $X$, $Y$, $S$, $T$ means that vote is unused. A line with $C = P = 0$ ends the input.
For each test case, print a single line containing yes if it is possible to please all voting customers, or no if it is not.