#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
double x[100][100], dp[101][100]; int n, m;
int main() {
	while (true) {
		cin >> n >> m; if (n == 0 && m == 0) { break; }m--;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++)cin >> x[i][j];
		}
		for (int i = 0; i < 101; i++) {
			for (int j = 0; j < 100; j++)dp[i][j] = 0.0;
		}
		for (int i = 0; i < 100; i++)dp[0][i] = 1.0;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] * x[j][k]);
				}
			}
		}
		double maxn = 0;
		for (int i = 0; i < 100; i++)maxn = max(maxn, dp[m][i]);
		printf("%.2lf\n", maxn);
	}
	return 0;
}