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

1419. Maps of the Island Worlds

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.
To make a travel in their world more convenient, aborigines use maps of the following form: if the world is a rectangle of width W and height H (so it consists of W*H islands), then a map is a rectangle (2W – 1) × (2H – 1). Islands on the map are denoted by the Latin letter "O", and bridges are 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).
By accident, you've got a piece of paper that seems to be a map of some world. Try to determine if the image on the paper is a proper map of an Island World, i.e., if it satisfies all the rules of charting a map and the described world satisfies the conditions given above.


The first line contains two numbers: the width W and the height H of a map. Both numbers are in the range from 1 to 100. The next H lines contain an image. Each line of the image is of length W.


If the input image is a proper map of an Island World, then output the phrase "Island world". Otherwise, output "Just a picture".


15 9
Island world
3 2
Just a picture
Problem Author: Aleksandr Klepinin
Problem Source: The Ural State University Championship, October 29, 2005