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

double table[100][100];


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