<gh_stars>1-10
s = list(input())

s.sort(key=lambda c: ( (c.isdigit() and int(c) % 2 == 0), (c.isdigit() and int(c) % 2 == 1), c.isupper(), c.islower(), c ) )

print(*s, sep = '')
s = list(input())

s.sort(key=lambda c: ( (c.isdigit() and int(c) % 2 == 0), (c.isdigit() and int(c) % 2 == 1), c.isupper(), c.islower(), c ) )

print(*s, sep = '')