#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n,m;
	double g[100][100];
	double dp[100][100];

	while(cin >> n >> m)
	{
		if(n == 0 && m == 0) break;
	
		memset(g,0,sizeof(g));
		memset(dp,0,sizeof(dp));
		
		rep(i,n)
		{
			rep(j,n)
			{
				cin >> g[i][j];
			}
		}

		rep(i,m) rep(j,n) dp[i][j] = 0;

		rep(i,n) dp[0][i] = 1;

		REP(i,1,m)
		{
			rep(j,n)
			{
				rep(k,n)
				{
					dp[i][j] = max(dp[i][j],dp[i-1][k]*g[k][j]);
				}
			}
		}

		double ans = 0;
		rep(i,n)
		{
			ans = max(ans,dp[m-1][i]);
		}

		cout << fixed;
		cout.precision(2);
		cout << ans << endl;

	}
	return 0;
}