1360_F. Spy-string
You are given n strings a_1, a_2, …, a_n: all of them have the same length m. The strings consist of lowercase English letters.

Find any string s of length m such that each of the given n strings differs from s in at most one position. Formally, for each given string a_i, there is no more than one position j such that a_i[j] ≠ s[j].

Note that the desired string s may be equal to one of the given strings a_i, or it may differ from all the given strings.

For example, if you have the strings abac and zbab, then the answer to the problem might be the string abab, which differs from the first only by the last character, and from the second only by the first.

Input

The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases. Then t test cases follow.

Each test case starts with a line containing two positive integers n (1 ≤ n ≤ 10) and m (1 ≤ m ≤ 10) — the number of strings and their length.

Then follow n strings a_i, one per line. Each of them has length m and consists of lowercase English letters.

Output

Print t answers to the test cases. Each answer (if it exists) is a string of length m consisting of lowercase English letters. If there are several answers, print any of them. If the answer does not exist, print "-1" ("minus one", without quotes).

Example

Input


5
2 4
abac
zbab
2 4
aaaa
bbbb
3 3
baa
aaa
aab
2 2
ab
bb
3 1
a
b
c


Output


abab
-1
aaa
ab
z

Note

The first test case was explained in the statement.

In the second test case, the answer does not exist.
```python
# cook your dish here
#code
import math
import collections
from sys import stdin,stdout,setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2**20)
 
 
def strcmp(s1,s2,m):
    cnt = 0
    for i in range(m):
        if(s1[i]!=s2[i]):
            cnt+=1
            
    return cnt
    
 
t = int(stdin.readline())
 
for _ in range(t):
    #n = int(stdin.readline())
    
    n, m = list(map(int, stdin.readline().rstrip().split()))
    a = []
    for i in range(n):
        a.append(stdin.readline().split()[0])
    
    if(m==1):
        print(a[0])
        continue
    else:
        ans = -1
        if(n==2):
            l = []
            for i in range(m):
                if(a[0][i]!=a[1][i]):
                    l.append(i)
            if(len(l)>=3):
                ans = -1
            else:
                if(len(l)==1 or len(l)==0):
                    ans=a[0]
                else:
                    ans = ''
                    for i in range(m):
                        if(i==l[0]):
                            ans+=a[1][i]
                        else:
                            ans+=a[0][i]
            print(ans)
            continue
        else:
            d = [[0]*n for i in range(n)]
            
            for i in range(n):
                for j in range(i+1,n):
                    d[i][j] = strcmp(a[i],a[j],m)
                    d[j][i] = d[i][j]
                    
            pos = -1
            for i in range(n):
                mx = -1
                for j in range(n):
                    mx = max(mx,d[i][j])
                if(mx<=1):
                    pos = i
                    break
                if(mx==2):
                    pos = -1
                    for j in range(n):
                        if(d[i][j]==2):
                            pos = j
                            break
                    l = []
                    for k in range(m):
                        if(a[i][k]!=a[pos][k]):
                            l.append(k)
                    ans = ''
                    for k in range(m):
                        if(k==l[0]):
                            ans+=a[pos][k]
                        else:
                            ans+=a[i][k]
                            
                    mx = -1
                    for k in range(n):
                        mx = max(mx,strcmp(ans,a[k],m))
                        
                    if(mx<=1):
                        a[pos] = ans
                        break
                    else:
                        pos = -1
                                
                            
                        
                            
                    
            if(pos==-1):
                print(pos)
            else:
                print(a[pos])
    

```