A set of words is a word chain if all the words from the set are of the same length and two consecutive words from the set each differ one letter from each other. The order of the letters is important, in the sense that at any position of the two words every single letter has to be the same, except at a single position where there is a different letter. If all the consecutive words from a sequence differ one letter from each other each time, regardless of the order in which the letters appear in any two consecutive words, it is called a semi-word chain. Note that a word chain is also a semi-word chain, but not vice versa.
The first line of the input contains an integer $$n \in \mathbb{N}$$. This is followed by $$n$$ words that consist only of uppercase letters and are each on a separate line.
If the set of words is a word chain, you print word chain to the output. If the sequence is not a word chain, but a semi-word chain, you print the term semi-word chain to the output. Otherwise, you print no word chain to the output.
Input:
20
KOLDER
HOLDER
HELDER
HERDER
VERDER
VERVER
VERSER
VELSER
VELTER
VESTER
TESTER
OESTER
MESTER
HESTER
LESTER
PESTER
BESTER
KESTER
KENTER
KETTER
Output:
word chain
Input:
18
GEOGRAAF
ROGGEAAR
OVERGAAG
OVERGAAN
AANVOEGT
TOVENAAR
VETERAAN
RELEVANT
AFVRETEN
AFVOEREN
AFROEPEN
AFPOEIER
AFROEIDE
AFVOERDE
VERTOEFD
DRIEVOET
VERMOEID
OVERHEMD
Output:
semi-word chain