#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;ib && c>b)){ // ok vi next = rest; next.erase(next.begin()+i); next.erase(next.begin()+j); next.erase(next.begin()+k); bool r = dfs(next,turn+1)==pl; if(r){ fl = true; if(turn != 0)return pl; string t = ""; t += (char)(k+'a'); t += (char)(j+'a'); t += (char)(i+'a'); res = min(res,t); } } } if(fl)return pl; else return (pl+1)%2; } int main(){ int n; cin>>n; vi k(n); REP(i,n)cin>>k[i]; dfs(k,0); if(res == "zzz"){ cout<<-1<