#include "bits/stdc++.h"
using namespace std;



const int mod = 2;
struct Mod {
public:
	int num;
	Mod() : Mod(0) { ; }
	Mod(long long int n) : num((n % mod + mod) % mod) {
		static_assert(mod<INT_MAX / 2, "mod is too big, please make num 'long long int' from 'int'");
	}
	Mod(int n) : Mod(static_cast<long long int>(n)) { ; }
	operator int() { return num; }
};

Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; }
Mod operator+(const Mod a, const long long int  b) { return b + a; }
Mod operator++(Mod &a) { return a + Mod(1); }
Mod operator-(const Mod a, const Mod b) { return Mod((mod + a.num - b.num) % mod); }
Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; }
Mod operator--(Mod &a) { return a - Mod(1); }
Mod operator*(const Mod a, const Mod b) { return Mod(((long long)a.num * b.num) % mod); }
Mod operator*(const long long int a, const Mod b) { return Mod(a)*b; }
Mod operator*(const Mod a, const long long int b) { return Mod(b)*a; }
Mod operator*(const Mod a, const int b) { return Mod(b)*a; }
Mod operator+=(Mod &a, const Mod b) { return a = a + b; }
Mod operator+=(long long int &a, const Mod b) { return a = a + b; }
Mod operator-=(Mod &a, const Mod b) { return a = a - b; }
Mod operator-=(long long int &a, const Mod b) { return a = a - b; }
Mod operator*=(Mod &a, const Mod b) { return a = a * b; }
Mod operator*=(long long int &a, const Mod b) { return a = a * b; }
Mod operator*=(Mod& a, const long long int &b) { return a = a * b; }
Mod operator^(const Mod a, const int n) {
	if (n == 0) return Mod(1);
	Mod res = (a * a) ^ (n / 2);
	if (n % 2) res = res * a;
	return res;
}
Mod mod_pow(const Mod a, const long long  int n) {
	if (n == 0) return Mod(1);
	Mod res = mod_pow((a * a), (n / 2));
	if (n % 2) res = res * a;
	return res;
}
Mod inv(const Mod a) { return a ^ (mod - 2); }
Mod operator/(const Mod a, const Mod b) {
	assert(b.num != 0);
	return a * inv(b);
}
Mod operator/(const long long int a, const Mod b) {
	return Mod(a) / b;
}
Mod operator/=(Mod &a, const Mod b) {
	return a = a / b;
}

/* verified AOJ1327 One-Dimensional Cellular Automaton
~Matrix~
ティツ。ツ古・ツ按療」ツ?ョテァツーツ。テ・ツ債佚」ツ?ェティツィツ暗ァツョツ療」ツ?古」ツ?ァテ」ツ?催」ツつ?
vector iostream cmath cassert テ・ツソツ?ゥツ??
Matrix a(VV), b(VV);
ティツ。ツ古・ツ按療・ツシツ?a*b
テ」ツつケテ」ツつォテ」ツδゥテァツゥツ?l*a
テ・ツ陳?a+b
テ・ツキツョ:a-b
ティツサツ「テァツスツョ:a.transport()
テ、ツスツ凖・ツ崢?・ツュツ?a.cofactor()
ティツ。ツ古・ツ按療・ツシツ?a.det()
aテ」ツ?ョiティツ。ツ桂テ・ツ按療ァツ崢ョ:a.get(i,j)テ」ツ??
aテ」ツ?ョiティツ。ツ古ァツ崢ョjテ・ツ按療ァツ崢ョテ」ツ?ォkテ」ツつ津、ツサツ」テ・ツ?・:set(i,j,k)
テ」ツつづ」ツ?療」ツ?湘」ツ?ッa[i][j] (a[i][j]=k)
aテ」ツ?ョxテ、ツケツ?a.pow(x)
n*nテ・ツ淞コテヲツ慊ャティツ。ツ古・ツ按勇:Matrix(n)
m*n 0ティツ。ツ古・ツ按?Matrix(m,n)
m*n テ・ツ?ィティツヲツ?ァツエツ?」ツ?継テ」ツ?ョティツ。ツ古・ツ按?Matrix(m,n,p)
Rowテ・ツ楪脚owテ」ツ?ァテ」ツ?ョテ・ツ按敕ヲツ慊淌・ツ個?m*1ティツ。ツ古・ツ按?:Matrix(row)
**(テヲツ閉エテヲツ閉ーテ、ツクツ催・ツ渉ッ)**
テ、ツクツ嘉ィツァツ津・ツ個?a.triangulate()
テ」ツδゥテ」ツδウテ」ツつッ:a.rank()
テゥツ??ィツ。ツ古・ツ按?a.inverse()
//(テゥツ??ィツ。ツ古・ツ按療」ツ?ョa.det()テ・ツ?催」ツ?ェテ」ツつ餌.pre_inverse()テ」ツ?ァテヲツアツづ」ツ?セテ」ツつ?テヲツ閉エテヲツ閉ーテ・ツ渉ッ)
テ」ツつャテ」ツつヲテ」ツつケテ」ツ?ョテヲツカツ暗・ツ篠サテヲツウツ?a.rowReduction()
//テゥツ?」テァツォツ凝、ツクツ?ヲツャツ。テヲツ鳴ケテァツィツ凝・ツシツ湘」ツ?古ィツァツ」テ」ツ?妥」ツつ?
***
*/

#include <vector>
#include <iostream>
#include <cmath>
#include <cassert>
using namespace std;

typedef Mod Elem;
typedef vector<Elem> Row;
typedef vector<Row> VV;

typedef long double ld;
const ld EPS = 1e-11;

const bool isZero(const Elem e) {
	return e.num == 0;
}

struct Matrix {
	VV matrix;
	int n, m;

	Matrix(const VV &matrix_);
	explicit Matrix(int n_);
	explicit Matrix(const Row &row);
	Matrix(int m_, int n_);
	Matrix(int m_, int n_, Elem e);

	const Elem get(const int i, const int j) const;
	void set(const int x, const int y, const Elem k);

	const Matrix operator + (const Matrix &rhs) const;
	const Matrix operator * (const Matrix &rhs) const;
	const Matrix operator - (const Matrix &rhs) const;
	Matrix &operator += (const Matrix &rhs);
	Matrix &operator *= (const Matrix &rhs);
	Matrix &operator -= (const Matrix &rhs);

	Row &operator[](const int x);

	const Matrix transport() const;
	const Matrix pow(int x) const;
	const Matrix cofactor(int x, int y) const;
	const Elem det() const;

	const Matrix triangulate() const;
	const int rank() const;

	//テゥツ??ィツ。ツ古・ツ按療」ツ?古・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ古」ツ?ーテ」ツ??ティツ。ツ古・ツ按療・ツシツ?*(テゥツ??ィツ。ツ古・ツ按?テ」ツつ津ィツソツ氾」ツ??
	//A:matrix,return det A * A^-1
	const Matrix pre_inverse() const;
	const Matrix inverse() const;
	const Matrix rowReduction() const;
};

const Matrix operator * (const Elem lambda, const Matrix &rhs) {
	Matrix tmp(rhs);
	for (int i = 0; i < rhs.m; i++)
		for (int j = 0; j < rhs.n; j++)
			tmp.set(i, j, tmp.get(i, j) * lambda);
	return tmp;
}

Matrix::Matrix(const VV &matrix_) : matrix(matrix_) {
	m = matrix_.size();
	if (m == 0) n = 0;
	else n = matrix_[0].size();
}
Matrix::Matrix(int n_) : m(n_), n(n_) {
	matrix = VV(n, Row(n, 0));
	for (int i = 0; i < n; ++i)
		set(i, i, 1);
}
Matrix::Matrix(const Row &row) : m(1), n(row.size()), matrix(VV(1, row)) {
	//sizeテ」ツ?稽テ」ツ?ョvector<Elem>テ」ツ?凝」ツつ盈x1ティツ。ツ古・ツ按療」ツ?ョテァツ板淌ヲツ按?
	(*this) = transport();
}
Matrix::Matrix(int m_, int n_) : m(m_), n(n_) {
	matrix = VV(m, Row(n, 0));
}
Matrix::Matrix(int m_, int n_, Elem e) : m(m_), n(n_) {
	matrix = VV(m, Row(n, e));
}

const Elem Matrix::get(const int i, const int j) const {
	if (0 <= i && i < m && 0 <= j && j < n)
		return matrix[i][j];

	cerr << "get(" << i << "," << j << ")is not exist." << endl;
	throw;
}
void Matrix::set(const int i, const int j, const Elem k) {
	if (0 <= i && i < m && 0 <= j && j < n) {
		*(matrix[i].begin() + j) = k;
		return;
	}
	cerr << "set(" << i << "," << j << ")is not exist." << endl;
	throw;
}

const Matrix Matrix::operator + (const Matrix &rhs) const {
	assert(m == rhs.m && n == rhs.n);

	Matrix tmp(m, n, 0);
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			tmp.set(i, j, get(i, j) + rhs.get(i, j));
		}
	}
	return tmp;
}

const Matrix Matrix::operator * (const Matrix &rhs) const {
	assert(n == rhs.m);

	Matrix tmp(m, rhs.n, 0);
	Elem sum;
	for (int i = 0; i < m; i++)
		for (int j = 0; j < rhs.n; j++) {
			sum = 0;
			for (int k = 0; k < n; k++) {
				sum += get(i, k) * rhs.get(k, j);
			}
			tmp.set(i, j, sum);
		}
	return tmp;
}

const Matrix Matrix::operator - (const Matrix &rhs) const {
	return *this + ((Elem)-1 * rhs);
}

Matrix &Matrix::operator += (const Matrix &rhs) {
	return *this = *this + rhs;
}

Matrix &Matrix::operator *= (const Matrix &rhs) {
	return *this = *this * rhs;;
}

Matrix &Matrix::operator -= (const Matrix &rhs) {
	return *this = *this - rhs;
}

Row &Matrix::operator[](const int x) {
	return matrix[x];
}

const Matrix Matrix::transport() const {
	VV tmp;
	for (int i = 0; i < n; i++) {
		Row row;
		for (int j = 0; j < m; j++)
			row.push_back(get(j, i));
		tmp.push_back(row);
	}
	return tmp;
}

const Matrix Matrix::pow(int x) const {
	Matrix tmp(*this), e(m);
	for (int i = 1; i <= x; i <<= 1) {
		if ((x & i) > 0)
			e = e * tmp;
		tmp = tmp * tmp;
	}
	return e;
}

const Matrix Matrix::cofactor(int x, int y) const {
	VV tmp;
	for (int i = 0; i < m; i++) {
		if (x == i) continue;
		Row row;
		for (int j = 0; j < n; j++) {
			if (y == j) continue;
			row.push_back(get(i, j));
		}
		tmp.push_back(row);
	}
	return Matrix(tmp);
}

const Elem Matrix::det() const {
	assert(n == m);

	if (m == 1)
		return get(0, 0);
	Elem sum = 0;
	for (int i = 0; i < m; i++) {
		sum += ((i % 2 == 0 ? 1 : -1) * get(i, 0)) * Matrix(cofactor(i, 0)).det();
	}
	return sum;
}

const Matrix Matrix::triangulate() const {
	Matrix tmp(*this);
	Elem e;
	int p = 0;
	for (int i = 0; i < m && p < n; i++, p++) {
		if (isZero(tmp.get(i, p))) {
			tmp.set(i, p, 0);
			bool flag = true;
			for (int j = i + 1; j < m; j++)
				if (!isZero(tmp.get(j, p))) {
					for (int k = 0; k < n; k++)
						tmp.set(i, k, tmp.get(i, k) + tmp.get(j, k));
					//tmp[i].swap(tmp[j]);
					flag = false;
					break;
				}
			if (flag) {
				i--;
				continue;
			}
		}
		for (int j = i + 1; j < m; j++) {
			e = tmp.get(j, p) / tmp.get(i, p);
			for (int k = 0; k < n; k++)
				tmp.set(j, k, tmp.get(j, k) - tmp.get(i, k) * e);
		}
	}
	return tmp;
}

const int Matrix::rank() const {
	Matrix tmp(triangulate());
	for (int i = min(tmp.m - 1, tmp.n - 1); i >= 0; i--) {
		for (int j = tmp.n - 1; j >= i; j--)
			if (isZero(tmp.get(i, j)))
				continue;
			else
				return i + 1;
	}
	return 0;
}

const Matrix Matrix::pre_inverse() const {
	assert(m == n);

	Matrix tmp(m, n, 0);
	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++)
			tmp.set(i, j, ((i + j) % 2 == 0 ? 1 : -1)*cofactor(i, j).det());
	return tmp.transport();
}

/*O(n!)テ・ツョツ淌ィツ」ツ?
const Matrix Matrix::inverse() const {
Matrix tmp(pre_inverse());
Elem e = det();
assert(!isZero(e));
tmp = 1 / e * tmp;
return tmp.transport();
}*/

const Matrix Matrix::inverse() const {
	assert(m == n);

	Matrix tmp(m, n * 2), tmp2(m, n);
	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++)
			tmp.set(i, j, get(i, j));
	for (int i = 0; i < m; i++)
		tmp.set(i, i + n, 1);

	tmp = tmp.rowReduction();

	//テゥツ??ィツ。ツ古・ツ按療」ツ?古・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ凝」ツ?凝」ツ?ゥテ」ツ??」ツ?凝」ツ?ョテ」ツδ?」ツつァテ」ツδε」ツつッ
	for (int i = 0; i < m; i++)
		assert(isZero(tmp.get(i, i) - 1));

	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++)
			tmp2.set(i, j, tmp.get(i, j + n));

	return tmp2;
}

/*
a b c j
d e f k
g h i l

ax+by+cz=j;
dx+ey+fz=k;
gx+hy+iz=l;

|
V

1 0 0 x
0 1 0 y
0 0 1 z
テ・ツ渉ウテァツォツッテ」ツ?古ァツュツ氾」ツ??
*/
const Matrix Matrix::rowReduction() const {
	Matrix tmp(*this);
	Elem e;
	int p = 0;
	for (int i = 0; i < m && p < n; i++, p++) {
		if (isZero(tmp.get(i, p))) {
			tmp.set(i, p, 0);
			bool flag = true;
			for (int j = i + 1; j < m; j++)
				if (!isZero(tmp.get(j, p))) {
					for (int k = 0; k < n; k++)
						tmp.set(i, k, tmp.get(i, k) + tmp.get(j, k));
					//tmp[i].swap(tmp[j]);
					flag = false;
					break;
				}
			if (flag) {
				i--;
				continue;
			}
		}
		e = 1 / tmp.get(i, p);
		tmp.set(i, p, 1);
		for (int k = i + 1; k < n; k++)
			tmp.set(i, k, tmp.get(i, k)*e);
		for (int j = 0; j < m; j++) {
			if (i == j) continue;
			e = tmp.get(j, p);
			for (int k = 0; k < n; k++)
				tmp.set(j, k, tmp.get(j, k) - tmp.get(i, k) * e);
		}
	}
	return tmp;
}



int main() {
	int N; cin >> N;
	Matrix field(N, N);
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			int a; cin >> a;
			field[i][j] = a;
		}
	}
	Matrix now(N, 1);
	for (int i = 0; i < N; ++i) {
		int v; cin >> v;
		now[i][0] = v;
	}
	int T; cin >> T;
	field=field.pow(T);
	Matrix rr(N, N + 1);
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			rr[i][j] = field[i][j];
		}
		rr[i][N] = now[i][0];
	}

	Matrix ans = rr.rowReduction();
	Matrix l(N, N);
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			l[i][j] = ans[i][j];
		}
	}
	if (l.rank() == N) {
		for (int i = 0; i < N; ++i) {
			cout << ans[i][N];
			if (i == N - 1)cout << endl;
			else cout << " ";
		}
	}
	else {
		bool ok = true;
		for (int i = 0; i < N; ++i) {
			bool zeronum = true;
			for (int j = 0; j < N; ++j) {
				if (ans[i][j])zeronum = false;
			}
			if (zeronum&&ans[i][N]) {
				ok = false;
			}
		}
		if (ok)cout << "ambiguous" << endl;
		else cout << "none" << endl;
	}
	return 0;
}