The Braille system, designed by Louis Braille in 1825, transformed written communication for blind and visually impaired people. Braille, who was himself blind, devised a tactile writing system in which each symbol is a cell of six dot positions arranged in three rows and two columns. Every dot position is either raised or flat, giving 64 possible patterns that trained fingers can read.
You must build a Braille dictionary module that converts messages made up only of decimal digits to or from Braille. Each decimal digit corresponds to exactly one Braille cell, as shown below. A raised dot is written as *, a flat dot as ., and each cell is written as three rows of two characters:
digit row1 row2 row3
0 .* ** ..
1 *. .. ..
2 *. *. ..
3 ** .. ..
4 ** .* ..
5 *. .* ..
6 ** *. ..
7 ** ** ..
8 *. ** ..
9 .* *. ..
Given a message composed only of digits, translate it either to Braille or from Braille.
The input contains several test cases. Each test case is given on three or five lines:
S or B.
S, the next single line contains a message of $D$ decimal digits that you must translate to Braille.B, the next three lines contain a message of $D$ Braille cells that you must translate from Braille. On each line the cells are separated by single spaces; within a cell a raised position is * and a flat position is ..The input ends with a line containing a single zero, which is not a test case.
For each test case, print the translated message in the same format as the input:
S (digits to Braille), print the $D$ Braille cells on three lines, with cells separated by single spaces.B (Braille to digits), print the $D$ decimal digits on a single line.