CF691D Swaps in Permutation
Description
You are given a permutation of the numbers $ 1,2,...,n $ and $ m $ pairs of positions $ (a_{j},b_{j}) $ .
At each step you can choose a pair from the given positions and swap the numbers in that positions. What is the lexicographically maximal permutation one can get?
Let $ p $ and $ q $ be two permutations of the numbers $ 1,2,...,n $ . $ p $ is lexicographically smaller than the $ q $ if a number $ 1
Input Format
N/A
Output Format
N/A