#include<bits/stdc++.h>
using namespace std;

int main(){
    int_fast64_t N, M, K, rem;
    vector<int_fast64_t> bullet;
    set<pair<int_fast64_t, int_fast64_t>> rails;
    string S, T;

    scanf("%lld%lld%lld", &N, &M, &K);
    cin >> S >> T;
    vector<int_fast64_t> a(max(N, M) * 2 + 100);
    vector<array<int_fast64_t, 2>> ans(max(N, M) * 2 + 100);
    for(int i = 0; i < M; ++i)
        a[M - i - 1] = T[i] & 1;
    for(int i = 0; i < N; ++i)
        a[N - i - 1] |= 2 * (S[i] & 1);
    M = max(N, M);
    for(int i = 0; i < M; ++i){
        if(a[i] == 3){
            a[i] = 0;
            bullet.push_back(i);
        }
    }
    reverse(bullet.begin(), bullet.end());
    rails.insert({0, a[0]});
    for(int i = 1; i <= M; ++i)
        if(a[i] != a[i - 1])rails.insert({i, a[i]});
    rails.insert({M + K + 10, 27});
    auto itr = --rails.end();
    for(auto& b : bullet){
        rem = K;
        while(itr -> first > b)--itr;
        ++itr;
        for(auto beg = itr, thi = itr, nec = itr, edn = rails.end(); beg != edn; ++beg, nec = beg){
            ++nec;
            thi = nec;
            ++thi;
            if(rem == 0 || beg -> first > M + K)break;
            if(beg -> first > b + rem){
                b += rem;
                rem = 0;
                break;
            }else{
                rem -= beg -> first - b;
                b = beg -> first;
            }
            if(beg -> second == 0)continue;
            int_fast64_t nowidx = beg -> first, nowclr = beg -> second;
            if(thi -> first - nec -> first == 1){
                if(beg -> second + nec -> second == 3){
                    b = nec -> first;
                    if(thi -> second == 0)rails.erase(thi);
                    rails.erase(nec);
                    rails.insert(beg, {beg -> first + 1, 0});
                    nec = beg;
                    --nec;
                    rails.erase(beg);
                    beg = rails.insert(nec, {nowidx, 3 ^ nowclr});
                }else{
                    b = nec->first;
                    if(thi -> second == beg -> second)rails.erase(thi);
                    rails.erase(nec);
                    rails.insert(beg, {b, beg -> second});
                    if(b != beg -> first + 1)rails.insert(beg, {beg -> first + 1, 0});
                    nec = beg;
                    --nec;
                    rails.erase(beg);
                    beg = rails.insert(nec, {nowidx, 3 ^ nowclr});
                    b = M + K + 10;
                    break;
                }
            }else{
                if(beg -> second + nec -> second == 3){
                    b = nec -> first;
                    rails.erase(nec);
                    rails.insert(beg, {b + 1, 3 - beg -> second});
                    rails.insert(beg, {beg -> first + 1, 0});
                    nec = beg;
                    --nec;
                    rails.erase(beg);
                    beg = rails.insert(nec, {nowidx, 3 ^ nowclr});
                }else{
                    b = nec->first;
                    rails.erase(nec);
                    rails.insert(beg, {b + 1, 0});
                    rails.insert(beg, {b, beg -> second});
                    if(b != beg -> first + 1)rails.insert(beg, {beg -> first + 1, 0});
                    nec = beg;
                    --nec;
                    rails.erase(beg);
                    beg = rails.insert(nec, {nowidx, 3 ^ nowclr});
                    b = M + K + 10;
                    break;
                }
            }
        }
        if(rem > 0){
            b += rem;
        }
    }
    for(auto& i : ans)
        i[0] = i[1] = 0;
    int J;
    for(auto beg = rails.begin(), nec = beg, edn = rails.end(); beg != edn; ++beg){
        nec = beg;
        nec++;
        if(J = beg -> second){
            for(int i = beg->first, k = nec->first; i < k; ++i){
                ans[i][0] = (J >> 0) & 1;
                ans[i][1] = (J >> 1) & 1;
            }
        }
    }
    for(auto i : bullet)ans[i][0] = ans[i][1] = 1;
    for(int it = 1; it >= 0; --it){
        for(int i = M + K + 5, j = 0; i >= 0; --i){
            if(j |= ans[i][it])cout << ans[i][it];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 113668