# include <iostream>
# include <algorithm>
# include <iomanip>

const int MAX_N = 100;
const int MAX_M = 100;

int n, m;
double dp[MAX_N][MAX_M];

double board[MAX_M][MAX_M];

int main() {
	while (1) {
		std::cin >> m >> n;
		if (n == 0 && m == 0)
			break;
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < m; ++j)
				dp[i][j] = 0;
		for (int i = 0; i < m; ++i) {
			for (int j = 0; j < m; ++j)
				std::cin >> board[i][j];
		}
		std::fill(dp[0], dp[0] + m, 1.0);
		for (int i = 1; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				for (int k = 0; k < m; ++k) {
					dp[i][j] = std::max(dp[i][j], dp[i - 1][k] * board[k][j]);
				}
			}
		}
		double res = 0;
		for (int i = 0; i < m; ++i)
			res = std::max(res, dp[n - 1][i]);
		std::cout << std::fixed << std::setprecision(2) << res << std::endl;
	}
	return 0;
}