#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>

using namespace std;

void solve()
{
	int n, m;
	while(cin >> n >> m, n || m)
	{
		long double data[101][101];
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				scanf("%Lf", &data[i][j]);
			}
		}
		long double dp[101][101];
		for(int i = 0; i < m; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				dp[i][j] = 0;
			}
		}
		for(int i = 0; i < n; ++i)
		{
			dp[0][i] = 1;
		}
		for(int i = 1; i < m; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				for(int k = 0; k < n; ++k)
				{
					dp[i][j] = max(dp[i][j], dp[i - 1][k] * data[k][j]);
				}
			}
		}
		long double maximum = 0;
		for(int i = 0; i < n; ++i)
		{
			maximum = max(maximum, dp[m - 1][i]);
		}
		printf("%.2Lf\n", maximum);
	}
}

int main()
{
	solve();
	return(0);
}