#include using namespace std; #define Dv(v) for (auto x : v) cerr << x << ' '; cerr << endl; #define D(x) cerr << #x << " = " << x << ", " using ll = long long; using vi = vector; using vvi = vector; ll dist(ll x1, ll y1, ll x2, ll y2) { return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2); } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vi x(n), y(n), r(n); for(int i = 0; i < n; ++i) cin >> x[i] >> y[i] >> r[i]; vvi edges(n); for(int i = 0; i < n; ++i) for(int j = i+1; j < n; ++j) if(dist(x[i], y[i], x[j], y[j]) == (r[i]+r[j])*(r[i]+r[j]) ) edges[i].push_back(j), edges[j].push_back(i); vi color(n, -1); for(int i = 0; i < n; ++i) if(color[i] == -1) { color[i] = 0; int siz = 1; stack s; s.push(i); bool bip = true; while(not s.empty()) { int curr = s.top(); s.pop(); for(int j: edges[curr]) { bip &= color[curr] != color[j]; if(color[j] == -1) { color[j] = !color[curr]; s.push(j); siz++; } } } if(bip and siz%2 == 1) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; }