In Braille

No attempts yetTime limit1sMemory limit128 MB

Problem

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.

Input

The input contains several test cases. Each test case is given on three or five lines:

  • The first line contains an integer $D$, the number of digits in the message ($1 \le D \le 100$).
  • The second line contains a single uppercase letter, S or B.
    • If it is S, the next single line contains a message of $D$ decimal digits that you must translate to Braille.
    • If it is 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.

Output

For each test case, print the translated message in the same format as the input:

  • If the test case was S (digits to Braille), print the $D$ Braille cells on three lines, with cells separated by single spaces.
  • If the test case was B (Braille to digits), print the $D$ decimal digits on a single line.