#include using lint=long long; void debug_impl(){std::cerr<<'\n';} templatevoid debug_impl(Head head, Tail... tail){std::cerr << " " << head;debug_impl(tail...);} template::value,std::nullptr_t> = nullptr> std::ostream&operator<<(std::ostream&os,Container const&v) {os<<"{";for(auto it=v.begin();it!=v.end();it++){os<<(it!=v.begin()?",":"")<<*it;}return os<<"}";} templateclass Tuple,class...Args,std::size_t...Inds,std::size_t=std::tuple_size>::value> std::ostream&tuple_output_impl(std::ostream&os,const Tuple&tuple,std::integer_sequence) {os<<"(";(void)std::initializer_list{((void)(os<<(Inds>0?",":"")<(tuple)),0)...};return os<<")";} templateclass Tuple,class...Args,std::size_t=std::tuple_size>::value> std::ostream&operator<<(std::ostream&os,const Tuple&tuple) {return tuple_output_impl(os,tuple,std::index_sequence_for());} #define DEBUG 1 #if DEBUG #define debug(...)do{std::cerr<>h>>w; std::vector>a(h,std::vector(w)); bool found=false; for(lint i=0;i>c; a.at(i).at(j)=c=='#'; found|=a.at(i).at(j); } } if(!found){ std::cout<<"NO"<<'\n'; return 0; } for(lint q=0;q<2;q++){ for(lint di=0;di