import sys

with open(sys.argv[1]) as f:
    raw = f.read()

lines = raw.split('\n')

with open(sys.argv[2], 'w') as f:

    f.write(lines.pop(0)+'\n')
    f.write(lines.pop(0)+'\n')
    f.write(lines.pop(0)+'\n')

    while True:
        line0 = lines.pop(0)
        if not line0: break
        f.write(line0+'\n')
        
        Y = [9-int(y) for y in lines.pop(0).split(',')]
        f.write(','.join(str(y) for y in Y) + '\n')



7341eb213dccf0855a653ed98d3b7abd4922f099
<mask token>

<mask token>
with open(sys.argv[1]) as f:
    raw = f.read()
<mask token>
with open(sys.argv[2], 'w') as f:
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    while True:
        line0 = lines.pop(0)
        if not line0:
            break
        f.write(line0 + '\n')
        Y = [(9 - int(y)) for y in lines.pop(0).split(',')]
        f.write(','.join(str(y) for y in Y) + '\n')

<mask token>
with open(sys.argv[1]) as f:
    raw = f.read()
lines = raw.split('\n')
with open(sys.argv[2], 'w') as f:
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    while True:
        line0 = lines.pop(0)
        if not line0:
            break
        f.write(line0 + '\n')
        Y = [(9 - int(y)) for y in lines.pop(0).split(',')]
        f.write(','.join(str(y) for y in Y) + '\n')

import sys
with open(sys.argv[1]) as f:
    raw = f.read()
lines = raw.split('\n')
with open(sys.argv[2], 'w') as f:
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    f.write(lines.pop(0) + '\n')
    while True:
        line0 = lines.pop(0)
        if not line0:
            break
        f.write(line0 + '\n')
        Y = [(9 - int(y)) for y in lines.pop(0).split(',')]
        f.write(','.join(str(y) for y in Y) + '\n')

import sys

with open(sys.argv[1]) as f:
    raw = f.read()

lines = raw.split('\n')

with open(sys.argv[2], 'w') as f:

    f.write(lines.pop(0)+'\n')
    f.write(lines.pop(0)+'\n')
    f.write(lines.pop(0)+'\n')

    while True:
        line0 = lines.pop(0)
        if not line0: break
        f.write(line0+'\n')
        
        Y = [9-int(y) for y in lines.pop(0).split(',')]
        f.write(','.join(str(y) for y in Y) + '\n')


