Why is this code telling NZEC ERROR?

Here is the code for the Football Match problem

Link

It’s telling NZEC Error. Can somebody help me
import java.util.*;

class fmat {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		HashMap<String,Integer> map;
		while(t-->0){
			map = new HashMap<String,Integer>();
			int n = in.nextInt();
			String x = in.next();
			String s = null,temp=null;
			map.put(x, 1);
			while(--n>0){
				s = in.next();
				if(!s.equals(x)){
					temp = s;
				}
				if(map.containsKey(s)){
					map.put(s,map.get(s)+1);
				}else{
				map.put(s,1);}
			}
			if(map.get(x)>map.get(s)){
				System.out.println(x);
			}
			else if(map.get(x)==map.get(temp)){
				System.out.println("Draw");
			}
			else{
				System.out.println(temp);
			}
			
		}
		in.close();
		return ;
	}
}

n can be equal to zero.

tried that still same error