Hide

# Problem GMoving Pianos

A piano tuner indeed has a hard time earning his living. (Un)fortunately, most people want their pianos tuned only when they move to a new place, and thus also someone to help them move the piano. Therefore, quite a few piano -tuners combine their profession with lifting and transporting pianos. However, as you might guess, they are not all that keen on doing a lot of heavy-weight carrying in a day, and they certainly don’t want to work weekends! In the city of Hampstead, the small group of piano tuners have joined forces, and they help each other by taking turns in moving the pianos. No piano tuner transports more than one piano a day under any circumstance, and they always work in pairs.

As with most craftsmen, you seldom get to know precisely when the job you request will be carried out. Instead, when ordering a piano move, you are given an arbitrary long time interval containing your desired moving day, during which your piano is guaranteed to be moved by the piano tuners. This strategy often makes the scheduling task easy, but this time they just might have put themselves in some trouble. During the last days, the piano tuners have received a lot of piano move orders for the next $100$ days, and they are afraid that even if they work weekends they cannot keep their promises. To help them see if this is the case, and to avoid it in the future, they would like a computer program testing different scenarios.

## Input

On the first line is a single positive integer $n \le 100$, specifying the number of test scenarios to follow. Each scenario begin with two positive integers $m$ and $p$ on a line of their own, $m \le 1000$, telling the number of pianos to be moved, and $p \le 2000$ the number of piano tuners. Then follow $m$ lines, each containing a piano move order on the format of two integers $b_ i$ and $e_ i$ with $1 \le b_ i \le e_ i \le 100$ meaning that between the beginning of day $b_ i$ and the end of day $e_ i$, the piano $i$ must be moved. Day 1 is always a Monday, 2 a Tuesday and so on.

## Output

For each test scenario, output the text “serious trouble” if the list of piano move orders cannot be executed as promised even if all the $p$ pianotuners worked every day, the text “weekend work” if at least two piano tuners have to work some Saturday or Sunday, or the text “fine” if it is possible to carry out all the moves during the five working days of the weeks.

Sample Input 1 Sample Output 1
3
3 2
4 5
5 6
5 7
2 5
49 50
50 50
4 2
8 10
8 10
8 10
8 10

weekend work
fine
serious trouble

Hide