#include <iostream>
#include <cstdio>
#include <iomanip>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>

#include <numeric>
#include <algorithm>
#include <functional>

#include <cctype>

#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(unsigned int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))

typedef long long ll;
typedef complex<double> P;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};
const double EPS = 1e-9;
const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n==0) break;
        vector<double> maxi(n,1.0);
        vector<vector<double> > M(n,vector<double>(n));
        rep(i,n) rep(j,n) cin >> M[i][j];
        for(int i=0;i<m-1;i++){
            vector<double> next(n,-1);
            for(int j=0;j<n;j++){
                for(int k=0;k<n;k++){
                    next[k] = max(next[k],maxi[j] * M[j][k]);
                }
            }
            maxi = next;
        }
        cout << fixed << setprecision(2) << *max_element(all(maxi)) << endl;
    }
    return 0;
}