#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
  int n,m; 
  double data[101][101],tree[101][101];
  while ( cin >> n >> m ,n+m ) {
    for ( int i = 1; i <= n; i++ ) {
      for ( int j = 1; j <= n; j++ ) cin >> tree[i][j];
    }

    for ( int i = 1; i <= n; i++ ) {
      for ( int j = 1; j <= m; j++ ) data[i][j] = -1.0;
    }


    for ( int i = 1; i <= n; i++ ) data[i][1] = 1.0;
    
    int tmp;
    int cnt = 0;
    for( int i = 1; i <= n; i++ ) {
      cnt++;
      tmp = cnt;
      int tmp2;
      for( int j = 1; j < m; j++ ) {
	for( int k = 1; k <= n; k++ ) {
	  if ( data[i][j+1] < data[i][j] * tree[tmp][k] ) {
	    data[i][j+1] = data[i][j] * tree[tmp][k];
	    tmp2 = k;
	  }
	}
	tmp = tmp2;
      }
    }

    //for ( int i = 1; i <=n; i++ ) {
    //  for( int j = 1; j <= n; j++ ) printf("%.2f ",data[i][j]);
    // cout << endl;
    // }
    double maxv = -1.0;
    for( int i = 1; i <= n; i++ ) maxv = max( data[i][n], maxv );

    printf("%.2f\n",maxv);

  }
  return 0;
}