#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; #ifdef LOCAL #define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl; #else #define debug(x) ; #endif #define mod 1000000007 //1e9+7(prime number) #define INF 1000000000 //1e9 #define LLINF 2000000000000000000LL //2e18 #define SIZE 200010 typedef __int128_t Int; Int power(Int k, Int n, ll M){ if(n==0) return 1; if(n==1) return k % M; Int res = power(k, n/2, M); res = res * res % M; if(n % 2) res = k % M * res % M; return res; } bool isPrime(Int x) { srand(time(NULL)); if(x == 2) return true; if(x <= 1 || x % 2 == 0) return false; Int d = x-1; while(d%2 == 0) d >>= 1; for(int i=0;i<30;i++){ Int a = rand() % (x-2) + 1; Int t = d; Int y = power(a, t, x); while(t != x-1 && y != 1 && y != x-1){ y = (y * y) % x; t <<= 1; } if(y != x-1 && t%2 == 0) return false; } return true; } int main(){ string s[14]; int n; scanf("%d", &n); for(int i=0;i> s[i]; sort(s, s+n); ll ans = -1; do{ string t; for(int i=0;i