#include using namespace std; int n, cnt1, cnt2; bool isgood; vector x, y, r, color; vector> graph; void dfs(int v){ if(color[v] == 1) cnt1++; else if(color[v] == 2) cnt2++; else assert(false); for(auto e : graph[v]){ if(color[e] == 0){ color[e] = color[v] == 1 ? 2 : 1; dfs(e); } else if(color[e] == color[v]){ isgood = false; } } } void solve(){ cin >> n; x = y = r = color = vector(n, 0); for(int i = 0; i < n; i++){ cin >> x[i] >> y[i] >> r[i]; } graph.assign(n, {}); for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ long long dist = 1ll * (x[i] - x[j]) * (x[i] - x[j]) + 1ll * (y[i] - y[j]) * (y[i] - y[j]); if(dist == 1ll * (r[i] + r[j]) * (r[i] + r[j])){ graph[i].push_back(j); graph[j].push_back(i); } } } for(int i = 0; i < n; i++){ if(color[i] == 0){ cnt1 = cnt2 = 0; isgood = true; color[i] = 1; dfs(i); if(isgood && cnt1 != cnt2){ cout << "YES"; return; } } } cout << "NO"; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); int t = 1; // cin >> t; // comment if not multitest while(t--) solve(); }