#include using namespace std; const int NMAX = 1100; vector adj[NMAX]; int viz[NMAX]; int color[NMAX]; bool Dfs(int node, int col, int& nr_me, int& nr_not_me) { viz[node] = 1; color[node] = col; nr_me++; bool ok = 1; for (auto i : adj[node]) { if (!viz[node]) { ok &= Dfs(i, 1 - col, nr_not_me, nr_me); } else ok &= color[i] != color[node]; } return ok; } typedef long long i64; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector > points(n); for (auto& [x, y, r] : points) cin >> x >> y >> r; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { auto [x1, y1, r1] = points[i]; auto [x2, y2, r2] = points[j]; if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) == r1 + r2) adj[i].push_back(j), adj[j].push_back(i); } } bool possible = false; for (int i = 0; i < n; i++) { if (!viz[i]) { int nr1 = 0, nr2 = 0; if (Dfs(i, 0, nr1, nr2)) { if (nr1 != nr2) possible = 1; } } } cout << (possible ? "YES\n" : "NO\n"); }