#include <iostream>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
const int N = 1e5+10;
struct Seg{
int g,l,r;
};
long long a[N];
long long q[N];
long long exec[N];
Seg seg[N];
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
for(int i=0;i<N;i++)a[i]=0,q[i]=0,exec[i]=0,seg[i].g=0,seg[i].l=0,seg[i].r=0;
int n,m;
cin>>n>>m;
q[m+1]=0;
a[n+1]=0;
for(int i=0;i<=m+1;i++)q[i]=0,exec[i]=0;
for(int i=0;i<=n+1;i++)a[i]=0;
for(int i=1;i<=m;i++){
cin>>seg[i].g>>seg[i].l>>seg[i].r;
}
for(int i=m;i>=1;i--){
q[i]+=q[i+1];
exec[i]+=1+q[i];
if(seg[i].g==2){
q[seg[i].r]+=q[i]+1;
q[seg[i].l-1]-=(q[i]+1);
}
}
for(int i=m;i>=1;i--){
if(seg[i].g==1){
a[seg[i].l]+=exec[i];
a[seg[i].r+1]-=exec[i];
}
}
for(int i=1;i<=n;i++){
a[i]+=a[i-1];
if(a[i]>MOD)a[i]%=MOD;
if(a[i]<-MOD){
a[i]%=MOD;
}
}
for(int i=1;i<=n;i++)if(a[i]>=0)cout<<(a[i]+MOD)%MOD<<" ";
cout<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CmNvbnN0IGxsIE1PRCA9IDFlOSs3Owpjb25zdCBpbnQgTiA9IDFlNSsxMDsKc3RydWN0IFNlZ3sKICAgIGludCBnLGwscjsKfTsKbG9uZyBsb25nIGFbTl07CmxvbmcgbG9uZyBxW05dOwpsb25nIGxvbmcgZXhlY1tOXTsKU2VnIHNlZ1tOXTsKaW50IG1haW4oKQp7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTtjaW4udGllKDApO2NvdXQudGllKDApOwoKICAgIGludCB0OwogICAgY2luPj50OwogICAgd2hpbGUodC0tKXsKICAgICAgICBmb3IoaW50IGk9MDtpPE47aSsrKWFbaV09MCxxW2ldPTAsZXhlY1tpXT0wLHNlZ1tpXS5nPTAsc2VnW2ldLmw9MCxzZWdbaV0ucj0wOwogICAgICAgIGludCBuLG07CiAgICAgICAgY2luPj5uPj5tOwoKICAgICAgICBxW20rMV09MDsKICAgICAgICBhW24rMV09MDsKICAgICAgICBmb3IoaW50IGk9MDtpPD1tKzE7aSsrKXFbaV09MCxleGVjW2ldPTA7CiAgICAgICAgZm9yKGludCBpPTA7aTw9bisxO2krKylhW2ldPTA7CiAgICAgICAgZm9yKGludCBpPTE7aTw9bTtpKyspewogICAgICAgICAgICBjaW4+PnNlZ1tpXS5nPj5zZWdbaV0ubD4+c2VnW2ldLnI7CiAgICAgICAgfQogICAgICAgIGZvcihpbnQgaT1tO2k+PTE7aS0tKXsKICAgICAgICAgICAgcVtpXSs9cVtpKzFdOwogICAgICAgICAgICBleGVjW2ldKz0xK3FbaV07CiAgICAgICAgICAgIGlmKHNlZ1tpXS5nPT0yKXsKICAgICAgICAgICAgICAgIHFbc2VnW2ldLnJdKz1xW2ldKzE7CiAgICAgICAgICAgICAgICBxW3NlZ1tpXS5sLTFdLT0ocVtpXSsxKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9bTtpPj0xO2ktLSl7CgogICAgICAgICAgICBpZihzZWdbaV0uZz09MSl7CiAgICAgICAgICAgICAgICBhW3NlZ1tpXS5sXSs9ZXhlY1tpXTsKICAgICAgICAgICAgICAgIGFbc2VnW2ldLnIrMV0tPWV4ZWNbaV07CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIGZvcihpbnQgaT0xO2k8PW47aSsrKXsKICAgICAgICAgICAgYVtpXSs9YVtpLTFdOwogICAgICAgICAgICBpZihhW2ldPk1PRClhW2ldJT1NT0Q7CiAgICAgICAgICAgIGlmKGFbaV08LU1PRCl7CiAgICAgICAgICAgICAgICAgICAgYVtpXSU9TU9EOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvcihpbnQgaT0xO2k8PW47aSsrKWlmKGFbaV0+PTApY291dDw8KGFbaV0rTU9EKSVNT0Q8PCIgIjsKICAgICAgICBjb3V0PDwiXG4iOwoKICAgIH0KCgoKCiAgICByZXR1cm4gMDsKfQo=