#include <bits/stdc++.h>

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

#ifdef __WIN32
#define LLFORMAT "I64"
#define Rand() ((rand() << 15) + rand())
#else
#define LLFORMAT "ll"
#define Rand() (rand())
#endif

using namespace std;

const int maxn = 2e6 + 10;

int n, m, k, bal;
char in[maxn << 1], out[maxn << 1], a[maxn], b[maxn], *pnt, *S, *T;
set<int> s;

struct Info {
	int l, r, a, b, c;

	Info() {}
	Info(int l, int r, int a, int b, int c): l(l), r(r), a(a), b(b), c(c) {}
};

vector<Info> f, nf;

void pb(int l, int r, int x, int y, int z) {
	if(!z || !x && !y) {
		return;
	}
	if(!nf.size()) {
		nf.push_back(Info(l, r, x, y, z));
		return;
	}
	auto &t = nf.back();
	int a = t.a, b = t.b, c = t.c;
	if(a == b) {
		if(x == y) {
			t = Info(t.l, r, a, b, c + z);
		}
		else {
			nf.push_back(Info(l, r, x, y, z));
		}
	}
	else {
		if(!(c & 1)) {
			a ^= 1;
			b ^= 1;
		}
		if(x != a && y != b) {
			t = Info(t.l, r, t.a, t.b, c + z);
		}
		else {
			nf.push_back(Info(l, r, x, y, z));
		}
	}
	return;
}

inline void ins(int i) {
	s.insert(i - bal);
	return;
}

inline void del(int i) {
	s.erase(i - bal);
	return;
}

inline int fnd_pre(int i) {
	auto it = s.lower_bound(i - bal);
	if(it == s.begin()) {
		return 0;
	}
	--it;
	return *it + bal;
}

inline int fnd_nxt(int i) {
	auto it = s.lower_bound(i - bal);
	if(it == s.end()) {
		return maxn;
	}
	return *it + bal;
}

void work(int &i, int &x, int &y, int l, int r, int a, int b, int c) {
	if(a && b && x == y) {
		if(x && y) {
			ins(i);
			pb(i + 1, i + 1, 1, 1, 1);
		}
		del(r);
		if(c > 1) {
			int j = fnd_pre(r);
			pb(l + 1, j + 1, 1, 1, c - 1);
		}
		i = r;
		x = y = 1;
		return;
	}
	for(;;) {
		int j = fnd_nxt(i + 1);
		if(j > r) {
			return;
		}
		del(j);
		if(x && y) {
			pb(i + 1, i + 1, 1, 1, 1);
			ins(i);
			x = a;
			y = b;
			i = j;
		}
		else {
			if(x + a > 1 || y + b > 1) {
				pb(j, j, x + a > 1, y + b > 1, 1);
				ins(j - 1);
			}
			x ^= a;
			y ^= b;
			i = j;
		}
		if(a != b) {
			a ^= 1;
			b ^= 1;
		}
	}
}

void Out(char *s) {
	int i = maxn - 1;
	while(!s[i]) {
		--i;
	}
	while(s[i] == '0') {
		--i;
	}
	while(i >= 0) {
		*pnt++ = s[i--];
	}
	*pnt++ = '\n';
	return;
}

int main() {
	fread(in, 1, sizeof in, stdin);
	pnt = in;
	while(*pnt < '0') {
		++pnt;
	}
	while(*pnt >= '0') {
		n = n * 10 + *pnt++ - '0';
	}
	while(*pnt < '0') {
		++pnt;
	}
	while(*pnt >= '0') {
		m = m * 10 + *pnt++ - '0';
	}
	while(*pnt < '0') {
		++pnt;
	}
	while(*pnt >= '0') {
		k = k * 10 + *pnt++ - '0';
	}
	while(*pnt < '0') {
		++pnt;
	}
	S = pnt + n - 1;
	pnt = S + 1;
	while(*pnt < '0') {
		++pnt;
	}
	T = pnt + m - 1;
	for (int i = 0; i < maxn; ++i) {
		if(i >= n && i >= m && !f.size()) {
			break;
		}
		int x = i < n ? S[-i] - '0' : 0, y = i < m ? T[-i] - '0' : 0, I = 0, z = fnd_pre(maxn);
		debug("--------------------------------------------------\n%d:\n", i);
		debug("%d %d\n", x, y);
		nf.clear();
		for (auto t: f) {
			work(I, x, y, t.l, t.r, t.a, t.b, t.c);
		}
		if(x && y) {
			if(z < k) {
				pb(z + 1, z + 1, 1, 1, 1);
				ins(z);
				x = y = 0;
			}
		}
		f = nf;
		++bal;
		a[i] = x + '0';
		b[i] = y + '0';
#ifdef DEBUG
		for (auto t: f) {
			debug("\t[%d, %d]: (%d, %d) %d\n", t.l, t.r, t.a, t.b, t.c);
		}
		debug("s:\t");
		for (auto i: s) {
			debug("%d ", i + bal);
		}
		debug("\n");
		debug("%d %d\n", x, y);
#endif
	}
	pnt = out;
	Out(a);
	Out(b);
	fwrite(out, 1, pnt - out, stdout);
	return 0;
}


Measured memory_bytes: 14336