#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

double t[102][102];	// ツ行ツづ個値ツづ債前ツ嘉アツ与ツつヲツつスツ氾ャツ猟ソ,ツ療アツづ個値ツづ債債。ツ嘉アツ与ツつヲツつスツ氾ャツ猟ソ
double dp[102][102];

int main()
{
	int n, m;

	while (cin >> n >> m && n && m ){
		memset (t, 0.0, sizeof (t ) );
		memset (dp, 0.0, sizeof (dp ) );

		rep (i, n ){
			rep (j, n ){
				cin >> t[i][j];
			} // end rep
		} // end rep
		for (int i = 0; i < n; i++ ){
			dp[i][1] = 1.0;
		} // end for
		for (int i = 0; i < n; i++ ){
			for (int j = 2; j <= m; j++ ){
				for (int k = 0; k < n; k++ ){
					dp[i][j] = max (dp[i][j], dp[k][j-1]*t[k][i] );
				} // end for
			} // end for
		} // end for

		double res = 0.0;
		for (int i = 0; i < n; i++ ){
			res = max (res, dp[i][m] );
		} // end for

		printf ("%.02lf\n", res );
	} // end while

	return 0;
}