import Text.Printf
import Data.Bits

main :: IO()
main = do
  [n, m, k] <- map read . words <$> getLine
  s <- getLine
  t <- getLine
  printf "%s" $ slv k (s2b s) (s2b t)

slv :: Integer -> Integer -> Integer -> String
slv 0 s t = unlines [b2s s, b2s t]
slv k s t = slv (k-1) (s + z) (t + z)
  where z = (.&.) s t

s2b :: String -> Integer
s2b str = foldl (\x y -> 2 * x + y) 0 $ map (\x -> read [x]) str

b2s ::Integer -> String
b2s v = b2s' v ""
  where b2s' 0 ret = ret
        b2s' val ret = b2s' (val `div` 2) (modChar val:ret)
        modChar n | n `mod` 2 == 1 = '1'
                  | otherwise = '0'
