/**
 *    author:  tourist
 *    created: 03.06.2018 16:16:04       
**/
#undef _GLIBCXX_DEBUG
#undef LOCAL

#include <bits/stdc++.h>

using namespace std;

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template <typename T>
class fenwick {
  public:
  vector<T> fenw;
  int n;

  fenwick(int _n) : n(_n) {
    fenw.resize(n);
  }

  void modify(int x, T v) {
    while (x < n) {
      fenw[x] += v;
      x |= (x + 1);
    }
  }

  T get(int x) {
    T v{};
    while (x >= 0) {
      v += fenw[x];
      x = (x & (x + 1)) - 1;
    }
    return v;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  string foo, bar;
  cin >> foo;
  cin >> bar;
  reverse(foo.begin(), foo.end());
  reverse(bar.begin(), bar.end());
  const int MAX = (int) 1e6 + 100;
  vector<int> one(MAX), two(MAX), both(MAX);
  fenwick<int> fenw_three(MAX), fenw_both(MAX);
  for (int i = 0; i < (int) foo.size(); i++) {
    if (foo[i] == '1' && (i >= (int) bar.size() || bar[i] == '0')) {
      one[i] = 1;
      fenw_three.modify(i, 1);
    }
  }
  swap(foo, bar);
  for (int i = 0; i < (int) foo.size(); i++) {
    if (foo[i] == '1' && (i >= (int) bar.size() || bar[i] == '0')) {
      two[i] = 1;
      fenw_three.modify(i, 1);
    }
  }
  swap(foo, bar);
  for (int i = 0; i < (int) foo.size() && i < (int) bar.size(); i++) {
    if (foo[i] == '1' && bar[i] == '1') {
      both[i] = 1;
      fenw_both.modify(i, 1);
    }
  }
  const int inf = (int) 1e9;
  vector<vector<int>> events(k + 1);
  vector<int> eta(MAX, -1);
  int cur_time = 0;
  auto add_event = [&](int i) {
    int x = inf;
    {
      int sum = fenw_three.get(MAX - 1);
      int my = fenw_three.get(i);
      if (my < sum) {
        int low = i, high = MAX - 1;
        while (low < high) {
          int mid = (low + high) >> 1;
          if (fenw_three.get(mid) > my) {
            high = mid;
          } else {
            low = mid + 1;
          }
        }
        x = low;
      }
    }
    int t = cur_time + (x - i);
    debug(i, x, y, cur_time, t);
    if (t <= k) {
      debug("push!", t, i - cur_time);
      events[t].push_back(i - cur_time);
      eta[i - cur_time] = t;
    } else {
      eta[i - cur_time] = -1;
    }
  };
  for (int i = 0; i < (int) both.size(); i++) {
    if (both[i] == 1) {
      add_event(i);
    }
  }
  for (int T = 0; T <= k; T++) {
    sort(events[T].begin(), events[T].end());
    events[T].resize(unique(events[T].begin(), events[T].end()) - events[T].begin());
    for (int p : events[T]) {
      if (T != eta[p]) {
        continue;
      }
      if (both[p] == 0) {
        continue;
      }
      debug(T, p);
      cur_time = T;
      int pos = p + cur_time;
      both[p] = 0;
      fenw_both.modify(p, -1);
      if (one[pos] == 1) {
        two[pos] = 1;
        fenw_three.modify(pos, 1);
        while (one[pos] == 1) {
          one[pos] = 0;
          fenw_three.modify(pos, -1);
          pos++;
        }
        if (two[pos] == 1) {
          two[pos] = 0;
          fenw_three.modify(pos, -1);
          both[pos - cur_time] = 1;
          fenw_both.modify(pos - cur_time, 1);
          add_event(pos);
        } else {
          one[pos] = 1;
          fenw_three.modify(pos, 1);
        }
      } else {
        one[pos] = 1;
        fenw_three.modify(pos, 1);
        while (two[pos] == 1) {
          two[pos] = 0;
          fenw_three.modify(pos, -1);
          pos++;
        }
        if (one[pos] == 1) {
          one[pos] = 0;
          fenw_three.modify(pos, -1);
          both[pos - cur_time] = 1;
          fenw_both.modify(pos - cur_time, 1);
          add_event(pos);
        } else {
          two[pos] = 1;
          fenw_three.modify(pos, 1);
        }
      }
      if (p > 0 && both[p - 1]) {
        add_event(p - 1 + cur_time);
      }
    }
  }
  cur_time = k;
  vector<int> res_a, res_b;
  for (int i = 0; i < (int) one.size(); i++) {
    if (one[i] == 1) {
      res_a.push_back(i);
    }
  }
  for (int i = 0; i < (int) two.size(); i++) {
    if (two[i] == 1) {
      res_b.push_back(i);
    }
  }
  for (int i = 0; i < (int) both.size(); i++) {
    if (both[i] == 1) {
      res_a.push_back(i + cur_time);
      res_b.push_back(i + cur_time);
    }
  }
  int max_a = *max_element(res_a.begin(), res_a.end());
  int max_b = *max_element(res_b.begin(), res_b.end());
  string str_a(max_a + 1, '0');
  string str_b(max_b + 1, '0');
  for (int i : res_a) {
    str_a[max_a - i] = '1';
  }
  for (int i : res_b) {
    str_b[max_b - i] = '1';
  }
  cout << str_a << '\n';
  cout << str_b << '\n';
  return 0;
}
