import java.util.*; public class Main { static HashMap<Integer, Integer> map; static Integer key; public static void main(String[] args) { map = new HashMap<>(); Scanner in = new Scanner(System.in); int n = in.nextInt();//节点数量 int first = in.nextInt();//头结点 map.put(null, first); for (int...