import java.math.*; import java.util.*; import java.io.*; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); long MODULO = 998244353; long ROOT = 3; long P = sc.nextLong(); long[] A = new long[(int) P + 1]; long[] B = new long[(int) P + 1]; for (int i = 1; i < P; ++i) { A[i] = sc.nextLong(); } for (int i = 1; i < P; ++i) { B[i] = sc.nextLong(); } ArrayList div = new ArrayList(); for (long i = 2; i * i <= P - 1; ++i) { if ((P - 1) % i == 0) div.add((P - 1) / i); } long root = -1; if (P == 2) root = 1; else if (P == 3) root = 2; out:for (long i = 2; root == -1 && i <= P - 1; ++i) { for (long d : div) { if (pow(i, d, P) == 1) { continue out; } } root = i; break; } long[] A2 = new long[(int) (2 * P)]; long[] B2 = new long[(int) (2 * P)]; long[] pow_root = new long[(int) P]; pow_root[0] = 1; for (int i = 1; i < pow_root.length; ++i) pow_root[i] = pow_root[i - 1] * root % P; for (int i = 1; i <= P - 1; ++i) { A2[i] = A[(int) pow_root[i]]; B2[i] = B[(int) pow_root[i]]; } long[] C2 = mul(A2, B2, MODULO, ROOT); long[] C = new long[(int) P]; for (int i = 0; i < C2.length; ++i) { C[(int) pow_root[(int) (i % (P - 1))]] += C2[i]; } PrintWriter pw = new PrintWriter(System.out); for (int i = 1; i < C.length; ++i) { pw.print(C[i]%MODULO+(i==C.length-1?"\n":" ")); } pw.close(); } long[] mul(long[] a, long[] b, long MODULO, long root) { int n = Integer.highestOneBit(a.length + b.length) << 1; a = Arrays.copyOf(a, n); b = Arrays.copyOf(b, n); a = fft(a, false, MODULO, root); b = fft(b, false, MODULO, root); for (int i = 0; i < n; ++i) a[i] = a[i] * b[i] % MODULO; a = fft(a, true, MODULO, root); long inv = inv(n, MODULO); for (int i = 0; i < n; ++i) { a[i] = a[i] * inv % MODULO; } return a; } long[] fft(long[] a, boolean inv, long MODULO, long root) { int n = a.length; int c = 0; for (int i = 1; i < n; ++i) { for (int j = n >> 1; j > (c ^= j); j >>= 1) ; if (c > i) { long d = a[i]; a[i] = a[c]; a[c] = d; } } for (int i = 1; i < n; i *= 2) { long w = pow(root, (MODULO - 1) / (2 * i), MODULO); if (inv) w = inv(w, MODULO); for (int j = 0; j < n; j += 2 * i) { long wn = 1; for (int k = 0; k < i; ++k) { long u = a[j + k]; long v = a[j + k + i] * wn % MODULO; a[j + k] = (u + v) % MODULO; a[j + k + i] = (u - v + MODULO) % MODULO; wn = wn * w % MODULO; } } } return a; } long pow(long a, long n, long MODULO) { long ret = 1; for (; n > 0; n >>= 1, a = a * a % MODULO) { if (n % 2 == 1) ret = ret * a % MODULO; } return ret; } long inv(long a, long MODULO) { return pow(a, MODULO - 2, MODULO); } void tr(Object...o){ System.out.println(Arrays.deepToString(o)); } }