import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class CounterfeitCoin {
static char[][] weinfo = new char[3][];
static int[] coinfo;
static int count;
public static void main(String[] args) throws FileNotFoundException {
// TODO Auto-generated method stub
Scanner sc = new Scanner(new File("src/coin"));
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
count = 0;
coinfo = new int[12];
for (int i = 0; i < 3; i++) {
weinfo[0] = sc.next().toCharArray();
weinfo[1] = sc.next().toCharArray();
weinfo[2] = sc.next().toCharArray();
if (weinfo[2][0] == 'e') {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < weinfo[j].length; k++) {
coinfo[weinfo[j][k] - 65] = 9;
}
}
} else if (weinfo[2][0] == 'u') {
count++;
for (int k = 0; k < weinfo[0].length; k++) {
coinfo[weinfo[0][k] - 65]++;
}
for (int k = 0; k < weinfo[1].length; k++) {
coinfo[weinfo[1][k] - 65]--;
}
} else if (weinfo[2][0] == 'd') {
count++;
for (int k = 0; k < weinfo[0].length; k++) {
coinfo[weinfo[0][k] - 65]--;
}
for (int k = 0; k < weinfo[1].length; k++) {
coinfo[weinfo[1][k] - 65]++;
}
}
}
for (int i = 0; i < 12; i++) {
if (coinfo[i] == count) {
System.out.println((char) (i + 65)
+ " is the counterfeit coin and it is heavy.");
} else if (coinfo[i] == -count) {
System.out.println((char) (i + 65)
+ " is the counterfeit coin and it is light.");
}
}
}
}
}