#include <iostream>
#include <utility>

using namespace std;

double table[100][100];
double result[100][100];

int main(){
	while(true){
		int n, m;
		cin >> n >> m;
		if(n == 0 && m == 0){ break; }
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cin >> table[i][j];
			}
		}
		for(int i = 0; i < n; i++){ result[0][i] = 1.0; }
		for(int i = 1; i < m; i++){
			for(int j = 0; j < n; j++){
				double maxval = 0.0;
				for(int k = 0; k < n; k++){
					maxval = max(maxval, result[i - 1][k] * table[k][j]);
				}
				result[i][j] = maxval;
			}
		}
		double answer = 0.0;
		for(int i = 0; i < n; i++){
			answer = max(answer, result[m - 1][i]);
		}
		printf("%.2lf\n", answer);
	}
	return 0;
}