Rock-Paper-Scissors Tournament

Time limit1sMemory limit256 MB

Problem

Rock-Paper-Scissors is a game for two players, A and B, who each independently choose one of rock, paper, or scissors. Paper beats rock, scissors beats paper, and rock beats scissors. If both players choose the same thing, neither wins nor loses (a tie).

A tournament is held with $n$ players. Every player plays $k$ games of Rock-Paper-Scissors against each of the other players, for a total of $\dfrac{k \cdot n \cdot (n-1)}{2}$ games.

Compute the win average of each player, defined as $\dfrac{w}{w+l}$, where $w$ is the number of games the player won and $l$ is the number of games the player lost (ties are not counted).

Print each win average rounded to three decimal places, rounding halves up. If a player's win average is undefined (that is, $w + l = 0$), print - instead.

Input

The input consists of several test cases. The first line of each test case contains two integers $n$ and $k$ ($1 \le n \le 100$, $1 \le k \le 100$). Then, for each game, one line follows in the format p1 m1 p2 m2: $p_1$ and $p_2$ ($1 \le p_1, p_2 \le n$, $p_1 \ne p_2$) are the numbers of the two players, and $m_1$ and $m_2$ are their respective moves, each one of rock, scissors, or paper. Each test case contains exactly $\dfrac{k \cdot n \cdot (n-1)}{2}$ game lines. A line containing a single 0 follows the last test case.

Output

For each test case, print the win average of player 1, player 2, and so on through player $n$, one per line, each rounded to three decimal places. If a win average is undefined, print -. Print one empty line between the outputs of consecutive test cases.