#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 2000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int a[N],b[N]; vector<int> A,B;
struct node
{	int s,w;node *pre,*nxt;
	node(int _s=0,int _w=0):s(_s),w(_w){pre=nxt=0;}
}*S,*T;
inline void ins(node *p,int s,int w)
{node *x=new node(s,w);p->nxt->pre=x;x->nxt=p->nxt;p->nxt=x;x->pre=p;}
inline void del(node *x){x->pre->nxt=x->nxt;x->nxt->pre=x->pre;}
inline void work(int x,int k)
{	int la=x;
	for(node *i=S->nxt,*j=i->nxt;i!=T;i=j->nxt)
	{	if(i->s-la>k) break; k-=i->s-la; 
		int cur=3&i->w,gg=i->s; i->w=(i->w==2?1:2);
		if(i->nxt!=T&&i->nxt->s!=i->s+1){ins(i,i->s+1,cur);return;}
		for(j=i->nxt;j!=T;j=j->nxt)
		if(j->s==gg+1){del(j);gg=j->s;if(j->w!=cur){la=j->s;break;}}
		else{ins(j->pre,gg+1,cur);return;}
		if(j==T){ins(T->pre,gg+1,cur);return;}
	}
	A.push_back(la+k),B.push_back(la+k);
}
int main()
{	int n,m,k; cin>>n>>m>>k; S=new node(0,0); T=new node(0,0); S->nxt=T; T->pre=S;
	for(rint i=n;i>=1;i--) scanf("%1d",&a[i]);
	for(rint i=m;i>=1;i--) scanf("%1d",&b[i]);
	for(rint i=max(n,m);i>min(n,m);i--) if(a[i]||b[i]) ins(S,i,a[i]<<1|b[i]);
	for(rint i=min(n,m);i;i--)
	if(a[i]&b[i]) work(i,k);
	else if(a[i]||b[i]) ins(S,i,a[i]<<1|b[i]);
	for(node *i=S->nxt;i!=T;i=i->nxt)
	if(i->w==1) B.push_back(i->s); else A.push_back(i->s);
	sort(A.begin(),A.end(),greater<int>());
	for(rint i=0;i<A.size();i++)
	{	putchar('1');
		for(rint j=A[i]-1;j>(i+1<A.size()?A[i+1]:0);j--) putchar('0');
	}
	cout<<endl; sort(B.begin(),B.end(),greater<int>());
	for(rint i=0;i<B.size();i++)
	{	putchar('1');
		for(rint j=B[i]-1;j>(i+1<B.size()?B[i+1]:0);j--) putchar('0');
	}
	return 0;
}
