#include using namespace std; #define ll long long const int N=1050; vector E[N]; int col[N]; bool was[N]; int x[N],y[N],r[N]; ll sq(ll x){return x*x;} #define pb push_back void AddEdge(int u,int v){ E[u].pb(v); E[v].pb(u); } bool cyc; int cnt[2]; void DFS(int u){ was[u]=true; cnt[col[u]]++; for(int v:E[u]){ if(!was[v]){ col[v]=col[u]^1; DFS(v); }else{ if(col[u]==col[v])cyc=true; } } } int main(){ int n; scanf("%i",&n); for(int i=1;i<=n;i++){ scanf("%i %i %i",&x[i],&y[i],&r[i]); } for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ ll d2=sq(x[i]-x[j])+sq(y[i]-y[j]); ll rs=sq(r[i])+sq(r[j])+(ll)2*r[i]*r[j]; if(d2==rs){ AddEdge(i,j); } } } bool ok=false; for(int i=1;i<=n;i++){ if(!was[i]){ cyc=false; cnt[0]=cnt[1]=0; DFS(i); if(cnt[0]!=cnt[1] && !cyc)ok=true; } } if(ok)printf("YES\n"); else printf("NO\n"); return 0; }