Types: n: int, s: str, t: str, b: str

Ranges: 0 ≤ n ≤ 15, s in {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'}, t in {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'}, b in {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'}

Addtl Info: n = 0 indicates the end of input, s, t, b are distinct, at most 100 datasets