Octagons

Time limit1sMemory limit128 MB

Problem

Below is a picture of an infinite hyperbolic tessellation of octagons. If we regard it as a graph of vertices (each of degree three), then there is a graph isomorphism mapping any vertex $x$ onto any other vertex $y$. Every edge is given a label from the set ${a, b, c}$ so that every vertex has all three types of edge incident on it, and the labels alternate around each octagon. Part of this labeling is shown in the diagram.

Thus a path in this graph (starting from any vertex) can be described by a sequence of edge labels. Your task is to write a program that, given a sequence of labels such as "abcbcbcabcaccabb", prints "closed" if the path ends at the same vertex where it started, and prints "open" otherwise.

Input

The first line of input contains a single integer $Z$ ($Z \le 200$). It is followed by $Z$ lines, each a sequence of length at least $1$ and at most $40$ consisting of the characters 'a', 'b', and 'c'.

Output

For each input instance, print "closed" or "open" on a line by itself, according to whether the path is closed or open.