"""https://open.kattis.com/problems/bijele"""

def main():
    required = [1, 1, 2, 2, 2, 8]
    have = list(map(int, input().split()))

    for i in range(len(have)):
        print((required[i] - have[i]), end = ' ')

if __name__ == '__main__':
    main()
    
433b6234948e0338185b860fd795ffd01a18d4d0
<mask token>

<mask token>


def main():
    required = [1, 1, 2, 2, 2, 8]
    have = list(map(int, input().split()))
    for i in range(len(have)):
        print(required[i] - have[i], end=' ')


<mask token>

<mask token>


def main():
    required = [1, 1, 2, 2, 2, 8]
    have = list(map(int, input().split()))
    for i in range(len(have)):
        print(required[i] - have[i], end=' ')


if __name__ == '__main__':
    main()

"""https://open.kattis.com/problems/bijele"""

def main():
    required = [1, 1, 2, 2, 2, 8]
    have = list(map(int, input().split()))

    for i in range(len(have)):
        print((required[i] - have[i]), end = ' ')

if __name__ == '__main__':
    main()
    