#include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n,m;
	while(cin >> n >> m , n){
		double dp[101][101] = {0};
		double rate[101][101] = {0};
		rep(i,n)rep(j,n)
			cin >> rate[i][j];
		rep(i,n)dp[0][i] = 1.0;
		rep(x,m-1){
			rep(i,n)
				rep(j,n)
					dp[x+1][j] = max(dp[x][i]*rate[i][j],dp[x+1][j]);
		}
		double ans = 0;
		rep(i,n) ans = max(ans,dp[m-1][i]);
		printf("%.2lf\n",ans);
	}
}