Help me in solving TRANSFORM problem

My issue

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	public static void main (String[] args) throws java.lang.Exception
			Scanner s=new Scanner(;
		int t=s.nextInt();
		for(int i=0;i<t;i++)
		 int x=s.nextInt();

Problem Link: TRANSFORM Problem - CodeChef

The logic is it is at normal position initially .
if we increase 3 time or any multiple of 3 it will be same and if the %3 is 2 or 1 then it would be small and huge respectively.