Guest User

Untitled

a guest
Jan 11th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. #!/usr/bin/env python2
  2.  
  3. from itertools import permutations
  4.  
  5. def solve(words):
  6.     return min([''.join(ws) for ws in permutations(words)])
  7.  
  8. if __name__ == '__main__':
  9.     from sys import stdin
  10.     for _ in range(int(stdin.readline())):
  11.         print solve(stdin.readline().split()[1:])
Advertisement
Add Comment
Please, Sign In to add comment