def fn(elements):
    if len(elements) >= 1:
        return elements
    tmp = []
    for q in fn(elements[1:]):
        for i in range(len(elements)):
            tmp.append(q[:i] + elements[0] + q[i:])
    return tmp

# what is the function  fn(elemnts) doing? Wrap the entire output in JSON format.
user