#include <cstdio>
#include <algorithm>
using namespace std;

double g[100][100];
double dp[100][100];

int main(){
	int n, m;
	while(scanf("%d%d", &n, &m), n){
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < n; ++j){
				scanf("%lf", &g[i][j]);
			}
		}

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

		double ans = -1.0;
		for(int j = 0; j < n; ++j){
			ans = max(ans, dp[m-1][j]);
		}
		printf("%.2f\n", ans);
	}
}