s = input()
st = [False] * 10
path = ""
def dfs(u):
global path
if u == len(s):
print(path)
return
for i in range(len(s)):
if not st[i]:
path += s[i]
st[i] = True
dfs(u + 1)
path = path[:-1]
st[i] = False
dfs(0)