Help me in solving COMPLEXITY problem

My issue

Exception in thread “main” java.util.NoSuchElementException
at java.base/java.util.Scanner.throwFor(
at java.base/
at java.base/java.util.Scanner.nextInt(
at java.base/java.util.Scanner.nextInt(
at Codechef.main(

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
		// your code goes here
		Scanner sc=new Scanner(;
		int t=sc.nextInt();
		for(int i=1;i<=t;i++)
		    int n=sc.nextInt();
		    int m=sc.nextInt();
	        if(n>m) System.out.println("YES");
	        else System.out.println("NO");

Problem Link: COMPLEXITY Problem - CodeChef