"Wang the old man had a piece of land ..." An old folk rhyme of Taiwan goes. There is actually a story behind this.
Long before, Wang had a large field, which is of a SIMPLE polygon shape. On each corner of the field there is a pole, and ropes are tangled around the poles so that they surround the field. Wang is a man of kind temper, but his two sons on the otherhand, are both ignorant, lazy young man. At the day Wang passed away, the two sons of him immediately begins fighting for inheritance of the field. But after hours passed, the two still cannot come up with any agreeable solution to divide the land.
Fortunately, old man Tang from the village is a kind-hearted man. Seeing the two fighting, he had an idea in mind.
"Hold it, young man! I have a good idea. I happen to have an extra pole here in my pocket. So maybe the two of you can move the pole on one of the field's corners, so that the resulting polygon (field) will be line symmetric. That way you can easily divide the land!"
Despite his kindness, old Mr. Tang is not too clever, though, it never occured to him that the task may not be accomplished. So, given the shape of the field, determine for the pair of ungraceful brothers, whether moving one pole (or less) is enough to make the polygon LINE symmetric.
By the way, after moving the pole, the resulting field must still remain SIMPLE.
The first line contain an integer T --- the number of tests(1<=T<=40).
Each test begins with one line only contains one integer n(3<=n<=1000), denoting the number of poles in Wang's field.
Then Following n lines,the i-th line contains two numbers xi, yi, (xi, yi) is the coordinator of i-th pole. And for any 1<=i<n, i-th pole is connected to (i+1)-th pole by rope. Also, the n-th pole is connected to first pole.
All coordinator values are integers and range from -1000 to 1000(include).
For each test, if Mr. Tang can move one pole so that the polygon LINE is symmetric, print 'Y', otherwise print 'N'.(the final polygon also have to be simple polygon).
3 3 1 1 1 2 2 2 4 1 1 1 2 2 2 2 1 7 10 0 5 1 6 2 2 3 2 8 11 7 8 5
Y Y N
Migrated from old NTUJ.
dreamoon
No. | Testdata Range | Score |
---|