#include #include using mint = atcoder::modint998244353; template void zeta(std::vector &v) { int N = v.size(); assert(std::popcount(unsigned(N)) == 1); for (int i = 1; i < N; i <<= 1) for (int S = 0; S < N; S++) if (S & i) v[S] += v[S - i]; } template void transposition_zeta(std::vector &v) { int N = v.size(); assert(std::popcount(unsigned(N)) == 1); std::ranges::reverse(v); zeta(v); std::ranges::reverse(v); } template void mobius(std::vector &v) { int N = v.size(); assert(std::popcount(unsigned(N)) == 1); for (int i = N >> 1; i; i >>= 1) for (int S = N - 1; S >= 0; S--) if (S & i) v[S] -= v[S - i]; } template void transposition_mobius(std::vector &v) { int N = v.size(); assert(std::popcount(unsigned(N)) == 1); std::ranges::reverse(v); mobius(v); std::ranges::reverse(v); } template std::vector hadamard_product(const std::vector &v, const std::vector &w) { int N = v.size(); assert(v.size() == w.size()); std::vector result; std::ranges::transform(v, w, std::back_inserter(result), [](mint a, mint b) { return a * b; }); return result; } int main() { int n; std::cin >> n; std::vector a(1 << n), b(1 << n); for (mint &x : a) { int x_; std::cin >> x_; x = mint::raw(x_); } for (mint &x : b) { int x_; std::cin >> x_; x = mint::raw(x_); } transposition_zeta(a); mobius(b); auto c = hadamard_product(a, b); zeta(c); for (int i = 0; i < (1 << n); i++) std::cout << c[i].val() << "\n "[i + 1 < (1 << n)]; }