시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 470 103 77 22.781%

문제

알고스팟어는 알고스팟 커뮤니티에서 사용하는 언어다. 이 언어는 영어 알파벳을 사용하지만, 영어와 알파벳 순서는 다르다.

알고스팟어의 단어의 목록이 주어졌을 때, 알고스팟어의 알파벳 순서를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 단어의 개수 N (N ≤ 100)이 주어진다. 다음 N개 줄에는 알고스팟어 단어가 하나씩 주어진다. 단어의 길이는 최대 10이며, 소문자로만 이루어져 있다.

출력

첫째 줄에 알고스팟어의 알파벳 순서를 출력한다. 만약, 올바른 순서가 없다면 "!"를, 가능한 순서가 한 개 이상이라면 "?"를 출력한다.

예제 입력 1

5
ula
uka
klua
kula
al

예제 출력 1

luka

예제 입력 2

4
jaja
baba
baja
beba

예제 출력 2

!

예제 입력 3

3
marko
darko
zarko

예제 출력 3

?
W3sicHJvYmxlbV9pZCI6IjI4NDgiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1NGNcdWFjZTBcdWMyYTRcdWQzMWZcdWM1YjQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzU0Y1x1YWNlMFx1YzJhNFx1ZDMxZlx1YzViNFx1YjI5NCBcdWM1NGNcdWFjZTBcdWMyYTRcdWQzMWYgXHVjZWU0XHViYmE0XHViMmM4XHVkMmYwXHVjNWQwXHVjMTFjIFx1YzBhY1x1YzZhOVx1ZDU1OFx1YjI5NCBcdWM1YjhcdWM1YjRcdWIyZTQuIFx1Yzc3NCBcdWM1YjhcdWM1YjRcdWIyOTQgXHVjNjAxXHVjNWI0IFx1YzU0Y1x1ZDMwY1x1YmNiM1x1Yzc0NCBcdWMwYWNcdWM2YTlcdWQ1NThcdWM5YzBcdWI5Y2MsIFx1YzYwMVx1YzViNFx1YzY0MCBcdWM1NGNcdWQzMGNcdWJjYjMgXHVjMjFjXHVjMTFjXHViMjk0IFx1YjJlNFx1Yjk3NFx1YjJlN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