import java.util.*; public class Main { static boolean flag = false; static int n, m, p; static String path = ""; static int maxRemain; static int[][] map; static LinkedList<String> list = new LinkedList<>(); public static void main(String[] args) { ...