#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

double dp[200][200];
double h[200][200];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)rep(j, n)scanf("%lf", &h[i][j]);
		memset(dp, 0, sizeof(dp));
		rep(i, n)dp[0][i] = 1.;
		rep(i, m - 1)rep(j, n)rep(k, n)
			dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] * h[j][k]);
		double Max = 0.;
		rep(i, n)Max = max(Max, dp[m - 1][i]);
		printf("%.2lf\n", Max);
	}
}