#pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,popcnt") #include "bits/stdc++.h" // #include using namespace std; #define rep(i,a,b) for(int i=(a); i<(b); ++i) #define all(x) x.begin(),x.end() #define sz(x) int(x.size()) typedef long long ll; typedef unsigned long long ull; typedef vector vi; typedef vector vvi; const int D = 25.4*2*10, B = 2108; // alignas(32) long long typedef complex pt; #define X real() #define Y imag() ll N(pt p){ return (ll)p.X*p.X + (ll)p.Y*p.Y; } struct ptcomp{ bool operator()(const pt& a, const pt& b) const { if (a.X != b.X) return a.X < b.X; return a.Y < b.Y; } }; void noPE(){ cout << "no\n"; exit(0); } int main(){ cin.tie(NULL),ios::sync_with_stdio(false); map, ptcomp> blocks; int n; cin >> n; vector> a(n); vvi adj(n); rep(i,0,n){ int x,y,d; cin >> x >> y >> d; x*=10,y*=10,d*=5; blocks[{x/B,y/B}].push_back(i); a[i] = {{x,y},d}; } for(auto [k,v] : blocks){ rep(dx,-1,2) rep(dy,-1,2){ pt ot = k + pt{dx,dy}; if (blocks.count(ot)) for(auto oi : blocks[ot]){ for(auto i : v) if (oi != i){ int mxd = (D+a[i].second+a[oi].second); if (N(a[i].first - a[oi].first) <= mxd*mxd){ adj[i].push_back(oi); } } } } } vi vis(n); auto dfs = [&](int at, auto&& dfs) -> void { vis[at] = 1; for(auto to : adj[at]) if (!vis[to]){ dfs(to,dfs); } }; dfs(0,dfs); if (count(all(vis),0)) noPE(); if (n >= 7) rep(i,0,n) if (sz(adj[i]) < 2) noPE(); cout << "yes\n"; }