시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 15 2 2 16.667%

문제

주기율표와 단어가 주어졌을 때, 단어를 주기율표에 있는 원소로 나타내는 프로그램을 작성하시오. 만약, 가능한 경우가 여러가지라면, 원소를 가장 적게 써는 것을 출력한다. 그러한 경우도 여러가지라면, 단어의 원소량(사용한 원소의 번호의 합)이 가장 작은 것을 선택한다. 그러한 것도 여러가지이거나 단어를 원소 기호로 나타낼 수 없다면, "Too Obvious"를 출력한다.

원소는 항상 대문자로 시작하며, 그 뒤에 0개 또는 그 이상의 소문자가 있다.

입력

첫째 줄에 테스트 케이스의 개수가 주어진다. 각 테스트 케이스의 첫째 줄에는 원소의 수 O가 주어진다. 다음 O개 줄에는 원소가 한 줄에 하나씩 주어진다. 그 다음 줄에는 단어의 수 P가 주어진다. 다음 P개 줄에는 단어가 한 줄에 하나씩 주어진다. O와 P, 단어나 원소 이름의 길이는 5000보다 작다.

입력으로 주어지는 원소는 원소 번호 순서대로이다. 번호는 1부터 시작한고, 1씩 증가한다.

출력

단어를 주기율표의 원소로 나타낸 뒤 출력한다. 이 때, 원소를 구분하기 위해서 원소는 대괄호 ([])로 감싼다. 만약, 여러가지라면 문제 설명을 참고한다.

예제 입력 1

1
4
Ba
Na
N
A
2
banana
nan

예제 출력 1

[Ba][Na][Na]
[Na][N]
W3sicHJvYmxlbV9pZCI6IjQ1MDciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIyZThcdWM1YjRcdWM2NDAgXHVjOGZjXHVhZTMwXHVjNzI4XHVkNDVjIiwiZGVzY3JpcHRpb24iOiI8cD5cclxuXHRcdWM4ZmNcdWFlMzBcdWM3MjhcdWQ0NWNcdWM2NDAgXHViMmU4XHVjNWI0XHVhYzAwIFx1YzhmY1x1YzViNFx1Yzg0Y1x1Yzc0NCBcdWI1NGMsIFx1YjJlOFx1YzViNFx1Yjk3YyBcdWM4ZmNcdWFlMzBcdWM3MjhcdWQ0NWNcdWM1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