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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int n, m;
double sheet[100][100], dp[100][100];

double dfs(int et, int b) {
  if (et == m) return 1.0;
  if (dp[et][b] >= 0) return dp[et][b];
  
  double res = 0;
  rep(i,n) {
    res = max(res, sheet[b][i] * dfs(et+1, i));
  }
  return dp[et][b] = res;
}

void solve() {
  rep(i,n) rep(j,n) cin>>sheet[i][j];
  double res = -1;
  memset(dp, -1, sizeof dp);
  
  rep(i,n) {
    res = max(dfs(1, i), res);
  }
  printf("%.2lf\n", res);
}

int main (int argc, char const* argv[]) {
  while (cin>>n>>m, n||m) {
    solve();
  }
  return 0;
}