#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e6+5;
int n,m,k,top,cnt,foo[N],bar[N];pair<int,int>stk[N],tmp[N];
char s[N],t[N];
void output(int *arr){
	int p=max(n,m)+k;
	while(!arr[p])--p;
	while(p)putchar(arr[p--]+'0');
	puts("");
}
int main(){
	scanf("%d%d%d%s%s",&n,&m,&k,s+1,t+1);
	reverse(s+1,s+n+1);reverse(t+1,t+m+1);
	for(int i=max(n,m);i;--i)
		if(s[i]=='1'&&t[i]=='1'){
			int now=3,tim=k,pos=i;
			while(top&&now)
				if(now==3)
					if(tim>=stk[top].first-pos){
						tim-=stk[top].first-pos;pos=stk[top].first;
						if(now^stk[top].second)tmp[++cnt]={pos,now^stk[top].second};
						now=stk[top--].second;
					}
					else break;
				else
					if(stk[top].first==pos+1){
						++pos;
						if(now^stk[top].second)now=3;
						--top;
					}
					else break;
			if(now==3)pos+=tim,foo[pos]=bar[pos]=1;
			else if(now)tmp[++cnt]={pos+1,now};
			while(cnt)stk[++top]=tmp[cnt--];
		}
		else if(s[i]=='1'||t[i]=='1')
			stk[++top]={i,(s[i]=='1')<<1|(t[i]=='1')};
	for(int i=1;i<=top;++i){
		foo[stk[i].first]=stk[i].second>>1;
		bar[stk[i].first]=stk[i].second&1;
	}
	output(foo);output(bar);return 0;
}
