#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

int main()
{
	int n, m;
	while(scanf("%d%d", &n, &m), n){
		double g[100][100];
		rep(i, n) rep(j, n)
			scanf("%lf", &g[i][j]);
		
		double dp[100][100];
		fill(dp[0], dp[0]+n, 1.0);
		reps(i, 1, m){
			rep(j, n){
				dp[i][j] = 0.0;
				rep(k, n)
					dp[i][j] = max(dp[i][j], dp[i-1][k] * g[k][j]);
			}
		}
		
		printf("%.2f\n", *max_element(dp[m-1], dp[m-1]+n));
	}
	return 0;
}