Need help in debugging. code works for sample input but gets WC when submitted

Hi fellow coders!

Please help me debug the below logic. The code gives correct answers for various sample inputs but gets WA when submitted!
Problem code : TTP (CodeChef: Practical coding for everyone)

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

/* Name of the class has to be int"Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{

	BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
	
	int H = -1; int M = -1; int X = -1;
        int inputLineCount = Integer.parseInt(bi.readLine());
	int factor = -1; int rem = -1;int hour = -1;

	for(int i=0;i<inputLineCount;i++)
	{

	int[] hmx = Arrays.stream(bi.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();

	H = hmx[0]; M = hmx[1]; X = hmx[2];

	if(X<=5){
	    System.out.println(H+" "+M);
	}

	else if ((X+M)<65){
	    System.out.println((H)+" "+(M+X-5));
           }

	else if (((X+M)>=65)){
	    factor = (X+M-5)/60;
	    rem = (X+M-5)%60;
	    
	     if((H+factor)>=24) hour = (H+factor)%24;
	     else hour = H+factor;
	 
	    System.out.println(hour+" "+rem);
	}
	}
    
}

}