Help me in solving FIBXOR01 problem

My issue

Exception in thread “main” java.util.NoSuchElementException
at java.base/java.util.Scanner.throwFor(Scanner.java:937)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Codechef.main(Main.java:10)
how to resolve this?

My code

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    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();
	        System.out.println(fib(a,b,n));
	        t--;
	    }
	}
public static int fib(int a,int b,int n){
    if(n%3==0){
	        return (a);
	    }
	    else if(n%3==1){
	        return (b);
	    }
	    else {
	        return a^b;
	    }
	}
}

Problem Link: https://www.codechef.com/problems/FIBXOR01/

@supriyasbg19
the value of n is big uptil 10^9 so this logic won’t work.
Hint:- try for some smaller values from starting u will get a pattern which can be computed mathematically.