#include using namespace std; #define modulo 998244353 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000000 int main(){ int N,Q; cin>>N>>Q; vector A(N); for(int i=0;i> dp(N+1,vector(N+1,0)); dp[0][0] = 1; for(int i=0;i S(N+1,1); for(int i=0;i>l>>r>>p; int ans = 0; int t = 0; for(int j=l;j<=r;j++){ int ind = distance(lower_bound(A.begin(),A.end(),j),A.end()); int t = dp[ind][p]; t = mod(t * S[N-ind]); ans ^=t; } cout<