#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
	double memo1[100] = {};
	double memo2[100] = {};
	double data[100][100];
	int n, m;

	while (true)
	{
		cin >> n >> m;
		if (n + m == 0) return 0;

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				cin >> data[i][j];
			}
			memo1[i] = 1.0;
		}

		for (int i = 0; i < m - 1; i++)
		{
			for (int j = 0; j < n; j++)
			{
				for (int k = 0; k < n; k++)
				{
					memo2[k] = max(memo2[k], memo1[j] * data[j][k]);
				}
				memo1[j] = 0;
			}
			swap(memo1, memo2);
		}

		double Max = 0;
		for (int i = 0; i < n; i++)
		{
			Max = max(Max, memo1[i]);
		}
		printf("%.2f\n", Max);
	}

	return 0;
}