#include<iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>

using namespace std;

int N, M;
double FertilizerData[100][100];
double DpResult[100][100];


void solve() {
	double maxData;

	for (int j = 0; j < N; ++j) {
		DpResult[0][j] = 1.0;
	}

	for (int i = 1; i < M; ++i) {
		for (int j = 0; j < N; ++j) {
			for (int k = 0; k < N; ++k) {
				DpResult[i][j] = max(DpResult[i][j], DpResult[i - 1][k] * FertilizerData[k][j]);
			}
		}
	}

	maxData = -0.1;
	for (int k = 0; k < N; ++k) {
		maxData = max(maxData, DpResult[M - 1][k]);
	}
	cout << fixed << setprecision(2) << maxData << endl;
}

int main() {

	while (cin >> N >> M, N) {
		memset(FertilizerData, 0, sizeof(FertilizerData));
		memset(DpResult, 0, sizeof(DpResult));
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				cin >> FertilizerData[i][j];
			}
		}
		////show:
		//for (int i = 0; i < N; ++i) {
		//	for (int j = 0; j < N; ++j) {
		//		cout << FertilizerData[i][j] << " ";
		//	}
		//	cout << endl;
		//}
		solve();
	}

	return 0;
}


