Circulation
Let's define a circulation as a flow with a total magnitude of 0. You are given a directed graph with specified lower and upper capacity limits. For any pair of vertices i and j, the flow f_ij must satisfy the condition l_ij ≤ f_ij ≤ c_ij, where l_ij is the lower bound and c_ij is the upper bound.
Your task is to determine if there exists a circulation in the graph that meets these constraints.
Input
The first line of the input contains two integers, N and M (1 ≤ N ≤ 200, 0 ≤ M ≤ 15000). This is followed by M lines, each describing an edge in the graph. Each line consists of four positive integers: i, j, l_ij, and c_ij (0 ≤ l_ij ≤ c_ij ≤ 10^5). These integers indicate an edge from vertex i to vertex j with a lower bound l_ij and an upper bound c_ij. It is guaranteed that if there is an edge from i to j, there will not be an edge from j to i.
Output
If no circulation satisfies the constraints, output NO. If a valid circulation exists, output YES on the first line. Then, for each of the M edges, output the flow magnitude on a separate line, corresponding to the order of edges in the input. Remember, for each edge from i to j, the flow must satisfy l_ij ≤ f_ij ≤ c_ij.