#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); 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 IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

double table[100][100];
double dp[101][100];

int main(){
  int n,m;

  while(scanf("%d%d",&n,&m), n+m){
    REP(i,n) REP(j,n) scanf("%lf",&table[i][j]);
    memset(dp, 0, sizeof(dp));
    REP(i,n) dp[0][i] = 1.0;
    REP(i,m-1) REP(j,n) REP(k,n)
      dp[i+1][k] = max(dp[i+1][k], dp[i][j] * table[j][k]);

    double ans = 0.0;
    REP(i,n)
      ans = max(ans, dp[m-1][i]);

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

  return 0;
}