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

using namespace std;

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

int main()
{
	int n, m;

	while (cin >> n >> m && n && m ){
		memset (tbl, 0.0, sizeof (tbl ) );
		rep (i, n ){
			rep (j, n ){
				cin >> tbl[i][j];
			} // end rep
		} // end rep
		double res = 1.0;
		rep (i, n ){	// ツ催渉可づ可選ツづ板氾ャツ猟ソ
			double curr = 1.0;
			int pre = i, next = -1;
			for (int j = 1; j < m; j++ ){
				double t = 0.0;
				rep (k, n ){
					if (t < tbl[pre][k]*curr ){
						t = tbl[pre][k]*curr;
						next = k;
					} // end if
				} // end rep
				pre = next;
				curr = t;
			} // end rep
			res = max (res, curr );
		} // end rep
		printf ("%.02lf\n", res );
	} // end while

	return 0;
}