#include #include #include #include #include #include #include #define rep(i,n) for(i=0; i=a; --i) #define in(a) cin >> a #define out(a,b) cout << a << b #define print_vec(v) for(auto it=v.begin();it!=v.end();++it)cout<<*it <<" ";cout< > D(26, vector (26)); vector > X(26, vector (26, "A")); rep(i,26){ rep(j,26) in(D[i][j]); } rep(i,s.size()){ inc_rep(j,i+1,s.size()){ if(X[s[i]-'a'][s[j]-'a']!="N") i+D[s[i]-'a'][s[j]-'a']<=j?X[s[i]-'a'][s[j]-'a']="Y":X[s[i]-'a'][s[j]-'a']="N"; } } rep(i,26){ rep(j,26){ if(X[i][j]=="A") X[i][j]="Y"; } } // rep(i,26){ // rep(j,26){ // if(i>=j) X[i][j]="Y"; // else if(i