ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Championship 2005

About     Problems     Submit solution     Judge status     Standings
Contest is over

B. 40 Islands Knights

Time limit: 1.0 second
Memory limit: 64 MB
It was senseless, amusing, and a bit terrifying. In a sea, or maybe in an ocean, or even on a planet completely covered with water there were 40 small islands. There was a castle with its own insignia and name on each island. Each island, or, more exactly, each castle was connected with three neighboring islands. Our neighbors were the Twelfth, the Twenty Fourth, and the Thirtieth islands…
This is how Sergey Lukyanenko, a famous Russian science fiction writer, describes in his novel a mysterious world where teenagers have got into. A fictitious world. Or perhaps a possible one? You are to answer this question.
Well, let's formalize the literary description of the world. Assume that the islands are located at nodes of an integer grid and form a rectangle. Every island is connected by bridges with exactly three neighboring islands (two islands are neighboring if the distance between them doesn't exceed 1.42). The bridges do not intersect and have the following property: for any two islands, there is a chain of bridges connecting them. Moreover, the destruction of any one bridge doesn't violate this property.
Try to determine what dimensions may have the rectangle of islands in order to make such a world possible.

Input

There are two numbers in the input: the width and the height of a rectangle. Both numbers are in the range from 1 to 50.

Output

If such a world is possible for the given dimensions, output a map (any one) of this world, following the agreements: an island is denoted by the Latin letter "O", a bridge is denoted by an appropriate symbol from the set "-|/\". Spaces denote an area without islands and bridges (in the example below spaces are replaced with dots in order to make it clearer).
If such a world can not exist, output the phrase "Imaginary world".

Sample

inputoutput
8 5
O-O-O-O-O-O.O-O
|\|.|..\|/|/|/|
O-O.O-O.O.O.O.O
.\././|../..|/|
O-O.O-O-O-O.O-O
|\..|..../.\..|
O-O.O.O-O-O.O-O
|/./|.|\..|\.\|
O-O-O-O-O-O-O-O
Problem Author: Aleksandr Klepinin
Problem Source: The Ural State University Championship, October 29, 2005
To submit the solution for this problem go to the Problem set: 1411. 40 Islands Knights