Boss Xnbys Scheduling Problem

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

  Boss xnby owns a company, as you know, in the company there are lots of jobs to do.Each job J has a processing requirement pj (denoting the number of machine days required to complete the job), a release date rj (representing the beginning of the day when job j becomes avalible for processing), and a due date dj ≥ rj + pj (representing the beginning of the day by which the job must be completed). What could we do when facing so many jobs? Thank goodness, in xnby’s company, there are some parallel machines can do these jobs.Since a machine can work on only one job at a time and each job can be processed by at most one machine at a time.And preemptions(i.e., we can interrupt a job and process it on different machines on different days) is allowed.Now xnby can use these parallel machines to process these boring jobs,but he also need to determine a feasible schedule that completes all jobs before their due dates or show no such schedule existd.Xnby is a boss, he is a big shot, he had no time to do with these trivial things, so he arranged for you to do this task. 

Input

  An integer T (T ≤ 100) indicated the number of test cases.
  For each test cases:
  Two integers J and M (J ≤ 100, M ≤ 100) denote jobs and machines respectively.
  In the following J lines(each job one line, in ascending order), each line contains three integers p, r, d (p ≤ 100,r ≤ 100 and d ≤ 200) denote processing requirement, release date and due date respectively.

Output

 For each test case, output “Boss xnby is angry!” if no such schedule exists.Otherwise output “Boss xnby is happy!”.  

Sample Input

1
4 3
2 3 5
1 1 4
2 3 7
4 5 9

Sample Output

Boss xnby is happy!

Hint

 

Source

2010湖南大学校赛