func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T1, class T2>   ostream& operator<<(ostream& out, const pair<T1, T2> p) {     out <<  (  << p.first <<  ,  << p.second <<  ) ;     return out;   }   template <class T1, class T2>   istream& operator>>(istream& in, pair<T1, T2>& p) {     in >> p.first >> p.second;     return in;   }   template <class T>   istream& operator>>(istream& in, vector<T>& v) {     for (T& x : v) in >> x;     return in;   }   template <class T>   ostream& operator<<(ostream& out, const vector<vector<T> >& v) {     for (const vector<T>& x : v) out << x <<   n ;     return out;   }   template <class T>   ostream& operator<<(ostream& out, const vector<T>& v) {     for (const T& x : v) out << x <<    ;     return out;   }   long long power(long long a, long long b) {     return b ? power(a * a % 1000000007ll, b / 2) * (b % 2 ? a : 1) % 1000000007ll              : 1;   }   bool possible(vector<string>& s, string a) {     for (long long i = 1; i < (long long)(s).size(); i++) {       long long diff = 0;       for (long long j = 0; j < (long long)(a).size(); j++) {         if (a[j] != s[i][j]) diff++;       }       if (diff > 1) return false;     }     return true;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long T;     cin >> T;     while (T--) {       long long n, m;       cin >> n >> m;       vector<string> s(n);       cin >> s;       string a = s[0];       if (possible(s, a)) {         cout << a << endl;       } else {         string ans =   ;         for (long long i = 0; i < (long long)(s[0]).size() && ans ==   ; i++) {           char temp = s[0][i];           for (long long c =  a ; c <=  z  && ans ==   ; c++) {             s[0][i] = c;             if (possible(s, s[0])) {               ans = s[0];               break;             }           }           s[0][i] = temp;         }         if (ans ==   ) {           cout << -1 << endl;         } else           cout << ans << endl;       }     }   }   