using System; using System.Collections.Generic; using System.Collections; using System.Collections.Specialized; using System.Linq; using System.Text; using System.IO; using System.Reflection; using static System.Math; using System.Numerics; static class Program{ const int mod=(int)1e9+7; static List[] li; static bool[] b; static long[] h,dp,p,o,g,h2,r,ans; static int[] d,de; static int[][] hd; static int on; static void Main(){ Sc sc=new Sc(); int[] s=sc.Ia; int n=s[0],m=s[1],q=s[2]; li=new List[n+1]; b=new bool[n+1]; h=new long[n+1]; h2=new long[n+1]; p=new long[n+1]; o=new long[n+1]; g=new long[n+1]; r=new long[n+1]; d=new int[n+1]; ans=new long[n+1]; dp=new long[n+1]; for(int i=1;i<=n;i++){li[i]=new List();} Uf uf=new Uf(n+1); for(int i=0;ide[b]){int c=a;a=b;b=c;} for(int i=on-1;de[a]!=de[b];i--){if(de[hd[i][b]]>=de[a]){b=hd[i][b];}} if(a==b){return a;} for(int i=on-1;i>=0;i--){if(hd[i][a]!=hd[i][b]){a=hd[i][a];b=hd[i][b];}} return hd[0][a]; } static long Fu(int a){ b[a]=true; for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i