#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		double dp[110][110]={0};
		double in[110][110]={0};
		rep(i,n)rep(j,n)cin>>in[i][j];
		rep(i,110)dp[0][i]=1;
		loop(i,1,m){
			rep(j,n)rep(k,n)dp[i][k]=max(dp[i][k],dp[i-1][j]*in[j][k]);
		}
		double ma=-1;
		rep(i,n)ma=max(ma,dp[m-1][i]);
		printf("%.2f\n",ma);
		
	}
}