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

int main() {
  double f[101][101];
  double dp[101][101];
  int n,m;
  while (cin >> n >> m,n||m) {
    
    for ( int i = 0; i < n; i++ ) {
      for ( int j = 0; j < n; j++ ) {
	cin >> f[i][j];
      }
    }

    for ( int i = 0; i < m; i++ ) {
      for ( int j = 0; j < n; j++ ) {
	dp[i][j] = 0.0;
      }
    }

    for ( int i = 0; i < n; i++ ) dp[0][i] = 1.0;

    for ( int i = 1; i < m; i++ ) {
      for ( int j = 0; j < n; j++ ) {
	for ( int k = 0; k < n; k++ ) {
	  dp[i][j] = max( dp[i][j], dp[i-1][k] * f[j][k] );
	}
      }
    }

    double ans = 0.0;
    for ( int i = 0; i < n; i++ ) {
      ans = max ( ans, dp[m-1][i] );
    }
      
    printf ("%.2f\n", ans );
  }
  return 0;
}