I - ほくろ 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 6

注意

この問題に対する言及は、2021/7/17 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。

問題文

2 次元平面上に、高橋君の似顔絵がありました。 似顔絵には右目と左目と N 個のホクロが描かれており、

  • E \gt 0 として、右目の座標は (-E, 0)、左目の座標は (E, 0)
  • i 個目のホクロの座標は (A_i, B_i)

でした。

いたずら好きな青木君が、高橋君の似顔絵を(裏返すことなく)移動させてしまいました。 より正確には、似顔絵に平行移動と回転移動を施しました。

その結果、

  • 右目の座標は (x_1, y_1)、左目の座標は (x_2, y_2)
  • i 個目のホクロの座標は (a_i, b_i)

となりました。

移動後の両目とホクロの座標が与えられるので、移動前のホクロの座標を求めてください。 すなわち、(A_1, B_1), \dots , (A_N,B_N) を求めてください。

なお、移動前の両目の座標、すなわち E は与えられないことに注意してください。

制約

  • 1 \leq N \leq 2 \times 10^5
  • -10^5 \leq x_i, y_i, a_i, b_i \leq 10^5
  • E \gt 0
  • (x_1, y_1), (x_2, y_2), (a_1, b_1), \dots , (a_N,b_N) は相異なる。
  • (-E, 0) \neq (x_1, y_1) または (E, 0) \neq (x_2, y_2)
  • 入力に含まれる値は全て整数である。

入力

入力は以下の形式で標準入力から与えられる。

N
x_1 y_1
x_2 y_2
a_1 b_1
:
a_N b_N

出力

出力は N 行からなる。 i 行目には、i 個目のホクロの移動前の座標を以下の形式で出力せよ。 出力されたそれぞれの値について、想定解答との絶対誤差または相対誤差が 10^{-5} 以下であれば正解と判定される。

A_1 B_1
:
A_N B_N

入力例 1

2
5 0
-5 0
-1 3
2 4

出力例 1

1 -3
-2 -4

入力では、移動後の両目とホクロの座標が与えられます。


入力例 2

4
4 4
12 10
12 4
8 7
-4 -2
100 10

出力例 2

1.4 -4.8
0 0
-15 0
75.4 -52.8

入力される値は全て整数ですが、出力する値や E は整数とは限らないことに注意してください。


入力例 3

10
-40336 -25353
25518 98473
-66200 57666
23235 -64774
56870 -67151
-99509 73639
39965 -61027
-54385 -34598
-57063 14129
63186 -88708
88770 85106
-92520 69200

出力例 3

-8970.87249328212 61817.21737274555
-75079.28924877638 -74637.35403870217
-61384.55754506934 -105449.9760881721
-10508.55928227892 98726.04733711783
-63915.43362406853 -87648.93490309674
-84883.41976667292 8062.914405771756
-43119.58914921946 33307.21406245974
-77451.63868397648 -121148.543178062
88022.56926540422 -62121.98851386775
-11146.07084342446 90471.08392051774

Score : 6 points

Warning

Do not make any mention of this problem until July 17, 2021, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).

Problem Statement

There was a portrait of Takahashi on a two-dimensional plane. It consisted of the right eye, the left eye, and N moles, at the following positions.

  • The right eye was at the coordinates (-E, 0), and the left eye was at the coordinates (E, 0), where E \gt 0.
  • The i-th mole was at the coordinate (A_i, B_i).

However, a mischievous boy Aoki moved this portrait (without flipping it). More formally, he translated and rotated the portrait.

As a result, the parts moved to the following positions:

  • The right eye moved to the coordinates (x_1, y_1), and the left eye moved to the coordinates (x_2, y_2).
  • The i-th mole moved to the coordinate (a_i, b_i).

Given the coordinates of the eyes and the moles after the move, find the coordinates of the moles before the move, that is, (A_1, B_1), \dots, (A_N, B_N).

Note that the given values do not contain the coordinates of the eyes before the move, that is, E.

Constraints

  • 1 \leq N \leq 2 \times 10^5
  • -10^5 \leq x_i, y_i, a_i, b_i \leq 10^5
  • E \gt 0
  • (x_1, y_1), (x_2, y_2), (a_1, b_1), \dots, (a_N, b_N) are distinct.
  • (-E, 0) \neq (x_1, y_1) or (E, 0) \neq (x_2, y_2).
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
a_1 b_1
:
a_N b_N

Output

Print N lines. The i-th line should contain the coordinates of the moles before the move in the format shown below. Your output will be considered correct when, for each value printed, the absolute or relative error from our answer is at most 10^{-5}.

A_1 B_1
:
A_N B_N

Sample Input 1

2
5 0
-5 0
-1 3
2 4

Sample Output 1

1 -3
-2 -4

In the figure below, "移動前" and "移動後" mean before and after the move, "右目" and "左目" mean right and left eyes, and "ホクロ1個目" and "ホクロ2個目" means the first and second moles.

Given in input are the coordinates of both eyes and the moles after the move.


Sample Input 2

4
4 4
12 10
12 4
8 7
-4 -2
100 10

Sample Output 2

1.4 -4.8
0 0
-15 0
75.4 -52.8

All values in input are integers, but note that the values to be printed and E may not be integers.


Sample Input 3

10
-40336 -25353
25518 98473
-66200 57666
23235 -64774
56870 -67151
-99509 73639
39965 -61027
-54385 -34598
-57063 14129
63186 -88708
88770 85106
-92520 69200

Sample Output 3

-8970.87249328212 61817.21737274555
-75079.28924877638 -74637.35403870217
-61384.55754506934 -105449.9760881721
-10508.55928227892 98726.04733711783
-63915.43362406853 -87648.93490309674
-84883.41976667292 8062.914405771756
-43119.58914921946 33307.21406245974
-77451.63868397648 -121148.543178062
88022.56926540422 -62121.98851386775
-11146.07084342446 90471.08392051774