#include #include using namespace std; char nxt(char c) { if(c=='Q') return 'U'; return c; } int main() { vector> cost(3); for(int i : {0,1,1,1,1,2}) { string t; cin >> t; cost[i].push_back(t); } const int n = 16; string dp(n*2+1,'Z'+1); dp[0]='A'; for(int i=0;i'Z') ++ ans; if(ans>n*2) cout << "impossible\n"; else cout << ans << '\n'; }