PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#DSU0000058. Các đường tròn (Circumferences)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Các đường tròn (Circumferences)

Circumferences

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn circles in the plane. Circle ii has center (xi,yi)(x_i,y_i) and positive radius rir_i. Two points S=(sx,sy)S=(s_x,s_y) and T=(tx,ty)T=(t_x,t_y) are given; each is guaranteed to lie on the circumference of at least one circle.

You may travel only along circumferences: every point of your path must belong to the circumference of some given circle. You may move in either direction along a circle and switch between circles at a point that lies on both circumferences. Traveling through the interior of a disk is not allowed unless those points also lie on some circumference.

Determine whether a continuous journey from SS to TT satisfying these rules exists. Tangent circles also allow a transfer at their point of tangency.

Input

The first line is nn; the second has sx,sy,tx,tys_x,s_y,t_x,t_y; the next nn lines give xi,yi,rix_i,y_i,r_i.

Output

Print Yes or No, case-sensitively.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le12; −109≤xi,yi,sx,sy,tx,ty≤109-10^9\le x_i,y_i,s_x,s_y,t_x,t_y\le10^9, 1≤ri≤1091\le r_i\le10^9; both SS and TT lie on at least one circumference.
  • Subtask 2 (30 points): 1≤n≤1801\le n\le180; −109≤xi,yi,sx,sy,tx,ty≤109-10^9\le x_i,y_i,s_x,s_y,t_x,t_y\le10^9, 1≤ri≤1091\le r_i\le10^9; both SS and TT lie on at least one circumference.
  • Subtask 3 (50 points): 1≤n≤30001\le n\le3000; −109≤xi,yi,sx,sy,tx,ty≤109-10^9\le x_i,y_i,s_x,s_y,t_x,t_y\le10^9, 1≤ri≤1091\le r_i\le10^9; both SS and TT lie on at least one circumference.

Examples

Input

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

Output

No

Explanation

Concentric circles with different radii do not intersect, so the endpoints are disconnected.