#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

template<class T> inline T sq(const T &x){return x*x;}

double g[101][101];
double dp[101][101];
int main(){
	cout.setf(ios::fixed);
	cout.precision(2);

	int n, m;
	while(cin >> n >> m, n|m){
		memset(dp, 0, sizeof(dp));
		rep(i, n) rep(j, n) cin >> g[i][j];
		rep(i, n) dp[0][i] = 1;
		m--;
		rep(i, m){
			rep(j, n){
				rep(k, n){
					dp[i+1][j] = max(dp[i+1][j], dp[i][k]*g[k][j]);
				}
			}
		}
		cout << *max_element(dp[m], dp[m+1]) << endl;
	}


	return 0;
}