#include template void bitwise_transform(ForwardIterator first, ForwardIterator last, F f) { int n = std::distance(first, last); assert((n & (n - 1)) == 0); for (int step = 1; step < n; step *= 2) for (auto it0 = first; it0 != last;) { auto it1 = std::next(it0, step); for (auto end = it1; it0 != end; ++it0, ++it1) f(*it0, *it1); it0 = it1; } } template class ModularInt { using M = ModularInt; public: static_assert(int(Modulus) >= 1, "Modulus must be in the range [1, 2^31)"); static constexpr int modulus() { return Modulus; } static M raw(uint32_t v) { return *reinterpret_cast(&v); } ModularInt() : v_(0) {} ModularInt(int64_t v) : v_((v %= Modulus) < 0 ? v + Modulus : v) {} template explicit operator T() const { return v_; } M& operator++() { return v_ = ++v_ == Modulus ? 0 : v_, *this; } M& operator--() { return --(v_ ? v_ : v_ = Modulus), *this; } M& operator*=(M o) { return v_ = uint64_t(v_) * o.v_ % Modulus, *this; } M& operator/=(M o) { auto [inv, gcd] = extgcd(o.v_, Modulus); assert(gcd == 1); return *this *= inv; } M& operator+=(M o) { return v_ = int(v_ += o.v_ - Modulus) < 0 ? v_ + Modulus : v_, *this; } M& operator-=(M o) { return v_ = int(v_ -= o.v_) < 0 ? v_ + Modulus : v_, *this; } friend M operator++(M& a, int) { return std::exchange(a, ++M(a)); } friend M operator--(M& a, int) { return std::exchange(a, --M(a)); } friend M operator+(M a) { return a; } friend M operator-(M a) { return a.v_ = a.v_ ? Modulus - a.v_ : 0, a; } friend M operator*(M a, M b) { return a *= b; } friend M operator/(M a, M b) { return a /= b; } friend M operator+(M a, M b) { return a += b; } friend M operator-(M a, M b) { return a -= b; } friend std::istream& operator>>(std::istream& is, M& x) { int64_t v; return is >> v, x = v, is; } friend std::ostream& operator<<(std::ostream& os, M x) { return os << x.v_; } friend bool operator==(M a, M b) { return a.v_ == b.v_; } friend bool operator!=(M a, M b) { return a.v_ != b.v_; } private: static std::pair extgcd(int a, int b) { std::array x{1, 0}; while (b) std::swap(x[0] -= a / b * x[1], x[1]), std::swap(a %= b, b); return {x[0], a}; } uint32_t v_; }; #pragma region my_template struct Rep { struct I { int i; void operator++() { ++i; } int operator*() const { return i; } bool operator!=(I o) const { return i < *o; } }; const int l_, r_; Rep(int l, int r) : l_(l), r_(r) {} Rep(int n) : Rep(0, n) {} I begin() const { return {l_}; } I end() const { return {r_}; } }; struct Per { struct I { int i; void operator++() { --i; } int operator*() const { return i; } bool operator!=(I o) const { return i > *o; } }; const int l_, r_; Per(int l, int r) : l_(l), r_(r) {} Per(int n) : Per(0, n) {} I begin() const { return {r_ - 1}; } I end() const { return {l_ - 1}; } }; template struct Fix : private F { Fix(F f) : F(f) {} template decltype(auto) operator()(Args&&... args) const { return F::operator()(*this, std::forward(args)...); } }; template T scan() { T res; std::cin >> res; return res; } template bool chmin(T& a, U&& b) { return b < a ? a = std::forward(b), true : false; } template bool chmax(T& a, U&& b) { return a < b ? a = std::forward(b), true : false; } #ifndef LOCAL #define DUMP(...) void(0) template constexpr int OjLocal = OnlineJudge; #endif using namespace std; #define ALL(c) begin(c), end(c) #pragma endregion using Mint = ModularInt<998244353>; int main() { cin.tie(nullptr)->sync_with_stdio(false); cout << fixed << setprecision(20); int n = scan(); vector a(1 << n), b(1 << n); generate(ALL(a), scan<>); generate(ALL(b), scan<>); bitwise_transform(ALL(a), [](auto&& lo, auto&& hi) { auto x = lo, y = hi; lo = y; hi = x + y; }); bitwise_transform(ALL(b), [](auto&& lo, auto&& hi) { auto x = lo, y = hi; lo = x - y; hi = x; }); for (int i : Rep(1 << n)) a[i] *= b[i]; bitwise_transform(ALL(a), [](auto&& lo, auto&& hi) { auto x = lo, y = hi; lo = y; hi = y - x; }); for (int i : Rep(1 << n)) cout << a[i] << " \n"[i + 1 == 1 << n]; }