
import std.stdio, std.algorithm, std.math;

void main() {
  for(int n, m; scanf("%d %d\n", &n, &m), n != 0;) {
    double[][] table = new double[][](n, n);
    double[][] dp = new double[][](m + 1, n + 1);
    int[] next = new int[](n);
    double ans = 0.0;
    
    for(int i = 0; i < n; i++)
      for(int j = 0; j < n; j++)
        scanf(j == n - 1 ?  "%lf\n" : "%lf ", &table[i][j]);

    foreach(ref d; dp) d[] = 1.0;

    for(int t = 1; t < m; t++) {
      for(int prev = 0; prev < n; prev++) {
        for(int curr = 0; curr < n; curr++) {
          dp[t + 1][curr] = max(dp[t + 1][curr], dp[t][prev] * table[prev][curr]);
        }
      }
    }
    writefln("%.2f", dp[m].reduce!(max));
  }
}