#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N = 1e6+10;
const int mod = 1e9+7;
#define all(x) (x).begin(), (x).end()
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
struct point_2d
{
ld x , y ;
point_2d operator+ ( point_2d p ){ return { p.x + x , p.y + y }; }
point_2d operator- ( point_2d p ){ return { p.x - x , p.y - y }; }
point_2d operator* ( ld d ){ return { x * d , y * d }; }
point_2d operator/ ( ld d ){ return { x / d , y / d }; }
};
struct circle{
ld r ;
point_2d c ;
};
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
vector<circle> circles;
vector<int> parent ;
//Functions:-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ld distance( point_2d a ){
return sqrt( a.x*a.x + a.y*a.y );
}
bool Can_connect( int i , int j ){
ld a = distance( circles[i].c - circles[j].c ) ;
ld b = ( circles[i].r + circles[j].r );
return ( a <= b );
cout << a << " " << b << endl;
exit(0);
if( distance( circles[i].c - circles[j].c ) <= ( circles[i].r + circles[j].r ) ) return true;
else return false;
}
int find_parent( int x ){
if( parent.size() <= x )
while( true );
if( parent[x] != x ) parent[x] = find_parent( parent[x] );
return parent[x] ;
}
int join( int x , int y ){
x = find_parent( x );
y = find_parent( y );
if( parent.size() <= y ) {
cout << y << endl;
while( true );
}
parent[y] = x ;
}
void solve(){
int n , R , k ; cin >> n >> R >> k ;
circles.clear();
circles.resize(n);
parent.clear();
parent.resize(n);
for( int i = 0 ; i < n ; i++ ){
cin >> circles[i].c.x >> circles[i].c.y >> circles[i].r ;
parent[i] = i ;
}
for( int i = 0 ; i < n ; i++ ){
for( int j = i+1 ; j < n ; j++ ){
if( Can_connect( i , j ) ){
join( i , j );
exit(0);
}
}
}
// for( int i = 0 ; i < n ; i++ )
// parent[i] = find_parent( i );
// for( int i = 0 ; i < n ; i++ )
// cout << parent[i] << " ";
cout << endl;
cout << "1111111110" << endl;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
#ifndef ONLINE_JUDGE
freopen("input.txt" , "r" , stdin );
#endif
int t ; cin >> t ;
while( t-- ) solve() ;
}
Copy