#define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int N, M;
	while(cin >> N >> M, N || M){
		double List[100][100], dp[100][100] = {};
		for(int i = 0; i < N; i++){
			dp[0][i] = 1;
			for(int j = 0; j < N; j++)
				cin >> List[i][j];
		}
	
		for(int i = 0; i < M-1; i++){
			for(int j = 0; j < N; j++){
				for(int k = 0; k < N; k++){
					dp[i+1][k] = max(dp[i+1][k], dp[i][j]*List[j][k]);
				}
			}
		}
		double ans = 0;
		for(int i = 0; i < N; i++) ans = max(ans, dp[M-1][i]);
		printf("%.2lf\n", ans);
	}
	return 0;
}