No such element error, while on custom input the output is correct

I have tried to solve a problem using java ; problem code: INQU2101.
When try to run my code on custom input it is giving the desired output but, when I try to run without custom input it shows error.
Also I am facing the same issue for some other questions on codechef.
My code and error message is given below:

Question:

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

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

/* Name of the class has to be “Main” only if the class is public. */
public class codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = Integer.parseInt(sc.next());

	while(t-- > 0)
	{
	    int n = Integer.parseInt(sc.next());
	    
	    while(n-- > 0)
	    {
	        System.out.print("7");
	    }
	    System.out.println();
	}
}

}

Error :