const input = require("fs").readFileSync(0,"utf8").toString().trim().split("\n");
let s="";

for(let col=0; col<15; col++){
    let flag = true;
    for(let row=0; row<5; row++){
        if(input[row][col] !== undefined){
            s += input[row][col];
            flag = false;
        }
    }
    if(flag) break;
}

console.log(s);