Ember Storm play game First Ember pick label tree T n vertex degree vertex d then storm pick distinct vertex u v tree write label vertex path u v sequence a1a2 ak Finally Ember pick index 1ik array now perform follow operation exactly flip subrange i1k add ai after sequence a1 aiakaiak1ai ai1ai negate subrange i1k add ai ie array a1 aiai1aiai2aiakai Ember win array monotonically increase decrease Otherwise Storm winsthe game describe tuple Tuviop op flip negate depend action Ember choose turn Find number tuple occur Ember Storm play optimally when play optimally multiple move guarantee win play win move otherwise lose matter play play possible movesReport answer modulo m