
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;
int main()
{
  cout<<setprecision(2);
  cout<<setiosflags(ios::fixed);
  int n,m,i,j,k;
  long double M;
  while(cin>>n>>m,n|m){
    vector< vector<long double> >manure(n,vector<long double>(n)),dp(m,vector<long double>(n,0.0));
    for(i=0;i<n;i++)for(j=0;j<n;j++)cin>>manure[i][j];
    for(j=0;j<n;j++)dp[0][j]=1.0;
    for(i=1;i<m;i++){
      for(j=0;j<n;j++){
	for(k=0;k<n;k++){
	  dp[i][j]=max(dp[i][j],dp[i-1][k]*manure[k][j]);
	}
      }
    }
    M=0.0;
    for(j=0;j<n;j++)M=max(M,dp[n-1][j]);
    cout<<M<<endl;
  }
}