#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define INF 1e9

int main(){
    while(true){
        int n,m;
        cin >> n >> m ;
        if(n==0 && m ==0)
            break;
        vector<vector<double>> bt(n,vector<double>(n));
        vector<vector<pair<double,int>>> dp(m);

        FOR(i,0,n){
            FOR(j,0,n){
                cin >> bt[i][j] ;
            }
            dp[0].push_back(pair<double,int>(1.0,i));
        }

        double ans = 0.0;
        FOR(i,0,m-1){
            FOR(j,0,n){
                FOR(k,0,dp[i].size()){
                    double g;
                    int f;
                    tie(g,f) = dp[i][k];
                    dp[i+1].push_back(pair<double,int>(g*bt[f][j],j));
                    ans = max(ans, g*bt[f][j]);
                }
            }
        }
        printf("%.2f\n",ans);
    }
    return 0;
}