#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


int main(){
	int n,m;
	while(cin>>n>>m&&(n||m)){
		double table[101][101];
		rep(i,n) rep(j,n) cin>>table[i][j];
		
		double dp[101][101];
		rep(i,101)rep(j,101)dp[i][j] = -1;
		rep(i,n) dp[0][i] = 1;
		
		for(int i=1;i<m;i++){
			rep(j,n){
				rep(k,n){
					dp[i][j] = max( dp[i-1][k]*table[k][j] , dp[i][j] );
				}
			}
		}
		
		double ans = -1;
		rep(i,n){
			ans = max(ans,dp[m-1][i]);
		}
		printf("%.2lf\n",ans);
	}
}