시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 0 0 0 0.000%

문제

Consider a set of k strings {S1, S2, . . . , Sk} where every character used in the k strings is either a space or any of the 26 characters in { ‘a’, ‘b’, ‘c’, . . ., ‘z’ }. For some constants ℓ and d, our aim is to compute an (ℓ, d)-pattern for {S1, S2, . . . , Sk}. An (ℓ, d)-pattern is a length-ℓ string W = W[1]W[2] . . . W[ℓ] which satisfies the following property:

  • For every string Si (i = 1, 2, . . . , k), there exists a length-ℓ substring X = X[1]X[2] . . . X[ℓ] of Si such that the hamming distance of X and W is less than or equal to d. (The hamming distance of X and W is the number of pairs of (X[j], W[j]) such that X[j] ≠ W[j], for j = 1, 2, . . . , ℓ.)

In this task, you are given numbers ℓ and d and a set of strings; you need to compute an (ℓ, d)-pattern for the given set of strings. You can assume that an (ℓ, d)-pattern exists and is unique.

입력

The first line contains two integers ℓ and d separated by a space, where 1 ≤ ℓ ≤ 10 and 0 ≤ d ≤ 2. The second line contains the integer k, where 1 ≤ k ≤ 30. The remaining k lines contain the k strings S1, S2, . . . , Sk. (Each string is of length at most 50.)

출력

The output file contains a string of length ℓ.

This string represents an (ℓ, d)-pattern for the set of strings and ℓ and d given in the input file. The input is always such that there exists exactly one (ℓ, d) pattern.

예제 입력 1

5 1
4
you have two applas
i am an ppple
we are acples
adples are good for health

예제 출력 1

apple

예제 입력 2

3 0
3
oil is expensive
we have three oilers
be more oily

예제 출력 2

oil