F. Roads in the Kingdom time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Kingdom K., there are n towns numbered with integers from 1 to n. The towns are connected by n bi-directional…