The distant island of Googlia has two cities. Everyone from Truthtown always tells the truth, and everyone from Liarville always lies. While exploring Googlia you meet N inhabitants, and you want to work out which city each one comes from.
You first number these people from 1 to N. You then question them one by one and record their M statements in the shorthand below.
| Shorthand | Meaning |
|---|---|
| i T j | Person i says, "Person j is from Truthtown." |
| i L j | Person i says, "Person j is from Liarville." |
| i S j k | Person i says, "Persons j and k are from the same city." |
| i D j k | Person i says, "Persons j and k are from different cities." |
Deduce which city each person comes from. At least one assignment consistent with all the statements is guaranteed to exist.
For example, suppose the statements are 1 D 2 3, 1 D 2 4, 1 D 3 4 and 2 L 1. Then you can reason as follows.
The first line contains the number of test cases T. T test cases follow. The first line of each test case contains the integers N and M, separated by a space. The next M lines each contain one statement from one inhabitant, written in the shorthand above.
For each test case, print one line in the form Case #x: y1 y2 ... yN, where x is the test case number starting from 1 and yi is a single character telling which city person i comes from. Separate the N characters with one space.
T.L.-.