#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int na,ma;
struct node
{
    int p,r,d;
}job[110];
const int maxn=1000;
struct Edge
{
    int from,to,cap,flow;
};
struct Dinic
{

    int s,t,m;
    vector<Edge> edges;
    vector<int> G[maxn];
    bool vis[maxn];
    int d[maxn];
    int cur[maxn];
    void init(int n)
    {
        for (int i=0;i<=n;i++){
            G[i].clear();
        }
        edges.clear();
    }
    void addedge(int from,int to,int cap)
    {
        edges.push_back((Edge){from,to,cap,0});
        edges.push_back((Edge){to,from,0,0});
        m=edges.size();
        G[from].push_back(m-2);
        G[to].push_back(m-1);
    }
    bool bfs(){
        memset(vis,0,sizeof vis);
        queue<int>Q;
        Q.push(s);
        d[s]=0;
        vis[s]=1;
        while (!Q.empty())
        {
            int u=Q.front();Q.pop();
            //cout<<u<<endl;
            for (int i=0;i<G[u].size();i++){
                Edge& e=edges[G[u][i]];
                if (!vis[e.to] && e.cap>e.flow){
                    vis[e.to]=1;
                    d[e.to]=d[u]+1;
                    Q.push(e.to);
                }
               // if (e.cap>e.flow)
              //  cout<<e.to<<" "<<e.cap<<" "<<e.flow<<endl;
            }
        }
        return vis[t];
    }
    int DFS(int x,int a)
    {
        cout<<x<<endl;
        if (x==t || a==0 ) return a;
        int flow=0,f;
        for (int&i=cur[x];i<G[x].size();i++){
            Edge& e =edges[G[x][i]];
            if (d[x]+1==d[e.to] && (f=DFS(e.to,min(a,e.cap-e.flow))>0)){
               //cout<<e.cap-e.flow<<" qwer "<<endl;
                e.flow+=f;
                edges[G[x][i]^1].flow-=f;
                flow+=f;
                cout<<x<<" "<<e.to<<" @@@ "<<flow<<endl;
                a-=f;
                if (a==0) break;
            }
        }
        return flow;
    }
    int maxflow(int s,int t){
        this->s=s;this->t=t;
        int flow=0;
        while (bfs()){
            memset(cur,0,sizeof cur);
            cout<<"============"<<endl;
            flow+=DFS(s,10000000);
            cout<<"flow"<<endl;
            cout<<flow<<endl;
            cout<<"------------"<<endl;
        }
        return flow;
    }
}dinic;
int main()
{
    int ta;
    scanf("%d",&ta);
    while (ta--)
    {
        scanf("%d%d",&na,&ma);
        int cur=0;
        for (int i=1;i<=na;i++){
            scanf("%d%d%d",&job[i].p,&job[i].r,&job[i].d);
            cur+=job[i].p;
        }
        if (ma>=na){
            puts("Boss xnby is happy!");
            continue;
        }
        dinic.init(maxn-1);
        for (int i=1;i<=na;i++){
            dinic.addedge(0,i,job[i].p);
        }
        for (int i=1;i<=na;i++){
            for (int j=job[i].r;j<=job[i].d;j++){
                dinic.addedge(i,200+j,1);
            }
        }
        for (int i=1;i<=200;i++){
            dinic.addedge(200+i,maxn-1,ma);
        }
        int res=dinic.maxflow(0,maxn-1);
        cout<<res<<endl;
        cout<<cur<<endl;
        if (res>=cur){
             puts("Boss xnby is happy!");
        }
        else{
            puts("Boss xnby is angry!");
        }
    }
    return 0;
}