#include<iostream>
using namespace std;
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];
      }
    }
    int greed_color[n];
    double greed[n];
    for(int i = 0; i < n; ++i){
      greed_color[ i ] = i;
      greed[i] = 1.0;
    }
    for(int k = 0; k < m-1; ++k){
      for(int i = 0; i < n; ++i){
	int next_color = -1;
	double maximum = greed[i];
	for(int j = 0; j < n; ++j){
	  double t = greed[i] * table[ greed_color[i] ][ j ];
	  if( maximum < t ){
	    maximum = t;
	    next_color = j;
	  }
	}
	greed[i] = maximum;
	greed_color[i] = next_color;
      }
    }
    
    for(int i = 0; i < n; ++i){
      answer = max( answer , greed[i] );
    }
    printf("%.2lf\n",answer);

  }
  return 0;
}