import sys

cabal_in = sys.argv[1]

modules = '\n    '.join(sorted(sys.stdin.read().split()))
template = open(cabal_in).read()
contents = template.replace('-- AUTOGENERATED_MODULES_HERE', modules)
sys.stdout.write(contents)
