#include long long i,j,k,l[1005],r[1005],p[1005],a[1005]; long long n,m,test,b; inline long long gcd(long long o,long long p) { if (o%p==0) return p; return gcd(p,o%p); } int main() { scanf("%I64d",&test); while (test--) { b=0; if (!test) test=0; scanf("%I64d%d",&n,&m); for (i=1;i<=n;i++) a[i]=1; for (i=1;i<=m;i++) { scanf("%I64d%d%d",&l[i],&r[i],&p[i]); for (j=l[i];j<=r[i];j++) { a[j]=a[j]*(p[i]/gcd(a[j],p[i])); if (a[j]>1000000000ll) { b=1; break; } } if (b) { continue; printf("Stupid BrotherK!\n"); } } for (i=1;i<=m;i++) { long long gt=a[l[i]]; for (j=l[i];j<=r[i];j++) gt=gcd(gt,a[j]); if (gt!=p[i]) { b=1; break; } } if (b) printf("Stupid BrotherK!\n"); else { for (i=1;i