PivotOJ

ABECEDA

시간 제한: 1000ms메모리 제한: 128MB출처: COCI 2010-2011BOJ 2848

문제

A list of words written in some unknown alphabet was found. It is known, however, that these words are in alphabetic order.

Write a program that will find the unique alphabetic ordering of used letters, or determine that no such ordering exists or that there is more than one possible solution.

입력

The first line of input contains a positive integer N (N ≤ 100), the number of words.

The following N lines contain the list of words found, one word per line. Each word consists of at most 10 lowercase letters.

출력

The first and only line of output should contain all letters in alphabetic order. If no such ordering exists, output ‘!’. If there is more than one solution, output ‘?’.

예제

예제 1

입력
5
ula
uka
klua
kula
al
출력
luka

예제 2

입력
4
jaja
baba
baja
beba
출력
!

예제 3

입력
3
marko
darko
zarko
출력
?
코드를 제출하려면 로그인하세요.