bogdan birthday today mom give tree consist n vertecie for edge tree number xi write in case forget tree connect nondirected graph cycle after present grant m guest consecutively come Bogdans party when ith guest come perform exactly possible operation Chooses number yi vertecie ai bi after move edge tree vertex ai vertex bi short path course path unique tree every time move edge j replace current number yi result integer division yi div xj Chooses edge pi replace value write xpi positive integer cixpi as Bogdan care guest decide ease process Write program perform operation request guest output result value yi type