"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const H = arg[0].split(" ")[0];
    const W = arg[0].split(" ")[1];
    
    const pixels = arg.slice(1, H + 1);
    let answer    = [];
    
    for(let i=0; i<H; i++) {
        answer.push(pixels[i]);
        answer.push(pixels[i]);
    }
    
    console.log(answer.join("\n"));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));