while gets
  n, m = $_.split.map(&:to_i)
  break if n == 0 && m == 0
  table = Array.new(n)
  n.times do |i|
    table[i] = gets.split.map(&:to_f)
  end
  dp = Array.new(m){ Array.new(n, 1.0) }
  (m-1).times do |i|
    n.times do |j|
      n.times do |k|
        dp[i+1][k] = [dp[i+1][k], dp[i][j] * table[j][k]].max
      end
    end
  end
  puts "%.2f" % dp[m-1].max
end