All of us like our second main teaching building and always prefer a comfortable seat. To make the following problem easy to handle, we assume there are N rows and M lines of seats in a study room. And we set each seat a singular comfortable value. That means there will not be two seats have same comfortable value. When a student comes into this room, he will choose the empty seat with the maximum comfortable value. However, if there is already a student adjoining to this seat (left or right), he will choose the empty seat with the next maximum comfortable value, until there is nobody at his left and right side.|
As you see, if we know all the comfortable values, we can confirm how many students will be in this room. And this is your job.
Input （Please use standard input, and don’t read or write files.）
There are two integers N and M in the first line.
Then follows N lines, each contains M integers. The number on the ith line jth row means the comfortable value of the seat at ith line jth row.
Output （Please use standard output, and don’t read or write files.）
You should output n lines, each contains m characters. 'E' means there is no person on the seat, while 'P' means there is one.
Don't output any blank space and add a black line at end of your output.
1 2 3 4
5 6 7 8
9 10 11 12
For 30% cases, 0 < N, M <= 40
For 70% cases, 0 < N, M <= 200
For 100% cases, 0 < N, M <= 400
上一篇：Encode and Decode