int A[1<<21] , B[1<<21] , n , len; int a[21][1<<21] , b[21][1<<21] , c[21][1<<21];
voidFMT( int A[] , int l ){ for( int i = 0 ; i < l ; ++ i ) for( int j = 0 ; j < ( 1 << l ) ; ++ j ) if( j & ( 1 << i ) ) A[j] = ( A[j] + A[j ^ ( 1 << i )] ) % P; } voidIFMT( int A[] , int l ){ for( int i = 0 ; i < l ; ++ i ) for( int j = 0 ; j < ( 1 << l ) ; ++ j ) if( j & ( 1 << i ) ) A[j] = ( A[j] + P - A[j ^ ( 1 << i )] ) % P; }
intmain(){ cin >> n; len = ( 1 << n ); for( int i = 0 ; i < len ; ++ i ) A[i] = rd() , a[__builtin_popcount(i)][i] = A[i]; for( int i = 0 ; i < len ; ++ i ) B[i] = rd() , b[__builtin_popcount(i)][i] = B[i]; for( int i = 0 ; i <= n ; ++ i ) FMT( a[i] , n ) , FMT( b[i] , n ); for( int x = 0 ; x <= n ; ++ x ) { for( int i = 0 ; i <= x ; ++ i ) for( int j = 0 ; j < ( 1 << n ) ; ++ j ) ( c[x][j] += 1ll * a[i][j] * b[x - i][j] % P ) %= P; IFMT( c[x] , n ); } for( int i = 0 ; i < len ; ++ i ) printf("%d ",c[__builtin_popcount(i)][i]); }