#include typedef long long ll; struct C { int x, y; int r; }; int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); int n; std::cin >> n; std::vector a(n); for (int i = 0; i < n; i++) { std::cin >> a[i].x >> a[i].y >> a[i].r; } std::vector > g(n); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { ll dst = (ll) (a[i].x - a[j].x) * (a[i].x - a[j].x) + (ll) (a[i].y - a[j].y) * (a[i].y - a[j].y); if (dst == (ll) (a[i].r + a[j].r) * (a[i].r + a[j].r)) { g[i].push_back(j); g[j].push_back(i); } } } for (int i = 0; i < n; i++) { if (!g[i].size()) { std::cout << "YES\n"; return 0; } } std::vector vis(n, false); std::vector cc(n, 0); auto dfs = [&] (auto&& self, int node, int c = 1) -> std::pair { assert(!vis[node]); vis[node] = true; cc[node] = c; std::pair res = { true, c }; for (int x : g[node]) { if (vis[x] && cc[x] == c) { return { false, 0 }; } if (vis[x]) continue; auto p = self(self, x, c * -1); if (!p.first) return p; res.second += p.second; } return res; }; for (int i = 0; i < n; i++) { if (vis[i]) continue; auto p = dfs(dfs, i); if (p.first && p.second) { std::cout << "YES\n"; return 0; } } std::cout << "NO\n"; }