Compute the equilibrium positions of spring-connected objects in the plane from fixed points, spring strengths, and connections.
Medium6MathMatrixNo attempts yetTime limit1sMemory limit256 MBWhen the sum of the forces acting on an object P is 0, P does not move. P is then said to be in an equilibrium state.

Figure 1. Forces acting on object P
Consider the situation in Figure 2. Two fixed points F1 and F2 lie on the x axis, and object P is attached to springs S1 and S2. Spring S1 joins F1 and P, and spring S2 joins F2 and P. Let w1 and w2 be the elastic coefficients of S1 and S2, and let x(F1) and x(F2) be the x coordinates of F1 and F2. By Hooke's law the force that S1 applies to P is w1×(x(P)−x(F1)), and the force that S2 applies to P is w2×(x(P)−x(F2)), where x(P) is the x coordinate of P.

Figure 2. An example of an equilibrium state
For example, in Figure 2 with x(F1)=0, x(F2)=7, w1=3, w2=4, and P in an equilibrium state, the position of P is determined as x(P)=4.
Now consider several objects joined by several springs in the plane, as in Figure 3. There are k fixed points F1,…,Fk, n objects P1,…,Pn, and m springs S1,…,Sm, where spring Si has elastic coefficient wi. Each spring joins a fixed point and an object, or two objects. Hooke's law holds in the plane as well: a spring with coefficient w joining points A and B applies the vector force w×(A−B) to A, and the same formula applies to the x component and to the y component separately. If every object is attached to at least two springs, all objects eventually reach an equilibrium state, and the position of every object is then determined.
Write a program that computes the positions of the n objects in the equilibrium state from the coordinates of the k fixed points, the elastic coefficients of the m springs, and the connections among objects and fixed points.

Figure 3. Another example of an equilibrium state in the plane
You can assume the following.
Read from standard input. The first line contains the number of test cases T.
The first line of each test case contains three integers k (3≤k≤100), m (3≤m≤3000), and n (1≤n≤1000), separated by blanks. Here k is the number of fixed points, m is the number of springs, and n is the number of objects.
The i-th of the next k lines contains the integer coordinates xi and yi (−10000≤xi,yi≤10000) of fixed point Fi.
The i-th of the next m lines contains three integers wi, ui, and vi. Here wi (1≤wi≤100) is the elastic coefficient of spring Si, and ui and vi are the indices of the two endpoints that Si joins. A negative ui means fixed point F−ui (1≤−ui≤k), and a positive ui means object Pui (1≤ui≤n). Read vi the same way.
Write to standard output. For each test case, first print one line holding Test case number : followed by the number of the test case. Numbering starts at 1. Then print n lines; the i-th of them holds the index i and the coordinates xi and yi of object Pi, separated by single blanks.
Print each coordinate with two digits after the decimal point, rounding at the third digit. Round away from zero, and when the rounded value is zero print 0.00 with no sign. The exact value of every answer coordinate is at least 10−6 away from a rounding boundary, so the string to print is determined.