#ABC259D. [ABC259D] Circumferences

[ABC259D] Circumferences

Score : 400400 points

Problem Statement

You are given NN circles on the xyxy-coordinate plane. For each i=1,2,,Ni = 1, 2, \ldots, N, the ii-th circle is centered at (xi,yi)(x_i, y_i) and has a radius of rir_i.

Determine whether it is possible to get from (sx,sy)(s_x, s_y) to (tx,ty)(t_x, t_y) by only passing through points that lie on the circumference of at least one of the NN circles.

Constraints

  • 1N30001 \leq N \leq 3000
  • 109xi,yi109-10^9 \leq x_i, y_i \leq 10^9
  • 1ri1091 \leq r_i \leq 10^9
  • (sx,sy)(s_x, s_y) lies on the circumference of at least one of the NN circles.
  • (tx,ty)(t_x, t_y) lies on the circumference of at least one of the NN circles.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

sxs_x sys_y txt_x tyt_y

x1x_1 y1y_1 r1r_1

x2x_2 y2y_2 r2r_2

\vdots

xNx_N yNy_N rNr_N

Output

If it is possible to get from (sx,sy)(s_x, s_y) to (tx,ty)(t_x, t_y), print Yes; otherwise, print No. Note that the judge is case-sensitive.

4
0 -2 3 3
0 0 2
2 0 2
2 3 1
-3 3 3
Yes

Here is one way to get from (0,2)(0, -2) to (3,3)(3, 3).

  • From (0,2)(0, -2), pass through the circumference of the 11-st circle counterclockwise to reach (1,3)(1, -\sqrt{3}).
  • From (1,3)(1, -\sqrt{3}), pass through the circumference of the 22-nd circle clockwise to reach (2,2)(2, 2).
  • From (2,2)(2, 2), pass through the circumference of the 33-rd circle counterclockwise to reach (3,3)(3, 3).

Thus, Yes should be printed.

3
0 1 0 3
0 0 1
0 0 2
0 0 3
No

It is impossible to get from (0,1)(0, 1) to (0,3)(0, 3) by only passing through points on the circumference of at least one of the circles, so No should be printed.