/* #region Head */

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vc<vc<T>>;
using vll = vc<ll>;
using vvll = vvc<ll>;
using vld = vc<ld>;
using vvld = vvc<ld>;
using vs = vc<string>;
using vvs = vvc<string>;
template <class T, class U> using um = unordered_map<T, U>;
template <class T> using pq = priority_queue<T>;
template <class T> using pqa = priority_queue<T, vc<T>, greater<T>>;
template <class T> using us = unordered_set<T>;

#define REP(i, m, n) for (ll i = (m), i##_len = (ll)(n); i < i##_len; ++(i))
#define REPM(i, m, n) for (ll i = (m), i##_max = (ll)(n); i <= i##_max; ++(i))
#define REPR(i, m, n) for (ll i = (m), i##_min = (ll)(n); i >= i##_min; --(i))
#define REPD(i, m, n, d) for (ll i = (m), i##_len = (ll)(n); i < i##_len; i += (d))
#define REPMD(i, m, n, d) for (ll i = (m), i##_max = (ll)(n); i <= i##_max; i += (d))
#define REPI(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define ALL(x) begin(x), end(x)
#define SIZE(x) ((ll)(x).size())
#define PERM(c)                                                                                                        \
    sort(ALL(c));                                                                                                      \
    for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))
#define UNIQ(v) v.erase(unique(ALL(v)), v.end());

#define endl '\n'
#define sqrt sqrtl
#define floor floorl
#define log2 log2l

constexpr ll INF = 1'010'000'000'000'000'017LL;
constexpr int IINF = 1'000'000'007LL;
// constexpr ll MOD = 1'000'000'007LL; // 1e9 + 7
constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.14159265358979323846;

template <typename T> istream &operator>>(istream &is, vc<T> &vec) { // vector 入力
    for (T &x : vec) is >> x;
    return is;
}
template <typename T> ostream &operator<<(ostream &os, vc<T> &vec) { // vector 出力 (for dump)
    os << "{";
    REP(i, 0, SIZE(vec)) os << vec[i] << (i == i_len - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T> ostream &operator>>(ostream &os, vc<T> &vec) { // vector 出力 (inline)
    REP(i, 0, SIZE(vec)) os << vec[i] << (i == i_len - 1 ? "\n" : " ");
    return os;
}

template <typename T, typename U> istream &operator>>(istream &is, pair<T, U> &pair_var) { // pair 入力
    is >> pair_var.first >> pair_var.second;
    return is;
}
template <typename T, typename U> ostream &operator<<(ostream &os, pair<T, U> &pair_var) { // pair 出力
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}

// map, um, set, us 出力
template <class T> ostream &out_iter(ostream &os, T &map_var) {
    os << "{";
    REPI(itr, map_var) {
        os << *itr;
        auto itrcp = itr;
        if (++itrcp != map_var.end()) os << ", ";
    }
    return os << "}";
}
template <typename T, typename U> ostream &operator<<(ostream &os, map<T, U> &map_var) { return out_iter(os, map_var); }
template <typename T, typename U> ostream &operator<<(ostream &os, um<T, U> &map_var) {
    os << "{";
    REPI(itr, map_var) {
        auto [key, value] = *itr;
        os << "(" << key << ", " << value << ")";
        auto itrcp = itr;
        if (++itrcp != map_var.end()) os << ", ";
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &set_var) { return out_iter(os, set_var); }
template <typename T> ostream &operator<<(ostream &os, us<T> &set_var) { return out_iter(os, set_var); }
template <typename T> ostream &operator<<(ostream &os, pq<T> &pq_var) {
    pq<T> pq_cp(pq_var);
    os << "{";
    if (!pq_cp.empty()) {
        os << pq_cp.top(), pq_cp.pop();
        while (!pq_cp.empty()) os << ", " << pq_cp.top(), pq_cp.pop();
    }
    return os << "}";
}

// dump
#define DUMPOUT cerr
void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) DUMPOUT << ", ";
    dump_func(move(tail)...);
}

// chmax (更新「される」かもしれない値が前)
template <typename T, typename U, typename Comp = less<>> bool chmax(T &xmax, const U &x, Comp comp = {}) {
    if (comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

// chmin (更新「される」かもしれない値が前)
template <typename T, typename U, typename Comp = less<>> bool chmin(T &xmin, const U &x, Comp comp = {}) {
    if (comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// ローカル用
#define DEBUG_

#ifdef DEBUG_
#define DEB
#define dump(...)                                                                                                      \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                                                                    \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl                                        \
            << "    ",                                                                                                 \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

#define VAR(type, ...)                                                                                                 \
    type __VA_ARGS__;                                                                                                  \
    cin >> __VA_ARGS__;

template <typename T> istream &operator,(istream &is, T &rhs) { return is >> rhs; }
template <typename T> ostream &operator,(ostream &os, const T &rhs) { return os << ' ' << rhs; }

struct AtCoderInitialize {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    AtCoderInitialize() {
        ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH) cout << unitbuf;
    }
} ATCODER_INITIALIZE;

void Yn(bool p) { cout << (p ? "Yes" : "No") << endl; }
void YN(bool p) { cout << (p ? "YES" : "NO") << endl; }

/* #endregion */

/* #region ConvWithMint */
#define rep(i, b) REP(i, 0, b)
#define si(x) int(x.size())

// size of input must be a power of 2
// output of forward fmt is bit-reversed
// output elements are in the range [0,mod*4)
// input of inverse fmt should be bit-reversed
template <class mint> void inplace_fmt(vector<mint> &f, bool inv) {
    const int n = si(f);
    static const int L = 30;
    static mint g[L], ig[L], p2[L];
    if (g[0].v == 0) {
        rep(i, L) {
            mint w = -mint::root().pow(((mint::mod - 1) >> (i + 2)) * 3);
            g[i] = w;
            ig[i] = w.inv();
            p2[i] = mint(1 << i).inv();
        }
    }
    static constexpr uint mod2 = mint::mod * 2;
    if (!inv) {
        int b = n;
        if (b >>= 1) { // input:[0,mod)
            rep(i, b) {
                uint x = f[i + b].v;
                f[i + b].v = f[i].v + mint::mod - x;
                f[i].v += x;
            }
        }
        if (b >>= 1) { // input:[0,mod*2)
            mint p = 1;
            for (int i = 0, k = 0; i < n; i += b * 2) {
                REP(j, i, i + b) {
                    uint x = (f[j + b] * p).v;
                    // f[j].v=(f[j].v<mint::mod?f[j].v:f[j].v-mint::mod);
                    f[j + b].v = f[j].v + mint::mod - x;
                    f[j].v += x;
                }
                p *= g[__builtin_ctz(++k)];
            }
        }
        while (b) {
            if (b >>= 1) { // input:[0,mod*3)
                mint p = 1;
                for (int i = 0, k = 0; i < n; i += b * 2) {
                    REP(j, i, i + b) {
                        uint x = (f[j + b] * p).v;
                        // f[j].v=(f[j].v<mint::mod?f[j].v:f[j].v-mint::mod);
                        f[j + b].v = f[j].v + mint::mod - x;
                        f[j].v += x;
                    }
                    p *= g[__builtin_ctz(++k)];
                }
            }
            if (b >>= 1) { // input:[0,mod*4)
                mint p = 1;
                for (int i = 0, k = 0; i < n; i += b * 2) {
                    REP(j, i, i + b) {
                        uint x = (f[j + b] * p).v;
                        f[j].v = (f[j].v < mod2 ? f[j].v : f[j].v - mod2);
                        f[j + b].v = f[j].v + mint::mod - x;
                        f[j].v += x;
                    }
                    p *= g[__builtin_ctz(++k)];
                }
            }
        }
    } else {
        int b = 1;
        if (b < n / 2) { // input:[0,mod)
            mint p = 1;
            for (int i = 0, k = 0; i < n; i += b * 2) {
                REP(j, i, i + b) {
                    ull x = f[j].v + mint::mod - f[j + b].v;
                    f[j].v += f[j + b].v;
                    f[j + b].v = x * p.v % mint::mod;
                }
                p *= ig[__builtin_ctz(++k)];
            }
            b <<= 1;
        }
        for (; b < n / 2; b <<= 1) {
            mint p = 1;
            for (int i = 0, k = 0; i < n; i += b * 2) {
                REP(j, i, i + b / 2) { // input:[0,mod*2)
                    ull x = f[j].v + mod2 - f[j + b].v;
                    f[j].v += f[j + b].v;
                    f[j].v = (f[j].v) < mod2 ? f[j].v : f[j].v - mod2;
                    f[j + b].v = x * p.v % mint::mod;
                }
                REP(j, i + b / 2, i + b) { // input:[0,mod)
                    ull x = f[j].v + mint::mod - f[j + b].v;
                    f[j].v += f[j + b].v;
                    // f[j].v=(f[j].v)<mod2?f[j].v:f[j].v-mod2;
                    f[j + b].v = x * p.v % mint::mod;
                }
                p *= ig[__builtin_ctz(++k)];
            }
        }
        if (b < n) { // input:[0,mod*2)
            rep(i, b) {
                uint x = f[i + b].v;
                f[i + b].v = f[i].v + mod2 - x;
                f[i].v += x;
            }
        }
        mint z = p2[__lg(n)];
        rep(i, n) f[i] *= z;
    }
}

struct modinfo {
    uint mod, root;
};
template <modinfo const &ref> struct modular {
    static constexpr uint const &mod = ref.mod;
    static modular root() { return modular(ref.root); }
    uint v;
    // modular(initializer_list<uint>ls):v(*ls.bg){}
    modular(ll vv = 0) { s(vv % mod + mod); }
    modular &s(uint vv) {
        v = vv < mod ? vv : vv - mod;
        return *this;
    }
    modular operator-() const { return modular() - *this; }
    modular &operator+=(const modular &rhs) { return s(v + rhs.v); }
    modular &operator-=(const modular &rhs) { return s(v + mod - rhs.v); }
    modular &operator*=(const modular &rhs) {
        v = ull(v) * rhs.v % mod;
        return *this;
    }
    modular &operator/=(const modular &rhs) { return *this *= rhs.inv(); }
    modular operator+(const modular &rhs) const { return modular(*this) += rhs; }
    modular operator-(const modular &rhs) const { return modular(*this) -= rhs; }
    modular operator*(const modular &rhs) const { return modular(*this) *= rhs; }
    modular operator/(const modular &rhs) const { return modular(*this) /= rhs; }
    modular pow(int n) const {
        modular res(1), x(*this);
        while (n) {
            if (n & 1) res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }
    modular inv() const { return pow(mod - 2); }
    /*modular inv()const{
                int x,y;
                int g=extgcd(v,mod,x,y);
                assert(g==1);
                if(x<0)x+=mod;
                return modular(x);
        }*/
    friend modular operator+(int x, const modular &y) { return modular(x) + y; }
    friend modular operator-(int x, const modular &y) { return modular(x) - y; }
    friend modular operator*(int x, const modular &y) { return modular(x) * y; }
    friend modular operator/(int x, const modular &y) { return modular(x) / y; }
    friend ostream &operator<<(ostream &os, const modular &m) { return os << m.v; }
    friend istream &operator>>(istream &is, modular &m) {
        ll x;
        is >> x;
        m = modular(x);
        return is;
    }
    bool operator<(const modular &r) const { return v < r.v; }
    bool operator==(const modular &r) const { return v == r.v; }
    bool operator!=(const modular &r) const { return v != r.v; }
    explicit operator bool() const { return v; }
};

// 59501818244292734739283969=5.95*10^25 までの値を正しく計算
//最終的な列の大きさが 2^24 までなら動く
//最終的な列の大きさが 2^20 以下のときは，下の 3 つの素数を使ったほうが速い（は？）
// VERIFY: yosupo
namespace arbitrary_convolution {
constexpr modinfo base0{167772161, 3};  // 2^25 * 5 + 1
constexpr modinfo base1{469762049, 3};  // 2^26 * 7 + 1
constexpr modinfo base2{754974721, 11}; // 2^24 * 45 + 1
// constexpr modinfo base0{1045430273,3};//2^20 * 997 + 1
// constexpr modinfo base1{1051721729,6};//2^20 * 1003 + 1
// constexpr modinfo base2{1053818881,7};//2^20 * 1005 + 1
using mint0 = modular<base0>;
using mint1 = modular<base1>;
using mint2 = modular<base2>;
template <class t, class mint> vc<t> sub(const vc<mint> &x, const vc<mint> &y, bool same = false) {
    int n = si(x) + si(y) - 1;
    int s = 1;
    while (s < n) s *= 2;
    vc<t> z(s);
    rep(i, si(x)) z[i] = x[i].v;
    inplace_fmt(z, false);
    if (!same) {
        vc<t> w(s);
        rep(i, si(y)) w[i] = y[i].v;
        inplace_fmt(w, false);
        rep(i, s) z[i] *= w[i];
    } else {
        rep(i, s) z[i] *= z[i];
    }
    inplace_fmt(z, true);
    z.resize(n);
    return z;
}
template <class mint> vc<mint> multiply(const vc<mint> &x, const vc<mint> &y, bool same = false) {
    auto d0 = sub<mint0>(x, y, same);
    auto d1 = sub<mint1>(x, y, same);
    auto d2 = sub<mint2>(x, y, same);
    int n = si(d0);
    vc<mint> res(n);
    static const mint1 r01 = mint1(mint0::mod).inv();
    static const mint2 r02 = mint2(mint0::mod).inv();
    static const mint2 r12 = mint2(mint1::mod).inv();
    static const mint2 r02r12 = r02 * r12;
    static const mint w1 = mint(mint0::mod);
    static const mint w2 = w1 * mint(mint1::mod);
    rep(i, n) {
        ull a = d0[i].v;
        ull b = (d1[i].v + mint1::mod - a) * r01.v % mint1::mod;
        ull c = ((d2[i].v + mint2::mod - a) * r02r12.v + (mint2::mod - b) * r12.v) % mint2::mod;
        res[i].v = (a + b * w1.v + c * w2.v) % mint::mod;
    }
    return res;
}
} // namespace arbitrary_convolution
using arbitrary_convolution::multiply;

constexpr modinfo base{MOD, 0};
using mint = modular<base>;
/* #endregion */

// Problem
void solve() {
    VAR(ll, n, m); //
    vll a(n), b(m);
    cin >> a >> b;

    vc<mint> aa(n), bb(m);
    REP(i, 0, n) aa[i] = a[i];
    REP(i, 0, m) bb[i] = b[i];

    vc<mint> ret = arbitrary_convolution::multiply(aa, bb, false);
    // dump(ret);
    cout >> ret;
}

// entry point
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 35416