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

int main(){
	while(1){
		int n,m;
		std::cin>>n>>m;
		if(n+m==0&&n*m==0)break;
		double dp[101][101]={};//dp[i][j]=i????????§???????????\??????j?????¨???????????????????????§???
		double grow[101][101];//i??´????????\??????j???????????\???
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++)std::cin>>grow[i][j];
		}
		for(int i=1;i<=n;i++)dp[1][i]=1.0;
		for(int i=2;i<=m;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){
					dp[i][j]=std::max(dp[i][j],dp[i-1][k]*grow[k][j]);
				}
			}
		}
		double ans=0;
		for(int i=1;i<=n;i++)ans=std::max(ans,dp[m][i]);
		std::cout<<std::fixed<<std::setprecision(2)<<ans<<std::endl;
	}
	return 0;
}