You are given a set of grid points in the plane (points whose two Cartesian coordinates are both integers); we call this set the pattern. You are also given a family of other sets of grid points in the plane.
For each set, decide whether it is similar to the pattern, i.e. whether it can be turned into a set identical to the pattern by some combination of rotations, translations, reflections and dilations (scalings).
For example, the set {(0,0),(2,0),(2,1)} is similar to the set {(6,1),(6,5),(4,5)}, but it is not similar to the set {(4,0),(6,0),(5,−1)}.
Write a program that:
The first line contains a single integer k (1≤k≤25000) — the number of points in the pattern. Each of the next k lines contains two integers separated by a single space; the i-th of them holds the coordinates xi and yi (−20000≤xi,yi≤20000) of the i-th pattern point. The points of the pattern are pairwise distinct.
The next line contains the number of sets to investigate, n (1≤n≤20). Then follow the descriptions of the n sets. Each description begins with a line containing a single integer l (1≤l≤25000) — the number of points in that set. Each of the next l lines contains two integers x and y (−20000≤x,y≤20000), the coordinates of one point. The points belonging to the same set are pairwise distinct.
Print n lines, one for each investigated set. On the i-th line print TAK (Polish for “yes”) if the i-th set is similar to the pattern, or NIE (Polish for “no”) otherwise.
