import java.io.PrintWriter; import java.util.LinkedList; import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static int H, W; static char[][] map; static int [][] ansMap; public static void main(String[] args) { String line = scan.nextLine(); String values[] = line.split(" "); H = Integer.parseInt(values[0]); W = Integer.parseInt(values[1]);; map = new char[H+2][W+2]; ansMap = new int[H+2][W+2]; LinkedList q = new LinkedList<>(); for(int i=0; i= 0 && nextX < ansMap[0].length && nextY >= 0 && nextY < ansMap.length && ansMap[nextY][nextX] == -1) { ansMap[nextY][nextX] = nextV; q.add(new Node(nextX, nextY, nextV)); ans = Math.max(ans, ansMap[nextY][nextX]); } } } //out(); System.out.println(ans); } static void out() { for(int i=0; i