import java.io.*; import java.util.*; class GFG { // Class to represent a graph static class Graph { int V; // No. of vertices' // Pointer to an array containing adjacency list Vector<Integer>[] adj; @SuppressWarnings("unchecked") Graph(int V) { // Constructor this.V = V; th...