I am new to java…
please help me out to avoid nzec error…
question link : http://www.codechef.com/problems/WSC
my code :-
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
int t = kb.nextInt();
//boolean ans;
while(t-->0)
{
int n = kb.nextInt();
int m = kb.nextInt();
if(m<2)
{
int x = kb.nextInt();
int y = kb.nextInt();
System.out.println("YES");
}
else if(m>2)
{
for(int i =0;i<m;i++)
{
int x = kb.nextInt();
int y = kb.nextInt();
}
System.out.println("NO");
}
else if(m==2)
{
int x = kb.nextInt();
int y = kb.nextInt();
int a = kb.nextInt();
int b = kb.nextInt();
if(x==a||y==b||x==b||y==a)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
}