#pragma GCC optimize "O3" #include using namespace std; using LL=long long; #define FOR(i,l,r) for(int i=(l);i<=(r);++i) #define REP(i,n) FOR(i,0,(n)-1) #define ssize(x) int(x.size()) #ifdef DEBUG auto&operator<<(auto&o,pairp){return o<<"("<decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<sync_with_stdio(0); int n; cin >> n; vector x(n), y(n), r(n); REP(i, n) cin >> x[i] >> y[i] >> r[i]; auto kw = [&](int g) { return g * LL(g); }; vector> graph(n); REP(i, n) REP(j, n) if(i != j and kw(x[i] - x[j]) + kw(y[i] - y[j]) == kw(r[i] + r[j])) { graph[i].emplace_back(j); } vector comp; vector color(n, -1); function dfs = [&](int v) { comp.emplace_back(v); for(int u : graph[v]) if(color[u] == -1) { color[u] = not color[v]; dfs(u); } }; auto yes = [&] { cout << "YES\n"; exit(0); }; REP(v, n) if(color[v] == -1) { color[v] = 0; comp.clear(); dfs(v); assert(not comp.empty()); auto is_dwudzielny = [&] { for(int u : comp) for(int w : graph[u]) if(color[u] == color[w]) return false; return true; }; if(not is_dwudzielny()) continue; array cnt = {0, 0}; for(int u : comp) ++cnt[color[u]]; if(cnt[0] != cnt[1]) yes(); } cout << "NO\n"; }