# Enter your code here. Read input from STDIN. Print output to STDOUT row1 = map(int,raw_input().strip().split(' ')) row2 = map(int,raw_input().strip().split(' ')) row3 = map(int,raw_input().strip().split(' ')) mid=row2[1] if mid ==5: if row1[0]+row3[2]!=10: if row1[0]>row3[2]: print row1[0]-row3[2] print row3[2]-row1[0] if row1[1]+row3[1]!=10: if row1[1]>row3[1]: print row1[1]-row3[1] print row3[1]-row3[1] if row1[2]+row3[0]!=10: if row1[2]>row3[0]: print row1[2]-row3[0] print row3[0]-row1[2] if row2[0]+row2[2]!=10: if row2[0]>row2[2]: print row2[0]-row2[2] print row2[2]-row2[0]