#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX_M 101
#define MAX_N 100

signed main() {
	cout << fixed << setprecision(2);
	double a[MAX_N][MAX_N];
	double dp[MAX_M][MAX_N];
	for (int n, m; cin >> n >> m&&n;) {
		memset(dp, 0, sizeof(dp));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> a[i][j];
			}
		}

		for (int i = 0; i < n; i++) {
			dp[0][i] = 1.0;
		}

		for (int i = 1; i < m; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					dp[i][j] = max(
						dp[i][j],
						dp[i - 1][k] * a[k][j]
					);
				}
			}
		}
		double ans = 0;
		for (int j = 0; j < n; j++) {
			ans = max(ans, dp[m - 1][j]);
		}
		cout << ans << endl;
	}
	return 0;
}