#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 998244353
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

template<int MOD>
struct NumberTheoreticTransform{
    vector<int> rev,rts;
    int base,max_base,root;
    // (924844033, 5), (998244353, 3), (1012924417, 5), (167772161, 3), (469762049, 3), (1224736769, 3)
    // rts[4]=exp(i0),rts[5]=exp(iπ/4),rts[6]=exp(i2π/4)...
    // rts[8]=exp(i0),rts[9]=exp(iπ/8),rts[10]=exp(i2π/8)...
    NumberTheoreticTransform():base(1),rev{0,1},rts{0,1}{
        auto tmp=MOD-1;
        max_base=0;
        while(tmp%2==0)tmp>>=1,max_base++;// MOD-1=2^max_base*tmp
        root=2;
        while(pow_mod(root,(MOD-1)>>1)==1) root++;
        assert(pow_mod(root,MOD-1)==1);
        root=pow_mod(root,(MOD-1)>>max_base);
    }
    inline int pow_mod(int x,int n){
        int ret=1;
        while(n){
            if(n&1)ret=mul(ret,x);
            x=mul(x,x);
            n>>=1;
        }
        return ret;
    }
    inline int inv_mod(int x){
        return pow_mod(x,MOD-2);
    }
    inline unsigned add(unsigned x,unsigned y){
        x+=y;
        if(x>=MOD)x-=MOD;
        return x;
    }
    inline unsigned mul(unsigned x,unsigned y){
        return 1ull*x*y%(unsigned long long)MOD;
    }
    void ensure_base(int nbase){
        if(nbase<=base)return ;
        rev.resize(1<<nbase);
        rts.resize(1<<nbase);
        for(int i=0;i<(1<<nbase);i++)rev[i]=(rev[i>>1]>>1)+((i&1)<<(nbase-1));
        while(base<nbase){
            int z=pow_mod(root,1<<(max_base-1-base));
            for(int i=1<<(base-1);i<(1<<base);i++){
                rts[i<<1]=rts[i];
                rts[(i<<1)+1]=mul(rts[i],z);
            }
            base++;
        }
    }
    void ntt(vector<int>&a){
        const int n=(int)a.size();
        int zeros=__builtin_ctz(n);
        ensure_base(zeros);
        int shift=base-zeros;
        for(int i=0;i<n;i++){
            if(i<(rev[i]>>shift)) swap(a[i],a[rev[i]>>shift]);
        }
        // バタフライ演算
        for(int k=1;k<n;k<<=1){
            for(int i=0;i<n;i+=2*k){
                for(int j=0;j<k;j++){
                    int z=mul(a[i+j+k],rts[j+k]);
                    a[i+j+k]=add(a[i+j],MOD-z);
                    a[i+j]=add(a[i+j],z);
                }
            }
        }
    }
    vector<int> multiply(vector<int> a,vector<int> b){
        int need=(int)a.size()+b.size()-1;
        int nbase=1;
        while((1<<nbase)<need)nbase++;
        ensure_base(nbase);
        int sz=1<<nbase;
        a.resize(sz,0);
        b.resize(sz,0);
        ntt(a);
        ntt(b);
        int inv_sz=inv_mod(sz);
        for(int i=0;i<sz;i++) a[i]=mul(a[i],mul(b[i],inv_sz));
        reverse(a.begin()+1,a.end());
        ntt(a);
        a.resize(need);
        return a;
    }
};



signed main(){
    int n,m;cin>>n>>m;
    vector<int> a(n),b(m);
    cin>>a>>b;
    
    NumberTheoreticTransform<mod> NTT;
    auto res=NTT.multiply(a,b);
    rep(i,(int)res.size()) cout<<res[i]<<(i+1==(int)res.size()?"\n":" ");
    return 0;
}

Measured memory_bytes: 27304