#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(2);
  
  int n, m;
  while (cin >> n >> m, n) {
    double g[110][110];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> g[i][j];
      }
    }
    double dp[110][110] = {};
    fill_n((double*)dp, 110, 1);
    for (int i = 0; i < m - 1; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] * g[k][j]);
        }
      }
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dp[m - 1][i]);
    }
    cout << ans << endl;
  }

  return 0;
}
