Kingdom Reunion

Time limit1sMemory limit128 MB

Problem

Kalvin John Ian Helvik IV and Karl James Ingram Helvik III are second cousins and the kings of two neighbouring countries, Aastria and Abstria. One hundred years ago these lands formed a single kingdom, but when old King Helvik died he left the country to his twin sons, Ian and Ingram. Nobody knew how to divide it, until it was proposed to split the land into two equal parts. The task proved impossibly hard, five attempts to solve it failed, and a bloody civil war broke out.

The war lasted seven years and ended with the Northeastern Enormously Ragged Combat. By its final decree, two new countries rose in place of the old one, one for Ian and one for Ingram. But the two countries had unequal areas, so within three years war began again.

After ninety years of fighting, both countries were exhausted. Realizing that neither would survive another year of war, the two kings simultaneously sent envoys with offers of peace and agreed to unite their lands once more. The reunited country of Aastria and Abstria was named Aabstria.

In old manuscripts you have found several descriptions of the countries' borders. Each description lists the positions of one country's boundary monuments, given in clockwise or counterclockwise order along the border. Different sources disagree, and in some of them the border does not even form a polygon. Given the monument positions of all three countries, the following statements must hold:

  • For each country, the closed polyline through its boundary monuments must be a polygon: it must have at least three vertices, a non-zero area, and no self-intersections, self-touches, or holes.
  • The interiors of the Aastria and Abstria polygons must not intersect.
  • The union of Aastria and Abstria must be exactly equal to Aabstria.

Write a program that checks whether all of these statements are true.

Input

The first line contains an integer $n_a$ ($1 \le n_a \le 10000$), the number of boundary monuments of Aastria. Each of the next $n_a$ lines contains two integers, the coordinates of one monument, listed in clockwise or counterclockwise order along the border.

After that, the descriptions of Abstria and then Aabstria are given in the same format.

Every coordinate has absolute value at most $10^5$. Two boundary monuments may coincide only if they belong to different countries.

Output

Print a single line containing exactly one of the following strings:

  • if the boundary monuments of Aastria do not form a polygon, print Aastria is not a polygon;
  • otherwise, if the boundary monuments of Abstria do not form a polygon, print Abstria is not a polygon;
  • otherwise, if the boundary monuments of Aabstria do not form a polygon, print Aabstria is not a polygon;
  • otherwise, if the interiors of Aastria and Abstria intersect, print Aastria and Abstria intersect;
  • otherwise, if the union of Aastria and Abstria is not equal to Aabstria, print The union of Aastria and Abstria is not equal to Aabstria;
  • otherwise, print OK.