#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cassert>
#include<cmath>
#define EPS 1e-10
using namespace std;
typedef pair<double,int> P;
vector<P> vec;
int m,n;
double total;
double rec(int pre,int counter){
  if(counter > m){
    return vec[pre].first;
  }
  return rec(vec[pre].second,counter+1)*vec[pre].first;
}


int main(){
  
  double In;
 
  while(cin >> n >> m && n && m){
    vector<double> matrix[n+2];
    //int pre[n+2][m+2]; 
    double sam[n+2];
    int pos[n+2]; 
    total = 1.0;
    vec.clear();
    for(int i=0;i<=n;i++)sam[i] = 0;
    total = 1.0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cin >> In;
	matrix[i].push_back(In);
	if(sam[i] - In < EPS){
	  sam[i] = In;
	  pos[i] = j;
	}
      }
    }

    for(int i=0;i<n;i++){
      vec.push_back(P(sam[i],pos[i]));
    }
    /*
    cout << "sam = ";
    for(int i=0;i<n;i++)cout << sam[i] << " ";
    cout << endl;

    cout << "pre = ";
    for(int i=0;i<n;i++)cout << pos[i] << " ";
    cout << endl;
    */
    double ans = -1;
    for(int I=0;I<n;I++)ans = max(ans,rec(I,m));
    printf("%.2f\n",ans);

  }
  return 0;
}