#include<bits/stdc++.h> using namespace std; typedef pair<int,int>PII; const int N=105; int mp[N][N]; PII path[N][N]; queue<PII>q; int dx[4]={-1,0,1,0}; int dy[4]={0,1,0,-1}; int h,m; void bfs(){ q.push({0,0}); while(!q.empty()){ auto pos=q.front(); if(pos.first==h-1&&pos.s...