#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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()
const int INF = 1<<30;

int main() {
  int n, m;
  while(cin >> n >> m, n||m) {
    double hi[n][n];
    REP(i,n)
      REP(j,n)
      cin >> hi[i][j];
    double dp[m][n];
    REP(i,n)
      dp[0][i] = 1;
    REP(i,m-1) {
      REP(j,n) {
        double ma = 0;
        REP(k,n) {
          ma = max(ma, dp[i][k] * hi[k][j]);
        }
        dp[i+1][j] = ma;
      }
    }
    double ma = 0;
    REP(i,n)
      ma = max(ma, dp[m-1][i]);
    printf("%.2f\n", ma);
  }
}