We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices in the string).

You are given k strings s1, s2, ..., sk, and you have to restore any string s so that it is possible to obtain these strings by performing aforementioned operations. Note that the total length of the strings you are given doesn't exceed 5000 (that is, k·n ≤ 5000).

Input

The first line contains two integers k and n (1 ≤ k ≤ 2500, 2 ≤ n ≤ 5000, k · n ≤ 5000) — the number of strings we obtained, and the length of each of these strings.

Next k lines contain the strings s1, s2, ..., sk, each consisting of exactly n lowercase Latin letters.

Output

Print any suitable string s, or -1 if such string doesn't exist.

Examples

Input

3 4
abac
caab
acba


Output

acab


Input

3 4
kbbu
kbub
ubkb


Output

kbub


Input

5 4
abcd
dcba
acbd
dbca
zzzz


Output

-1

Note

In the first example s1 is obtained by swapping the second and the fourth character in acab, s2 is obtained by swapping the first and the second character, and to get s3, we swap the third and the fourth character.

In the second example s1 is obtained by swapping the third and the fourth character in kbub, s2 — by swapping the second and the fourth, and s3 — by swapping the first and the third.

In the third example it's impossible to obtain given strings by aforementioned operations.
/*
 * start with k identical string, swap exactly 2 char in each string, s1...sk
 * find a string that can be transformed to s1 to sk per rule above
 * string len=n. 1 ≤ k ≤ 2500, 2 ≤ n ≤ 5000, k · n ≤ 5000
 */


import static java.lang.System.out;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class SwappingChar {
    
    TreeSet<String> unique=new TreeSet<>();
    SwappingChar(List<String> ss )
    {
        for(String s:ss)
            unique.add(s);
    }
    private String swap(String s, int pos1, int pos2)
    {        
        StringBuilder sb=new StringBuilder();
        sb.append(s);
        sb.setCharAt(pos1, s.charAt(pos2));
        sb.setCharAt(pos2, s.charAt(pos1));
        return sb.toString();
    }
    String solve()
    {
        if (unique.size()==1) {
            String ans = unique.first();  // swap last 2 char
            return ans.substring(0, ans.length()-2)+ans.charAt(ans.length()-1)+ans.charAt(ans.length()-2);
        }
        // compare 1st string to rest, validate same length, diff position is <=4, chars are same
        String[] u= unique.toArray(new String[unique.size()]);
        for (int i=1; i<u.length; i++) {
            if (u[0].length()!=u[i].length())  // string must be of same length
                return "-1";
            ArrayList<Character> diff1=new ArrayList<>();
            ArrayList<Character> diff2=new ArrayList<>();
            int count=0;
            for (int j=0; j<u[0].length(); j++) {
                if (u[0].charAt(j) !=u[i].charAt(j)) {
                    diff1.add(u[0].charAt(j));
                    diff2.add(u[i].charAt(j));
                    if (++count>4)  // difference char position should exceed 4
                        return "-1";
                }
            }
            Collections.sort(diff1);  // char that diffs between 2 string must be same
            Collections.sort(diff2);
            for (int k=0; k<diff1.size(); k++) {
                if (diff1.get(k)!=diff2.get(k))
                    return "-1";
            }
        }
        // find position of diff char of first 2 string
        ArrayList<Integer> diff1=new ArrayList<>();
        for (int j=0; j<u[0].length(); j++) {
            if (u[0].charAt(j) !=u[1].charAt(j))
                diff1.add(j);
        }
        TreeSet<String> candidates=new TreeSet<>();
        for (int k=0; k<diff1.size(); k++) {
            for (int j=0; j<u[0].length(); j++) {  // swap diff with any char in string
                candidates.add(swap(u[0], j, diff1.get(k)));
                //candidates.add(swap(u[1], j, diff1.get(k)));
            }
        }
        //out.println(Arrays.toString(u));
        //out.println(diff1);
        //out.println(candidates);
        boolean distinct=u[0].length()<=26; // string letter all distinct
        if (distinct) {
            Set<Character> letters=new HashSet<>();
            for (int i=0; i< u[0].length(); i++)
                letters.add(u[0].charAt(i));
            distinct=u[0].length()==letters.size();
        }
        for (String s: candidates) {
            int i=0;
            for (; i<u.length; i++) {
                int count=0;
                for (int j=0; j<s.length(); j++) {
                    if (s.charAt(j) !=u[i].charAt(j))
                        count++;  
                }
                if (count !=0 && count !=2)  // diff pos must be 0 or 2
                    break;    
                if (count==0 && distinct)
                    break;  // diff cannot be 0 if all letters are distinct
            }
            if (i==u.length)
                return s;
        }
        return "-1";
    }
    static void test()
    {
        ArrayList<String> in=new ArrayList<>();
        in.add("te");
        out.println(new SwappingChar(in).solve()); // et
        in.add("ab");
        out.println(new SwappingChar(in).solve()); // -1
        in.set(1, "tetete");
        out.println(new SwappingChar(in).solve()); // -1
        in.set(0, "etetet");
        out.println(new SwappingChar(in).solve()); // -1
        in.set(0, "abac");
        in.set(1, "caab");
        in.add("acba");
        out.println(new SwappingChar(in).solve()); // acab
        in.set(0, "kbbu");
        in.set(1, "kbub");
        in.set(2,"ubkb");
        out.println(new SwappingChar(in).solve()); // kbub
        in.set(0, "clo");
        in.set(1, "col");
        in.set(2, "lco");
        out.println(new SwappingChar(in).solve()); // -1
    }
    public static void main(String[] args)
    {      
        judge();
    }
    static void judge()
    {        
        int k=IOR.ni();  // 1 to2500 
        int n=IOR.ni(); // 2 to 5000
        ArrayList<String> s=new ArrayList<>(k);
        for (int i=0; i<k; i++) {
            s.add(IOR.ns());
        }
        out.println(new SwappingChar(s).solve());
    }
}
class IOR {
    
    private static Scanner sc = new Scanner(System.in);    
        
    public static int ni()
    {
        return sc.nextInt();
    }
    public static long nl()
    {
        return sc.nextLong();
    }
    public static String ns()
    {
        return sc.next();
    }
    
    public static List<Integer> riL(int N) { // read int array list
        List<Integer> L=new ArrayList<>();
        for (int i=0; i<N; i++)
            L.add(sc.nextInt());
        return L;
    }
    
    public static int[] ria(int N) { // read int array
        int L[]=new int[N];
        for (int i=0; i<N; i++)
            L[i]=sc.nextInt();
        return L;
    }
    
    public static int[] ria1(int N) { // read int array, from 1
        int L[]=new int[N];
        for (int i=1; i<N; i++)
            L[i]=sc.nextInt();
        return L;
    }
    
    public static int[][] fillMatrix(int n, int m)
    {
        int a[][]=new int[n][m];
        for (int i=0; i<a.length; i++)
            for (int j=0; j<a[i].length; j++) {
                a[i][j]=sc.nextInt();
            }
        return a;
    }

    public static void fileScanner(Scanner s)
    {
        sc = s;
    }
}