#include using namespace std; #define tsolve int t; cin >> t; while (t--) solve #define all(x) ::begin(x), ::end(x) #define sz(x) (ll)::size(x) using ll = long long; using ld = long double; struct circ { ll x, y, r; }; ll n; vector cs; vector> adj; vector vis, col; tuple dfs(ll c, bool cc) { if (vis[c]) { return { cc == col[c], 0, 0 }; } vis[c] = true; col[c] = cc; bool cv = true; ll cw = 0; ll cb = 0; if (cc) ++cw; else ++cb; for (ll u : adj[c]) { auto [uv, uw, ub] = dfs(u, !cc); cv &= uv; cw += uw; cb += ub; } return { cv, cw, cb }; } void solve() { cin >> n; cs.resize(n); for (circ& c : cs) { cin >> c.x >> c.y >> c.r; } adj.resize(n); for (ll i = 0; i < n; ++i) { for (ll j = i + 1; j < n; ++j) { ll dx = cs[j].x - cs[i].x; ll dy = cs[j].y - cs[i].y; ll rsum = cs[i].r + cs[j].r; if (dx * dx + dy * dy == rsum * rsum) { adj[i].push_back(j); adj[j].push_back(i); } } } vis.resize(n); col.resize(n); for (ll i = 0; i < n; ++i) { auto [v, w, b] = dfs(i, col[i]); if (v && (w != b)) { cout << "YES\n"; return; } } cout << "NO\n"; } int main() { cin.tie(0)->sync_with_stdio(false); cout << setprecision(16); solve(); }