#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second

const int MAX=100;

int main(void)
{
  int n,m,i,j,k;
  double g[MAX][MAX+1],dp[MAX][MAX+1],res;//mñÚ,níÞ
  for(;;){
    scanf("%d%d",&n,&m); if(!n)break;
    rep(i,n)dp[0][i]=1.0;
    rep(i,n)rep(j,n)scanf("%lf",g[i]+j);
    rep(i,m)rep(j,n)rep(k,n){
      dp[i+1][j]=max(dp[i+1][j],dp[i][k]*g[j][k]);
    }
    res=0;
    rep(i,m)res=max(res,dp[i][n-1]);
    printf("%.2f\n",res);
  }
  return 0;
}
 