@@ -0,0 +1,2043 @@
+%0A%0A%0Aimport java.io.InputStreamReader;%0Aimport java.io.OutputStreamWriter;%0Aimport java.io.BufferedReader;%0Aimport java.io.BufferedWriter;%0A%0Apublic class Main %7B%0A%0A    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));%0A    public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));%0A    public static int nums%5B%5D = new int%5B100001%5D;%0A    public static void main(String argsp%5B%5D)throws Exception%7B%0A    for(int i =0; i%3C 100001; i++)%7B%0A        nums%5Bi%5D = -1;%0A    %7D%0A    nums%5B1%5D=1;%0A    int testCase = Integer.parseInt(in.readLine());%0A    %0A    while(testCase--!=0)%7B%0A        int init = Integer.parseInt(in.readLine());%0A        HSN(init,init);%0A        out.write((int)nums%5Binit%5D+%22%5Cn%22);%0A        %0A    %7D%0A    %0A    in.close();%0A    out.close();%0A    %7D%0A    public static int HSN(int init, int index)%7B%0A        if(init ==1)return 1;%0A        if(canDP(init)&&nums%5Binit%5D==-1)%7B%0A            //%EA%B3%84%EC%82%B0%0A            if(init%252==0)%7B%0A                int tmp = HSN(init/2,index);%0A                if(tmp%3Einit)%7B%0A                    nums%5Bindex%5D=tmp;%0A                    return tmp;%0A                %7Delse%7B %0A                    nums%5Bindex%5D=init;%0A                    return init;%0A                    %7D%0A            %7Delse%7B%0A                int tmp =HSN(init*3 +1,index);%0A                nums%5Bindex%5D=tmp;%0A                return tmp;%0A            %7D%0A        %7D%0A        else if(canDP(init)&&nums%5Binit%5D!=-1)%7B%0A            return nums%5Binit%5D;%0A        %7Delse%7B%0A            if(init%252==0)%7B%0A                int tmp = HSN(init/2,index);%0A                if(tmp%3Einit)%7B%0A                    nums%5Bindex%5D=tmp;%0A                    return tmp;%0A                %7Delse%7B %0A                    nums%5Bindex%5D=init;%0A                    return init;%0A                    %7D%0A            %7Delse%7B%0A                int tmp =HSN(init*3 +1,index);%0A                nums%5Bindex%5D=tmp;%0A                return tmp;%0A            %7D%0A        %7D%0A        %0A    %7D%0A    public static boolean canDP(int init)%7B%0A        boolean dp =false;%0A        if(init%3C=100001) dp =true;%0A        return dp;%0A    %7D%0A%7D%0A%0A

solve haileStone?