#include "bits/stdc++.h" using namespace std; using LL = long long; using ll = long long; #define all(x) begin(x),end(x) LL SQ(LL x) { return x * x; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector> pt(n); for (auto& [x, y, r] : pt) { cin >> x >> y >> r; } auto istan = [&](int i, int j) -> bool { LL d = 0; d += SQ(pt[i][0] - pt[j][0]); d += SQ(pt[i][1] - pt[j][1]); return d == SQ(pt[i][2] + pt[j][2]); }; vector> adj(n); for (int i = 0; i < n; ++i) { for (int j = i+1; j < n; ++j) { if (istan(i, j)) { adj[i].push_back(j); adj[j].push_back(i); } } } vector vis(n, 2); array cnt; auto setcol = [&](int v, int c) { vis[v] = c; ++cnt[c]; }; auto dfs = [&](auto&& self, int v) -> bool { for (int u : adj[v]) { if (vis[u] == vis[v]) return false; if (vis[u] == (vis[v] ^ 1)) continue; else { setcol(u, vis[v] ^ 1); bool o = self(self, u); if (!o) return false; } } return true; }; for (int i = 0; i < n; ++i) { if (vis[i] == 2) { cnt[0] = cnt[1] = 0; setcol(i, 0); if (dfs(dfs, i)) { if (cnt[0] != cnt[1]) { cout << "YES\n"; return 0; } } } } cout << "NO\n"; }