#include using namespace std; const int N = 1000 + 3; typedef long long ll; int n; ll x[N], y[N], r[N]; vector adj[N]; bool vis[N], col[N]; int cnt[2]; bool dfs(int u, int c){ vis[u] = true; ++cnt[c]; col[u] = c; for(int to: adj[u]){ if(vis[to]){ if(col[u] == col[to]){ return false; } } else{ if(!dfs(to, c ^ 1)){ return false; } } } return true; } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 1; i <= n; ++i){ cin >> x[i] >> y[i] >> r[i]; } for(int i = 1; i <= n; ++i){ for(int j = i + 1; j <= n; ++j){ ll dist = (x[i] - x[j]) * (x[i] - x[j]); dist += (y[i] - y[j]) * (y[i] - y[j]); if(dist == (r[i] + r[j]) * (r[i] + r[j])){ adj[i].push_back(j); adj[j].push_back(i); } } } for(int i = 1; i <= n; ++i){ if(vis[i]) continue; cnt[0] = cnt[1] = 0; bool ok = dfs(i, 0); if(!ok) continue; if(cnt[0] != cnt[1]){ cout << "YES\n"; return 0; } } cout << "NO\n"; }