perms = lambda a: a[1:] and [c+r for i, c in enumerate(a) for r in perms(a[:i]+a[i+1:])] or a