import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Main { static int N,M,R,idx; static ArrayList[] edges; static int [] answer; static boolean [] visited; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedRead..