Task
Francesco has just bought the new Flight Simulator game and can't wait to play it. However, given the many flight hours he has already logged in the previous versions of the game, this time he won't play as a pilot but as an air traffic controller.

Today Francesco has to coordinate airports, between which flights will travel. The -th flight departs from airport at time and arrives at airport at time : if it departs, it uses the runway of airport at time and the runway of airport at time . A flight that does not depart uses no runway.
Some flights are more important than others, so if one of these does not depart, another specific flight must depart in its place. In particular, there are constraints of this kind: if the important flight does not depart, flight must necessarily depart.
Francesco must also keep in mind the rule, valid for every airport, that if the runway is used (for landing or takeoff) at time , it cannot be used in the instants before and after. In other words, if a plane takes off or lands on the runway at time , no other plane can do so in the time interval on the same runway.
Francesco can't manage all of these flights and asks you for help.
If it is possible to choose a subset, possibly even all or none, of the flights to let depart that respects the constraints, print YES and an array of length made up of 0 or 1 (0 if the -th flight does not depart, 1 if it departs).
If it is not possible to find a subset of flights that respects the constraints, print NO.
You are not required to maximize the number of flights that depart.
Input data
The input file consists of:
- A line containing the integers , and .
- lines containing the integers , , and for .
- A line containing the integer .
- lines containing the integers and for .
Output data
The first line of the output file must contain only the string YES or NO.
If the first line contains YES, the second line must contain values, each a 0 or a 1, indicating whether each flight departs or not.
Constraints and clarifications
- .
- .
- .
- for each .
- and for each .
- At each airport, the departure and arrival times of all the flights are pairwise distinct.
- .
- and for each .
| # | Score | Constraints |
|---|---|---|
| 0 | 0 | Examples. |
| 1 | 15 | . |
| 2 | 20 | . |
| 3 | 30 | . |
| 4 | 35 | No additional restrictions. |
Example
stdin
3 4 2
0 1 1 10
1 2 2 12
1 20 0 30
2 5 1 11
2
0 1
3 2
stdout
YES
0 1 1 0
Example
stdin
3 3 5
0 10 1 100
1 98 2 200
0 12 2 202
3
0 1
1 2
0 2
stdout
NO
Explanation
In the first sample case Francesco can let flights and depart, which satisfies both constraints. Flights and cannot both depart, because they land at airport at times and , at most instants apart.
In the second sample case every two flights use the same runway at most instants apart (flights and at airport , flights and at airport , flights and at airport ), so at most one flight can depart. However, the three constraints require at least two of the three flights to depart. Therefore, the answer is NO.