package codeforces;import java.util.*;public class CodeForces_764C_Timofey_and_a_tree { static final int N=(int) (2e5+10); @SuppressWarnings("unchecked") static ArrayLista[]=new ArrayList[N]; static int book[]=new int[N]; static int c[]=new int[N]; static void dfs(int u,int fa) { int v; for(int i=0; i (); if(a[v]==null) a[v]=new ArrayList (); a[u].add(v); a[v].add(u); } Arrays.fill(book,0); for(int i=1; i<=n; i++) c[i]=sc.nextInt(); dfs(1,-1); int ans2=n,flag=0,maxx=0; for(int i=1; i<=n; i++) { if(book[i]>maxx) { maxx=book[i]; ans2=i; } } for(int i=0; i