#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 2000005
#define mp make_pair
#define pb push_back
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) out(x / 10);
    putchar('0' + x % 10);
}
struct node {
    int id,par;
}sta[MAXN],tmp[MAXN];
int N,M,K,top,cnt,ns[MAXN],nt[MAXN],as[MAXN],at[MAXN];
char s[MAXN],t[MAXN];
void Solve() {
    read(N);read(M);read(K);
    scanf("%s",s + 1);scanf("%s",t + 1);
    reverse(s + 1,s + N + 1);reverse(t + 1,t + M + 1);
    for(int i = 1 ; i <= N ; ++i) ns[i] = s[i] - '0';
    for(int i = 1 ; i <= M ; ++i) nt[i] = t[i] - '0';
    int T = max(N,M);
    for(int i = T ; i >= 1 ; --i) {
	if(ns[i] == 1 && nt[i] == 1) {
	    int op = K,pos = i,x = 3;cnt = 0;
	    while(top) {
		if(x == 3) {
		    if(op >= sta[top].id - pos) {
			op -= sta[top].id - pos;
			pos = sta[top].id;
			tmp[++cnt] = (node){pos,x ^ sta[top].par};
			x = x & sta[top].par;
		    }
		    else break;
		}
		else if(x != 0){
		    if(sta[top].id == pos + 1) {
			pos = sta[top].id;
			if(x ^ sta[top].par) x = 3;
			else x = x & sta[top].par;
		    }
		    else break;
		}
		else break;
		--top;
	    }
	    if(x != 0 && x != 3) {
		++pos;
		tmp[++cnt] = (node){pos,x};
	    }
	    else if(x) {
		pos += op;
		as[pos] = at[pos] = 1;
	    }
	    for(int j = cnt ; j >= 1 ; --j) sta[++top] = tmp[j];
	}
	else {
	    if(ns[i] || nt[i]) {
		sta[++top] = (node){i,ns[i] << 1 | nt[i]};
	    }
	}
    }
    for(int i = 1 ; i <= top ; ++i) {
	as[sta[i].id] = (sta[i].par >> 1) & 1;
	at[sta[i].id] = sta[i].par & 1;
    }
    int c = T + K;
    while(as[c] == 0) --c;
    for(int i = c ; i >= 1 ; --i) {out(as[i]);}
    enter;
    c = T + K;
    while(at[c] == 0) --c;
    for(int i = c ; i >= 1 ; --i) {out(at[i]);}
    enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}
