Moving Pianos

No attempts yetTime limit1sMemory limit128 MB

Problem

Piano tuners in the city of Hampstead not only tune pianos but also move them, taking turns so that no one carries too much. The following rules apply to every move:

  • Tuners always work in pairs; moving one piano requires exactly two tuners.
  • No tuner moves more than one piano on any given day.
  • Consequently, with $p$ tuners at most $\lfloor p/2 \rfloor$ pianos can be moved per day.

When placing an order you are not told the exact day. Instead, the order for piano $i$ is an interval $[b_i, e_i]$: the piano must be moved on some single day between the beginning of day $b_i$ and the end of day $e_i$.

Day 1 is always a Monday, day 2 a Tuesday, and so on, so days 6 and 7 are the weekend (Saturday and Sunday); this pattern repeats every week.

For each scenario, decide which of the following holds:

  • fine — all pianos can be moved using only the five weekdays (Monday–Friday).
  • weekend work — it is impossible on weekdays alone, but possible if the weekend is also used.
  • serious trouble — it is impossible even when all seven days of every week are used.

Input

The first line contains a single positive integer $n$, the number of scenarios.

Each scenario begins with a line containing two positive integers $m$ and $p$: $m \le 1000$ is the number of pianos to move, and $p \le 2000$ is the number of tuners.

Then follow $m$ lines. The $i$-th line contains two integers $b_i$ and $e_i$ with $1 \le b_i \le e_i \le 100$, meaning piano $i$ must be moved between the beginning of day $b_i$ and the end of day $e_i$.

Output

For each scenario, print exactly one of the following on its own line:

  • fine if all moves can be carried out during the five weekdays;
  • weekend work if that is impossible and at least two tuners must work on some Saturday or Sunday;
  • serious trouble if the orders cannot be fulfilled as promised even when all $p$ tuners work every day.