#include using namespace std; using ll = long long; struct Circle { int x, y, r; }v[1005]; int n, c[1005], nrc[2], ok; vector G[1005]; bool used[1005]; bool intersect(int a, int b) { ll sumR = 1LL * v[a].r * v[a].r + 2LL * v[a].r * v[b].r + 1LL * v[b].r * v[b].r; int dx = v[a].x - v[b].x; int dy = v[a].y - v[b].y; ll dist = 1LL * dx * dx + 1LL * dy * dy; return (dist == sumR); } void dfs(int nod, int currC) { c[nod] = currC; used[nod] = 1; nrc[currC]++; for (int vecin : G[nod]) { if (used[vecin]) { if (c[nod] == c[vecin]) { ok = 0; } continue; } dfs(vecin, 1 - currC); } } int main() { #ifdef HOME freopen("test.in", "r", stdin); freopen("test.out", "w", stdout); #endif // HOME cin.tie(NULL); ios::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; i++) { cin >> v[i].x >> v[i].y >> v[i].r; } for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (intersect(i, j)) { G[i].push_back(j); G[j].push_back(i); //cerr << i << ' ' << j << '\n'; } } } int ans = 0; for (int i = 1; i <= n; i++) { if (used[i]) { continue; } ok = 1; nrc[0] = 0; nrc[1] = 0; dfs(i, 1); if (ok && nrc[0] != nrc[1]) { ans = 1; } } if (ans) { cout << "YES"; } else { cout << "NO"; } return 0; }