const main = input => {
  const inputs = input.trim().split('\n')
  const [H, W] = inputs[0].split(' ').map(x => parseInt(x))
  const picture = []
  for (let i = 0; i < H; i++) {
    console.log(inputs[i + 1])
    console.log(inputs[i + 1])
  }
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
