#include using namespace std; using i64 = int64_t; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; struct Circle { int x, y; int r; }; auto circles = vector(n); for (auto &[x, y, r] : circles) cin >> x >> y >> r; auto touches = [&](int i, int j) { auto c0 = circles[i]; auto c1 = circles[j]; i64 dx = c0.x - c1.x; i64 dy = c0.y - c1.y; i64 d2 = dx * dx + dy * dy; i64 td = c0.r + c1.r; return d2 == (td * td); }; auto color = vector(n); int next_color = 0; auto color_sizes = vector(2 * (n + 1)); auto bad = vector(color_sizes.size()); for (int i = 0; i != n; ++i) { if (color[i]) continue; next_color += 2; auto dfs = [&](auto &&self, int i, int c) -> void { ++color_sizes[c]; color[i] = c; for (int j = 0; j != n; ++j) { if (touches(i, j)) { if (color[j]) { if (color[j] == c) { bad[c] = true; bad[c ^ 1] = true; } } else { self(self, j, c^1); } } } }; dfs(dfs, i, next_color); } for (int c = 2; c != color_sizes.size(); ++c) { if (bad[c]) continue; if (color_sizes[c] == color_sizes[c ^ 1]) continue; cout << "YES\n"; return 0; } cout << "NO\n"; }