package nyoj; import java.util.Scanner; public class Main { public static void main(String args[]) { //System.out.println(Integer.MAX_VALUE); Scanner scn=new Scanner(System.in); int len=scn.nextInt(); while(len-->0) { int v=scn.nextInt(); int e=scn.n…