#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef pair<int, pii> pip;
 
 
 
const int INF = 1000000;
const double EPS = 1e-8;
const int mod = 1e9 + 7;

double d[1000][1000];
double dp[1000][1000];

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