import java.io.*; public class C_kosak { public static void main(String pArgs[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (solve(in, System.out)) ; in.close(); } private static boolean solve(BufferedReader pIn, PrintStream pOut) throws IOException { String line; int index, width, height; char[][] matrix; // 行列のサイズを読む line = pIn.readLine(); index = line.indexOf(' '); width = Integer.parseInt(line.substring(0, index)); height = Integer.parseInt(line.substring(index + 1)); if (width == 0 && height == 0) return false; matrix = new char[height][width]; // 行列を読む for (int h = 0; h < height; h++) { line = pIn.readLine(); for (int w = 0; w < width; w++) matrix[h][w] = line.charAt(w); } // 表を作成 Cell[][] table = new Cell[height + 1][width + 1]; char chr; String longest, biggest; for (int h = height; h >= 0; h--) table[h][width] = new Cell("", ""); for (int w = width; w >= 0; w--) table[height][w] = new Cell("", ""); for (int h = height - 1; h >= 0; h--) { for (int w = width - 1; w >= 0; w--) { chr = matrix[h][w]; if (chr == '0') { // ゼロは長さには影響するが、数値の大きさには影響しない longest = "0" + Cell.max(table[h + 1][w].longest, table[h][w + 1].longest); biggest = Cell.max(table[h + 1][w].biggest, table[h][w + 1].biggest); } else if (chr >= '1' && chr <= '9') { // 先頭が非ゼロなので、最長文字列は最大文字列でもある longest = chr + Cell.max(table[h + 1][w].longest, table[h][w + 1].longest); biggest = longest; } else longest = biggest = ""; table[h][w] = new Cell(longest, biggest); } } // デバッグ用。表を出力する。 /* for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { System.out.print(table[h][w]); System.out.print(','); } System.out.println(); } */ // 最大値を探して出力 biggest = ""; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) biggest = Cell.max(table[h][w].biggest, biggest); } pOut.println(biggest == null ? "No secrets..." : biggest); return true; } // solve // ある場所から始まる最長の数字列および(数値として)最大の数字列を保持する static class Cell { public String longest, biggest; public Cell(String pLongest, String pBiggest) { longest = pLongest; biggest = pBiggest; } // 2つの数字列のうち、長い方(同じ長さなら、数値として大きい方)を返す public static String max(String pStr1, String pStr2) { if (pStr1.length() > pStr2.length()) return pStr1; else if (pStr1.length() < pStr2.length()) return pStr2; else if (pStr1.compareTo(pStr2) >= 0) return pStr1; else return pStr2; } public String toString() { return longest + "/" + biggest; } } // class Cell } // class C_kosak