import java.util.*; public class Wheels { static Wheel[] wheels; // storing all the // alternative way public static class Wheel{ int x,y,radius; int p,q; //int index; // the index of the wheels adjacent to it? boolean isClock; boolean visited; ArrayList adj; // store the wheels adjacent to it public Wheel(int nx,int ny, int nr){ x=nx; y=ny; radius = nr; visited = false; } } static boolean isTangent(Wheel w1,Wheel w2){ int r1,r2,d; r1 = w1.radius; r2 = w2.radius; d = (int) (Math.pow((w1.x-w2.x),2)+Math.pow((w1.y-w2.y),2)); int sum = (int) (Math.pow(r1+r2,2)); /*System.out.println(d); System.out.println(sum); System.out.println("-------");*/ return d==sum; } // then run bfs starting at first, every adjacent wheel has the !isClock of previous one and static void bfs(Wheel w){ if(!w.visited){ w.visited = true; for(Wheel temp:w.adj){ temp.isClock = !w.isClock; temp.p = w.radius*w.p; temp.q = temp.radius*w.q; bfs(temp); } } } static int gcd(int a, int b){ return b==0?a:gcd(b,a%b); } static String speed(int a, int b){ if(gcd(a,b)==a){ a = b/a; return Integer.toString(a); }else if(gcd(a,b)==b){ b = a/b; return Integer.toString(b); }else{ int temp = gcd(a,b); a = a/temp; b = b/temp; String s = a+"/"+b; return s; } } static void solve(){ Scanner in = new Scanner(System.in); int cases = in.nextInt(); for(int i=0;i temp1 = new ArrayList(); for(int k=0;k