#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>H>>W; vector S(H); for(int i=0;i>S[i]; string res; vector> cand; res+=S[0][0]; cand.push_back(mp(0,0)); for(int t=0;t> nex; vector>> X; for(auto [h,w]:cand){ if(h+1