require 'matrix'
require 'mathn'

def exp(n, k, mod = nil)
	x = 1	
	r = n
	while k > 0
		x *= r if k & 1 == 1
		r *= r		
		if mod
			x %= mod
			r %= mod
		end
		k >>= 1
	end
	x
end

class Matrix
	def %(mod)
		map{|x| x % mod}
	end
end

n = gets.to_i
m = Matrix[*(1..n).map{gets.split.map &:to_i}]
v = Vector[*(1..n).map{gets.to_i}]
t = gets.to_i
mt = exp(m, t, 2)

if mt.regular?
	puts (mt.inv * v).to_a.join(" ")
else
	l, u, perm = mt.lup
	a = l * u
	b = perm * v
	if (0..n-1).any?{|i| a.row(i).r == 0 && b[i] != 0}
		puts 'none'
	else
		puts 'ambiguous'
	end
end