//#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define rep(v,e) for(long v=0;v=0;){ rep(e,26){ chmin(f[e][c],i-a[e]); } a[c]=i++; } char*wp=wbuf; rep(y,26){ rep(x,26){ long d=rd(); *wp++=f[y][x]