using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class ProblemA
    {
        static bool SAIKI = false;
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var N = NN;
            var M = NN;
            var aList = NNList(N);
            var bList = NNList(M);
            var cList = LIB_NTT.Multiply(aList, bList, 998244353);
            Console.WriteLine(cList.Join(" "));
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static LIB_FastIO fastio = new LIB_FastIODebug();
        static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }
        static long NN => fastio.Long();
        static double ND => fastio.Double();
        static string NS => fastio.Scan();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static IOrderedEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderBy(x.OrderByRand(), selector);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);
        static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<string> OrderByDescending(this IEnumerable<string> x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);
        static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
    class LIB_NTT
    {
        const uint mod1 = 1045430273;
        const uint root1 = 3;
        const uint mod2 = 1051721729;
        const uint root2 = 6;
        const uint mod3 = 1053818881;
        const uint root3 = 7;
        const uint mod4 = 998244353;
        const uint root4 = 3;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint mul1(uint x, uint y) => (uint)((ulong)x * y % mod1);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint mul2(uint x, uint y) => (uint)((ulong)x * y % mod2);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint mul3(uint x, uint y) => (uint)((ulong)x * y % mod3);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint mul4(uint x, uint y) => (uint)((ulong)x * y % mod4);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint pow1(uint x, uint n) { uint res = 1; while (n > 0) { if ((n & 1) != 0) res = mul1(res, x); x = mul1(x, x); n >>= 1; } return res; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint pow2(uint x, uint n) { uint res = 1; while (n > 0) { if ((n & 1) != 0) res = mul2(res, x); x = mul2(x, x); n >>= 1; } return res; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint pow3(uint x, uint n) { uint res = 1; while (n > 0) { if ((n & 1) != 0) res = mul3(res, x); x = mul3(x, x); n >>= 1; } return res; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint pow4(uint x, uint n) { uint res = 1; while (n > 0) { if ((n & 1) != 0) res = mul4(res, x); x = mul4(x, x); n >>= 1; } return res; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint inverse1(uint x) { long b = mod1, r = 1, u = 0, t = 0, x2 = x; while (b > 0) { var q = x2 / b; t = u; u = r - q * u; r = t; t = b; b = x2 - q * b; x2 = t; } return (uint)(r < 0 ? r + mod1 : r); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint inverse2(uint x) { long b = mod2, r = 1, u = 0, t = 0, x2 = x; while (b > 0) { var q = x2 / b; t = u; u = r - q * u; r = t; t = b; b = x2 - q * b; x2 = t; } return (uint)(r < 0 ? r + mod2 : r); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint inverse3(uint x) { long b = mod3, r = 1, u = 0, t = 0, x2 = x; while (b > 0) { var q = x2 / b; t = u; u = r - q * u; r = t; t = b; b = x2 - q * b; x2 = t; } return (uint)(r < 0 ? r + mod3 : r); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint inverse4(uint x) { long b = mod4, r = 1, u = 0, t = 0, x2 = x; while (b > 0) { var q = x2 / b; t = u; u = r - q * u; r = t; t = b; b = x2 - q * b; x2 = t; } return (uint)(r < 0 ? r + mod4 : r); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void ntt1(ref uint[] a, bool rev = false) { if (a.Length == 1) return; var halfn = (uint)a.Length >> 1; var b = new uint[a.Length]; var s = pow1(root1, rev ? (mod1 - 1 - (mod1 - 1) / (uint)a.Length) : (mod1 - 1) / (uint)a.Length); uint i, j, k, l, r; var kp = new uint[halfn + 1]; kp[0] = 1; for (i = 0; i < kp.Length - 1; ++i) kp[i + 1] = mul1(kp[i], s); for (i = 1, l = halfn; i < a.Length; i <<= 1, l >>= 1) { for (j = 0, r = 0; j < l; ++j, r += i) { for (k = 0, s = kp[i * j]; k < i; ++k) { var kr = k + r; var krhalfn = kr + halfn; b[kr + r] = (a[kr] + a[krhalfn]) % mod1; b[kr + r + i] = (uint)(((ulong)(a[kr] + mod1 - a[krhalfn]) * s) % mod1); } } var t = a; a = b; b = t; } if (rev) { s = inverse1((uint)a.Length); for (i = 0; i < a.Length; ++i) a[i] = mul1(a[i], s); } }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void ntt2(ref uint[] a, bool rev = false) { if (a.Length == 1) return; var halfn = (uint)a.Length >> 1; var b = new uint[a.Length]; var s = pow2(root2, rev ? (mod2 - 1 - (mod2 - 1) / (uint)a.Length) : (mod2 - 1) / (uint)a.Length); uint i, j, k, l, r; var kp = new uint[halfn + 1]; kp[0] = 1; for (i = 0; i < kp.Length - 1; ++i) kp[i + 1] = mul2(kp[i], s); for (i = 1, l = halfn; i < a.Length; i <<= 1, l >>= 1) { for (j = 0, r = 0; j < l; ++j, r += i) { for (k = 0, s = kp[i * j]; k < i; ++k) { var kr = k + r; var krhalfn = kr + halfn; b[kr + r] = (a[kr] + a[krhalfn]) % mod2; b[kr + r + i] = (uint)(((ulong)(a[kr] + mod2 - a[krhalfn]) * s) % mod2); } } var t = a; a = b; b = t; } if (rev) { s = inverse2((uint)a.Length); for (i = 0; i < a.Length; ++i) a[i] = mul2(a[i], s); } }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void ntt3(ref uint[] a, bool rev = false) { if (a.Length == 1) return; var halfn = (uint)a.Length >> 1; var b = new uint[a.Length]; var s = pow3(root3, rev ? (mod3 - 1 - (mod3 - 1) / (uint)a.Length) : (mod3 - 1) / (uint)a.Length); uint i, j, k, l, r; var kp = new uint[halfn + 1]; kp[0] = 1; for (i = 0; i < kp.Length - 1; ++i) kp[i + 1] = mul3(kp[i], s); for (i = 1, l = halfn; i < a.Length; i <<= 1, l >>= 1) { for (j = 0, r = 0; j < l; ++j, r += i) { for (k = 0, s = kp[i * j]; k < i; ++k) { var kr = k + r; var krhalfn = kr + halfn; b[kr + r] = (a[kr] + a[krhalfn]) % mod3; b[kr + r + i] = (uint)(((ulong)(a[kr] + mod3 - a[krhalfn]) * s) % mod3); } } var t = a; a = b; b = t; } if (rev) { s = inverse3((uint)a.Length); for (i = 0; i < a.Length; ++i) a[i] = mul3(a[i], s); } }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void ntt4(ref uint[] a, bool rev = false)
        {
            if (a.Length == 1) return;
            var halfn = (uint)a.Length >> 1;
            var b = new uint[a.Length];
            var s = pow4(root4, rev ? (mod4 - 1 - (mod4 - 1) / (uint)a.Length) : (mod4 - 1) / (uint)a.Length);
            uint i, j, k, l, r;
            var kp = new uint[halfn + 1];
            kp[0] = 1;
            for (i = 0; i < kp.Length - 1; ++i) kp[i + 1] = mul4(kp[i], s);
            for (i = 1, l = halfn; i < a.Length; i <<= 1, l >>= 1)
            {
                for (j = 0, r = 0; j < l; ++j, r += i)
                {
                    for (k = 0, s = kp[i * j]; k < i; ++k)
                    {
                        var kr = k + r;
                        var krhalfn = kr + halfn;
                        b[kr + r] = (a[kr] + a[krhalfn]) % mod4;
                        b[kr + r + i] = (uint)(((ulong)(a[kr] + mod4 - a[krhalfn]) * s) % mod4);
                    }
                }
                var t = a; a = b; b = t;
            }
            if (rev)
            {
                s = inverse4((uint)a.Length);
                for (i = 0; i < a.Length; ++i) a[i] = mul4(a[i], s);
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint[] Multiply1(uint[] a, uint[] b) { var n = a.Length + b.Length - 1; var t = 1; while (t < n) t <<= 1; var na = new uint[t]; var nb = new uint[t]; for (var i = 0; i < a.Length; ++i) na[i] = a[i]; for (var i = 0; i < b.Length; ++i) nb[i] = b[i]; ntt1(ref na); ntt1(ref nb); for (var i = 0; i < t; ++i) na[i] = mul1(na[i], nb[i]); ntt1(ref na, true); return na.Take(n).ToArray(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint[] Multiply2(uint[] a, uint[] b) { var n = a.Length + b.Length - 1; var t = 1; while (t < n) t <<= 1; var na = new uint[t]; var nb = new uint[t]; for (var i = 0; i < a.Length; ++i) na[i] = a[i]; for (var i = 0; i < b.Length; ++i) nb[i] = b[i]; ntt2(ref na); ntt2(ref nb); for (var i = 0; i < t; ++i) na[i] = mul2(na[i], nb[i]); ntt2(ref na, true); return na.Take(n).ToArray(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static uint[] Multiply3(uint[] a, uint[] b) { var n = a.Length + b.Length - 1; var t = 1; while (t < n) t <<= 1; var na = new uint[t]; var nb = new uint[t]; for (var i = 0; i < a.Length; ++i) na[i] = a[i]; for (var i = 0; i < b.Length; ++i) nb[i] = b[i]; ntt3(ref na); ntt3(ref nb); for (var i = 0; i < t; ++i) na[i] = mul3(na[i], nb[i]); ntt3(ref na, true); return na.Take(n).ToArray(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public long[] Multiply(long[] a, long[] b)
        {
            var n = a.Length + b.Length - 1;
            var t = 1;
            while (t < n) t <<= 1;
            var na = new uint[t];
            var nb = new uint[t];
            for (var i = 0; i < a.Length; ++i) na[i] = (uint)a[i];
            for (var i = 0; i < b.Length; ++i) nb[i] = (uint)b[i];
            ntt4(ref na);
            ntt4(ref nb);
            for (var i = 0; i < t; ++i) na[i] = mul4(na[i], nb[i]);
            ntt4(ref na, true);
            return na.Take(n).Select(e => (long)e).ToArray();
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static public long[] Multiply(long[] a, long[] b, long mod)
        {
            if (mod == 998244353) return Multiply(a, b);
            var uinta = a.Select(e => (uint)e).ToArray();
            var uintb = b.Select(e => (uint)e).ToArray();
            var x = Multiply1(uinta, uintb);
            var y = Multiply2(uinta, uintb);
            var z = Multiply3(uinta, uintb);
            var m1_inv_m2 = inverse2(mod1);
            var m12_inv_m3 = inverse3(mul3(mod1, mod2));
            var m12_mod = (long)mod1 * mod2 % mod;
            var ret = new long[x.Length];
            for (var i = 0; i < x.Length; ++i)
            {
                var v1 = mul2(y[i] + (mod2 << 1) - x[i], m1_inv_m2);
                var v2 = mul3(z[i] + (mod3 << 1) - x[i] + mod3 - mul3(mod1, v1), m12_inv_m3);
                ret[i] = (x[i] + ((long)mod1 * v1 % mod) + ((long)m12_mod * v2 % mod)) % mod;
            }
            return ret;
        }
    }
    class LIB_FastIO
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIO() { str = Console.OpenStandardInput(); }
        readonly Stream str;
        readonly byte[] buf = new byte[1024];
        int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return isEof; }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        byte read()
        {
            if (isEof) throw new EndOfStreamException();
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    isEof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
    class LIB_FastIODebug : LIB_FastIO
    {
        Queue<string> param = new Queue<string>();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIODebug() { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string Scan() => NextString();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override long Long() => long.Parse(NextString());
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override double Double() => double.Parse(NextString());
    }
}


Measured memory_bytes: 89592