function Main(input) {
	input = input.trim();
  var N = parseInt(input.split("\n")[0].split(" ")[0]);
  var M = parseInt(input.split("\n")[0].split(" ")[1]);
  var K = parseInt(input.split("\n")[0].split(" ")[2]);
  var S = parseInt(input.split("\n")[1],2);
  var T = parseInt(input.split("\n")[2],2);
  for(var i = 0; i < K; i++){
    var Z = S & T;
    S += Z;
    T += Z;
  }
  //console.log(S);
  //console.log(T);
  console.log(S.toString(2));
  console.log(T.toString(2));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
