def solve trans,m,n
  prev = Array.new(n,1.0)
  (m-1).times do
    cur = Array.new(n,0)
    n.times do |i|
      n.times do |j|
        cur[i] = [cur[i], prev[j]*trans[j][i]].max
      end
    end
    cur,prev = prev,cur
  end
  prev.max
end

loop do
  n,m = gets.chomp.split.map{|i|i.to_i}
  break if n==0
  trans = []
  n.times do
    trans << gets.chomp.split.map{|i|i.to_f}
  end
  puts "%.2f" % solve(trans,m,n)
end