#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>
#include <stdio.h>

using namespace std;

typedef vector < double > VI;
typedef vector < VI > VVI;

int main () {
	int n, m;

	while ( true ) {
		cin >> n >> m;

		if ( !n && !m ) {
			break;
		}

		VVI g(n + 1, VI(n + 1, 0));
		VVI dp(m + 1, VI(n + 1, 0));

		for(int i = 1; i <= n; i++) {
			for(int j = 1; j <= n; j++) {
				cin >> g[i][j];
			}
		}

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

		for(int i = 0; i < m; i++) {
			for(int j = 0; j <= n; j++) {
				if(dp[i][j] > dp[i + 1][j]) {
					for(int k = 0; k <= n; k++) {
						dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] * g[j][k]);
					}
				}
			}
		}

		double ans = 0;

		for(int i = 0; i <= n; i++) {
			ans = max(ans, dp[n - 1][i]);
		}

	/*	for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= m; j++){
				cout << dp[i][j] << " ";
			}
			cout << endl;
		}*/

		printf("%.2f\n", ans);
	}
}