#include <stdio.h>

double dp[100][100];

#define REP(i, n) for (int i = 0; i < (n); i++)
#define MAX(x, y) ((x) > (y) ? (x) : (y))

int main(void)
{
	double grow[100][100]; //[ツ前ツづ個氾ャツ猟ソ][ツ債。ツづ個氾ャツ猟ソ]
	int n, m;
	
	while (1){
		REP(i, 100) dp[0][i] = 1.0;
		
		scanf("%d%d", &n, &m);
		
		if (n == 0 || m == 0){
			break;
		}
		
		REP(i, n) REP(j, n) scanf("%lf", &grow[i][j]);
		
		for (int i = 1; i < m; i++){
			for (int j = 0; j < n; j++){
				dp[i][j] = dp[i - 1][0] * grow[0][j];
				for (int k = 1; k < n; k++){
					dp[i][j] = MAX(dp[i][j], dp[i - 1][k] * grow[k][j]);
				}
			}
		}
		
		double ans = 0;
		REP(i, n){
			ans = MAX(ans, dp[m - 1][i]);
		}
		
		printf("%.2lf\n", ans);
	}
	return (0);
}