#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

const int MAXN = 1000000;
const int MAXTIMES = 1000000;
const int MAXRESLEN = MAXN + MAXTIMES;

char s[MAXN + 1]; int slen;
char t[MAXN + 1]; int tlen;
int ntimes;

int reslen;
char sres[MAXRESLEN + 1];
char tres[MAXRESLEN + 1];

int prv[MAXRESLEN], nxt[MAXRESLEN];

void replace(int a, int b) {
	if (prv[a] != -1) nxt[prv[a]] = b;
	if (nxt[a] != -1) prv[nxt[a]] = b;
	prv[b] = prv[a], nxt[b] = nxt[a], prv[a] = nxt[a] = -2;
}
void remove(int a) {
	if (prv[a] != -1) nxt[prv[a]] = nxt[a];
	if (nxt[a] != -1) prv[nxt[a]] = prv[a];
	prv[a] = nxt[a] = -2;
}
void insertbefore(int a, int b) {
	assert(prv[b] == -2 && nxt[b] == -2);
	if (prv[a] != -1) nxt[prv[a]] = b; prv[b] = prv[a];
	prv[a] = b; nxt[b] = a;
}


void process(int at) {
	int rem = ntimes;
	while (rem > 0) {
		//printf("at=%d rem=%d\n", at, rem);
		sres[at] = tres[at] = '0';
		assert(prv[at] != -2 && nxt[at] != -2);
		int to = max(at - rem, prv[at]);
		assert(to >= 0);
		if (to > prv[at]) {
			sres[to] = tres[to] = '1';
			replace(at, to);
			rem = 0, at = to;
		} else {
			//printf("to=%d\n", to);
			assert((sres[to] == '0' || tres[to] == '0') && (sres[to] == '1' || tres[to] == '1') && prv[to] != -2 && nxt[to] == at);
			remove(at);
			rem -= at - to, at = to;
			bool incs = true, inct = true;
			while (true) {
				//printf("\tat=%d incs=%d inct=%d\n", at, incs ? 1 : 0, inct ? 1 : 0);
				if (incs) if (sres[at] == '0') { sres[at] = '1'; incs = false; } else { sres[at] = '0'; }
				if (inct) if(tres[at] == '0') { tres[at] = '1'; inct = false; } else { tres[at] = '0'; }
				if (sres[at] == '1' && tres[at] == '1') { assert(!incs && !inct); break; }
				if (!incs && !inct) { assert(sres[at] == '1' || tres[at] == '1'); return; }
				assert((!incs || sres[at] == '0') && (!inct || tres[at] == '0') && (incs || inct) && (!incs || !inct) && at >= 1);
				if (prv[at] == -1 || prv[at] != at - 1) {
					sres[at - 1] = incs ? '1' : '0', tres[at - 1] = inct ? '1' : '0';
					if (sres[at] == '0'&&tres[at] == '0') replace(at, at - 1); else insertbefore(at, at - 1);
					return;
				} else {
					if (sres[at] == '0'&&tres[at] == '0') remove(at);
					at = at - 1;
				}
			}
		}
	}
}

void run() {
	scanf("%d%d%d%s%s", &slen, &tlen, &ntimes, s, t);

	reslen = max(slen, tlen) + ntimes;
	REP(i, reslen) sres[i] = slen - reslen + i >= 0 ? s[slen - reslen + i] : '0'; sres[reslen] = '\0';
	REP(i, reslen) tres[i] = tlen - reslen + i >= 0 ? t[tlen - reslen + i] : '0'; tres[reslen] = '\0';
	//printf("%s\n%s\n", sres, tres);

	int last = -1;
	REP(i, reslen) if (sres[i] == '0'&&tres[i] == '0') prv[i] = nxt[i] = -2; else { prv[i] = last; if (last != -1) nxt[last] = i; last = i; }
	if (last != -1) nxt[last] = -1;

	REP(i, reslen) if (sres[i] == '1'&&tres[i] == '1') process(i);
	//printf("%s\n%s\n", sres, tres);

	int soff = 0; while (soff < reslen&&sres[soff] == '0') ++soff;
	int toff = 0; while (toff < reslen&&tres[toff] == '0') ++toff;
	printf("%s\n%s\n", sres + soff, tres + toff);
}

int main() {
	run();
	return 0;
}
