F3. Tree of Life (hard)time limit per test8 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTo add insult to injury, the zombies have taken all but two drawings from Heidi! Please help her recover the Tree of Life from only these two drawings.InputThe input format is the same as in the medium version, except that now the bound on n is 2 ≤ n ≤ 1000 and that k = 2.OutputThe same as in the medium version.ExampleInput19 264 35 46 18 68 27 158 68 78 17 35 1OutputYES2 13 15 46 57 68 59 81 4
Input19 264 35 46 18 68 27 158 68 78 17 35 1
OutputYES2 13 15 46 57 68 59 81 4
['trees', '*3200']