#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


int main(){
	int n, m ;
	while(cin >> n >> m , n){
		long double table[100][100];
		long double dp[2][100] = {{0.0}};
		
		
		rep(i,n)rep(j,n)cin >> table[i][j];
		rep(i,n)dp[0][i] = 1.0;
		bool sw = false;
		
		rep(i,m-1){ // kaisu 
			rep(j,n){ // chokuzen 
				rep(k,n){ // current
					dp[sw^1][k] = max(dp[sw^1][k] , dp[sw][j] * table[j][k]);
				}
			}
			sw ^= 1;
		}
		long double ret = 0;
		rep(i,n){
			ret = max(ret,dp[sw][i]);
		}
		printf("%.2Lf\n",ret);
	}
}