407130: GYM102697 101 Metropolis

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

101. Metropolistime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Metropolis

You're driving through a metropolis. The metropolis can be represented as a 2D grid of buildings, each with a height value between $$$0$$$ and $$$9$$$. You consider a building to be a skyscraper if it has a greater height than all of the buildings directly adjacent to it (including diagonally). Given this 2D grid of building heights, figure out which buildings are skyscrapers, and which ones aren't.

Input

The first line of input contains a positive integer $$$n$$$: the height and width of the metropolis. The height and width are always equal, so the metropolis is always a square. The next $$$n$$$ lines each contain strings of $$$n$$$ characters, each character being a digit from $$$0$$$ to $$$9$$$ representing the height of each building.

Output

Output $$$n$$$ lines. Each line should consist of a string of $$$n$$$ characters, with each character being $$$Y$$$, if the building at that position is a skyscraper, and $$$N$$$ if it is not.

ExamplesInput
5
35689
85723
39109
00004
39580
Output
NNNNY
NNNNN
NYNNY
NNNNN
NYNYN
Input
3
999
999
999
Output
NNN
NNN
NNN

加入题单

上一题 下一题 算法标签: