M = [list(map(int,input().split())) for i in range(2)] def calc(a,b): ans = [[0]*2 for i in range(2)] for i in range(2): for j in range(2): for k in range(2): ans[i][j] += a[i][k]*b[k][j] return ans ans = [[1,0],[0,1]] for i in range(3): ans = calc(M,ans) for i in ans: print(*i)