407130: GYM102697 101 Metropolis
Description
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.
InputThe 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.
OutputOutput $$$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.
ExamplesInput5 35689 85723 39109 00004 39580Output
NNNNY NNNNN NYNNY NNNNN NYNYNInput
3 999 999 999Output
NNN NNN NNN