#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int n, m;
double g[100][100];
double dp[100][100];

int main() {
	while (cin >> n >> m, n || m) {
		REP(i, n) REP(j, n) scanf("%lf", &g[i][j]);
		
		memset(dp, 0, sizeof(dp));
		REP(i, n) dp[0][i] = 1.0;
		
		REP(i, m - 1) {
			REP(j, n) {
				REP(k, n) {
					chmax(dp[i + 1][k], dp[i][j] * g[j][k]);
				}
			}
		}
		
		double ans = 0;
		REP(i, n) chmax(ans, dp[m - 1][i]);
		printf("%.2lf\n", ans);
	}
	return 0;
}