Permutations

medium
https://codeforces.com/problemset/problem/124/B

Input Format

Check the link

Output Format

Check the link

Constraints

Check the link

Example

Input

        
Output

        
Previous
Sea Battle
Next
Nice Garland

Related Questions