The first line contains an integer \(C\) (\(1 \le C \le 50\)), indicating the number of test cases.
For each test case, the first line contains three integers \(n\), \(m\) and \(T\) (\(1 \le n \le 50, 0 \le m \le \min(\frac{n(n-1)}{2}, 100), 1 \le T \le 1000\)). In the next \(m\) lines, each contains four integers \(u_i\), \(v_i\), \(a_i\), \(b_i\) (\(1 \le u_i, v_i \le n, u_i \ne v_i, 1 \le a_i, |b_i| \le 1000\)), which means this edge connects vertex \(u_i\) and \(v_i\).
From time 0 to time \(T\), \(a_i + b_i \cdot t\) is always larger than or equal to 0.
There's at most one edge between each pair of vertexes.