M = [] for i in range(2): M.append(list(map(int, input().split()))) def prod(A, B): C = [[0] * 2 for i in range(2)] for i in range(2): for j in range(2): for k in range(2): C[i][j] += A[i][k] * B[k][j] return C M2 = prod(M, M) M3 = prod(M2, M) for m in M3: print(*m)