Sierpinski Triangle

Time limit1sMemory limit128 MB

Problem

Wacław Sierpiński was a Polish mathematician. He decided to construct triangles by repeating the following process.

  • Draw an equilateral triangle T.
  • Connect the midpoints of its sides, splitting it into four smaller equilateral triangles named T1, T2, T3, and T4. The left picture below shows this step.
  • Repeat the same process for T1, T2, and T3. The newly created triangles are named T11, T12, T13, T14, T21, T22, T23, T24, T31, T32, T33, and T34.
  • Continue repeating the process for every triangle whose name ends in 1, 2, or 3. The resulting fractal is called the Sierpinski triangle.

Triangle A is said to lean on triangle B if B does not contain A, and one whole side of A is part of one side of B. For example, T23 leans on T24 and T4, but not on T2 or T32. If A leans on B, that does not imply that B leans on A.

Given a triangle A in the Sierpinski triangle, find every triangle B that A leans on.

Input

The first line contains the name of triangle A. The name has length at least 2 and at most 50.

Output

Print the name of every triangle that A leans on, one per line. The names may be printed in any order.