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,lir,lid; static bool[] b; static int k=0,m=0; static int[] h,zt,za,ma; static void Main(){ Sc sc=new Sc(); var s=sc.Ia; var hs=new Dictionary(); var g=new int[s[1]][]; int z=0; for(int i=0;i[z+1]; lir=new List[z+1]; b=new bool[z+1]; k=z-1; za=new int[z+1]; foreach(var e in hs){za[e.Value]=e.Key;} for(int i=1;i<=z;i++){li[i]=new List();lir[i]=new List();} for(int i=0;i[m+1]; for(int i=1;i<=m;i++){lid[i]=new List();} for(int i=1;i<=z;i++){ for(int j=0;j>1;} static void Fu3(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