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

constexpr int MAX = 100;

int n, m;
double board[MAX][MAX];
double dp[MAX][MAX];

int main() {
	while (1) {
		std::cin >> m >> n;
		if (m + n == 0)
			break;
		std::memset(dp, 0, sizeof(dp));
		for (int i = 0; i < m; ++i) {
			for (int j = 0; j < m; ++j)
				std::cin >> board[i][j];
		}
		for (int i = 0; i < m; ++i)
			dp[0][i] = 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 ans = 0;
		for (int i = 0; i < m; ++i)
			ans = std::max(ans, dp[n - 1][i]);
		std::cout << std::fixed << std::setprecision(2) << ans << std::endl;
	}
	return 0;
}