Problem D

Intelligent Cats

Input: standard input

Output: standard output

Time Limit: 2 seconds

 

One day two cats found a large piece of cake. One of them jumped at it and picked it up. Another one tried to snatch it from him. The first cat said, "Keep away from me. It is my cake. I was the first to pick it up." The other cat said, "But I saw it first and so it is mine." Just then a monkey was passing by. The cats requested him to act as judge and settle their quarrel. The monkey said, "I will make two equal parts of the cake and give a part to each one of you. Give me the cake." The monkey took the cake and made two parts. Then he shook his head and said, "These two parts are not equal. This one is bigger than the other one." He ate a bit of the bigger part. But again the parts were not equal. So he ate a bit of the bigger part again to make the two parts equal. This went on till only two tiny bits of the cake were left. Then the monkey said to the cats, "How can I give such tiny bits? I will eat them myself." So saying, he put those tiny bits into his mouth and went away.

Like the above story, Mimi and Rimi have also found a nice pizza of convex shape. But instead of quarrelling, they decide to go to their master, Kalix. Kalix finds that it will be a difficult job to exactly divide the pizza by a knife. But if he models the pizza as a Convex polygon, then a computer program can solve the problem. Now the pizza can be exactly divided in many ways. So he fixes a point on the edge of the pizza and he wants another point on the edge of the pizza, so that the line segment joining the two points exactly divides the polygon.

Input

Each dataset starts with a positive integer, N (3<=N<=30) denoting the number of vertices of the convex shaped pizza. In the following few lines there will be N pair of integers which will model the pizza as a convex polygon. The points will be in counter clockwise order. Next there will be one integer K which is the number of fixed points. Then the coordinates of the fixed points will be given. As specified in the statement the fixed points will be on the edge of the polygon.The absolute value of each coordinate will not cross 100. Input is terminated by EOF.


Output

For each fixed point in a dataset print the coordinates of the other point. As exact division is required, you should print the coordinates in fractional (n/d) form with appropiate minimization. If n is zero, use 1 for d and if any coordinate becomes negative use negative numerator. See sample output for exact format.

 

Sample Input

4 0 0 10 0 10 10 0 10 2 5 0 0 5 3 0 0 10 0 0 10 2 0 0 5 5

Sample Output

(5/1),(10/1) (10/1),(5/1) (5/1),(5/1) (0/1),(0/1)

Author : Md. Kamruzzaman

The Real Programmers' Contest-2