#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, m;
    double h[105][105], dp[105][105] = {0};
    rep(i,105){
        dp[0][i] = 1.0;
    }
    while(cin >> n >> m, n||m){
        double ans = 0;
        rep(i,105){
            rep(j,105){
                dp[i][j] = 0;
            }
        }
        rep(i,105){
            dp[1][i] = 1;
        }
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                cin >> h[i][j];
            }
        }
        for(int i = 2; i <= m; i++){
            for(int j = 1; j <= n; j++){
                for(int k = 1; k <= n; k++){
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] * h[k][j]);
                }
            }
        }
        for(int i = 1; i <= m; i++){
            ans = max(dp[m][i], ans);
        }
        printf("%.2f\n", ans);
    }


    return 0;
}