#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; template struct ModInt { using M = ModInt; unsigned v; constexpr ModInt() : v(0) {} constexpr ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {} constexpr ModInt(unsigned _v, int) : v(_v) {} static constexpr unsigned p() { return P; } M operator+() const { return *this; } M operator-() const { return {v ? P - v : 0, 0}; } explicit operator bool() const noexcept { return v; } bool operator!() const noexcept { return !(bool)*this; } M operator*(M r) const { return M(*this) *= r; } M operator/(M r) const { return M(*this) /= r; } M operator+(M r) const { return M(*this) += r; } M operator-(M r) const { return M(*this) -= r; } bool operator==(M r) const { return v == r.v; } bool operator!=(M r) const { return !(*this == r); } M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; } M& operator/=(M r) { return *this *= r.inv(); } M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; } M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; } M inv() const { int a = v, b = P, x = 1, u = 0; while (b) { int q = a / b; swap(a -= q * b, b); swap(x -= q * u, u); } assert(a == 1); return x; } M pow(auto n) const { if (n < 0) return pow(-n).inv(); M res = 1; for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a; return res; } friend M operator*(auto l, M r) { return M(l) *= r; } friend M operator/(auto l, M r) { return M(l) /= r; } friend M operator+(auto l, M r) { return M(l) += r; } friend M operator-(auto l, M r) { return M(l) -= r; } friend ostream& operator<<(ostream& os, M r) { return os << r.v; } friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; } friend bool operator==(auto l, M r) { return M(l) == r; } friend bool operator!=(auto l, M r) { return !(l == r); } }; using Mint = ModInt<998244353>; template void ntt(V< ModInt

>& a, bool inv = false) { int n = a.size(); assert(__builtin_popcount(n) == 1); int j = 0; for (int i = 1; i < n; ++i) { int w = n >> 1; while (j >= w) j -= w, w >>= 1; j += w; if (i < j) swap(a[i], a[j]); } assert((P - 1) % n == 0); auto xi = ModInt

(g).pow((P - 1) / n); if (inv) xi = xi.inv(); for (int k = 0; 1 << k < n; ++k) { const int w = 1 << k; const auto dt = xi.pow(n >> k + 1); for (int s = 0; s < n; s += 2 * w) { ModInt

t = 1; for (int i = s; i < s + w; ++i) { auto p = a[i], q = a[i + w] * t; a[i] = p + q, a[i + w] = p - q; t *= dt; } } } } template V< ModInt

> multiply(const V< ModInt

>& a, const V< ModInt

>& b) { if (a.empty() or b.empty()) return {}; int sz = a.size() + b.size() - 1, n = 1 << __lg(2 * sz - 1); auto _a = a, _b = b; _a.resize(n), _b.resize(n); ntt(_a), ntt(_b); for (int i = 0; i < n; ++i) _a[i] *= _b[i]; ntt(_a, true); _a.resize(sz); const auto inv_n = ModInt

(n).inv(); for (auto&& e : _a) e *= inv_n; return _a; } lint tmod(lint a, lint p) { return (a %= p) < 0 ? a + p : a; } lint mod_pow(lint a, lint n, lint p) { assert(n >= 0); a = tmod(a, p); lint res = 1; while (n) { if (n & 1) (res *= a) %= p; (a *= a) %= p; n >>= 1; } return res; } template map factorize(Z n) { map res; for (Z i = 2; i * i <= n; ++i) while (n % i == 0) ++res[i], n /= i; if (n != 1) ++res[n]; return res; } template Z rng(Z a, Z b) { static mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); return uniform_int_distribution(a, b - 1)(mt); } lint primitive_root(lint p) { auto mp = factorize(p - 1); while (true) { lint g = rng(1LL, p); bool ok = true; for (const auto& e : mp) { if (mod_pow(g, (p - 1) / e.first, p) == 1) { ok = false; break; } } if (!ok) continue; return g; } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); lint p; cin >> p; V a(p), b(p); for (int i = 1; i < p; ++i) cin >> a[i]; for (int i = 1; i < p; ++i) cin >> b[i]; lint g = primitive_root(p); V na(p - 1), nb(p - 1); lint t = 1; for (int i = 0; i < p - 1; ++i) { na[i] = a[t]; nb[i] = b[t]; (t *= g) %= p; } auto nc = multiply(na, nb); V c(p); t = 1; for (int i = 0; i < (int)nc.size(); ++i) { c[t] += nc[i]; (t *= g) %= p; } for (int i = 1; i < p; ++i) { cout << c[i] << " \n"[i == p - 1]; } }