#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

const double eps = 1.0e-10;
double eq(double a, double b){ //a==b
  return abs(b-a)<eps;
}
double gt(double a, double b){ //a>b
  return !eq(a,b) && a > b;
}

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

  }
  return 0;
}