Help me in solving FIBXOR01 problem

My issue

give me the code

My code

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

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- >0){
            int a=sc.nextInt();
            int b=sc.nextInt();
            int n=sc.nextInt();
            if(n==0){
                System.out.println(a);
            }
            if(n==1){
                System.out.println(b);
            }
            else{
                System.out.println((n-1)^(n-2));
            }
        }
	}
}

Problem Link: Special Fibonacci Practice Coding Problem

in this we have to do simply first take input then then we solve that int ans=0;
if(n%3==0){
ans=a;
}
else if(n%3==1){
ans=b;
}
else if(n%3==2){
ans=a^b;
}
cout<<ans<<endl;

you can exactly get output