you know Valerys favorite sport biathlon due help learn shoot miss skill unmatched shooting range but small task perform learn complete path fastestThe track map represent rectangle nm size divide square each square mark lowercase latin letter mean type plot exception start square mark capital Latin letter S terminate square mark capital latin letter t the time movement square equal 1 minute the time movement cell neglect we cell sideadjacent one forbid map edge also follow restriction impose path allow visit k different type square squares type visit infinite number time square mark S T type count but S visit exactly begin t visit exactly endYour task find path square S square T take minimum time among short path choose lexicographically minimal when compare path lexicographically represent sequence character plot type