#1503 Bitwise And Convolution Twisted n=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) C=[] for k in range(2**n): ck=0 for i in range(2**n): ck+=A[i]*B[i&k] C.append(ck % 998244353) print(*C)