P2191 Xiao Z's Love Letter

Background

As everyone knows, Xiao Z is the very model of a tall, rich, and handsome guy, so he has many, many girls. Xiao Z is going to write a love letter to his girls. Being cautious, he certainly would not write it plainly on paper (otherwise, if his mischievous friends found it, wouldn’t that be bad?).

Description

Although Xiao Z was very careful, the cunning Xiao D still discovered the trick. Being generous, Xiao D naturally wants to share this secret with everyone. Xiao Z starts with two $N \times N$ sheets of paper: one is transparent, and the other has letters on it. Then Xiao Z blacks out some cells on the transparent sheet. Next, he gives both sheets to the girl. The girl and Xiao Z have agreed in advance to read it as follows: first place the transparent sheet on top of the other sheet, then write down the exposed letters in row-major order, from top to bottom and from left to right; then rotate by $90$ degrees and read again... do this a total of four times... see the sample. Xiao D somehow got the love letter. Please enjoy it together and print out the content.

Input Format

Line $1$: an integer $N$. Lines $2$ to $N+1$: each line has $N$ characters, representing skj's transparent sheet, where `O` indicates an unblackened cell and `#` indicates a blackened cell. Lines $N+2$ to $2N+1$: each line has $N$ characters, containing only uppercase letters, representing the other sheet as described.

Output Format

One line: the content of the love letter.

Explanation/Hint

$1 \leq N \leq 1000$. Translated by ChatGPT 5