P13562 "WWOI R1" WsW's Farmland.

Background

WsW can be happy and angry.

Description

WsW and bln each have a piece of farmland. Both farmlands consist of $n\times m$ cells, where the top-left cell has coordinates $(1,1)$ and the bottom-right cell has coordinates $(n,m)$. At the beginning, in WsW's farmland, the cell at $(x,y)$ has a seedling with growth value $a_{x,y}$; in bln's farmland, the cell at $(x,y)$ has a seedling with growth value $b_{x,y}$. At the beginning of each following day, a little fairy uses a potion on the cell $(x_0,y_0)$ in **either WsW's or bln's farmland**. There are three types of potions: - Potion $1$, with $3$ parameters, increases the growth value by $k$ for every cell $(x,y)$ in that farmland that satisfies $x=x_0$ **or** $y=y_0$. - Potion $2$, with $5$ parameters, increases the growth value by $k$ for every cell $(x,y)$ in that farmland that satisfies $x_0\le x\le x_0+u$ and $y_0\le y\le y_0+v$. - Potion $3$, with $5$ parameters, increases the growth value by $k$ for every cell $(x,y)$ in that farmland that satisfies $x_0\le x\le x_0+u$ and $y_0+x-x_0\le y\le y_0+x-x_0+v$. The potion does not affect areas outside the farmland. **The potion takes effect instantly, and its effect does not disappear after the end of the day.** After the fairy uses a potion, WsW checks both their own farmland and bln's farmland. If, for every cell with the same coordinates in the two farmlands, the growth values are all equal, then WsW will be very happy; otherwise, WsW will be very angry.

Input Format

The first line contains two integers $n,m$, representing the size of the farmlands. The next $n$ lines each contain $m$ numbers, describing the initial growth values of the seedlings in WsW's farmland. The next $n$ lines each contain $m$ numbers, describing the initial growth values of the seedlings in bln's farmland. The next line contains a positive integer $q$, meaning there are $q$ days in total. The next $q$ lines each describe one potion use. First read two integers $t,f$. Here $t$ is the potion type. If $f=0$, the potion is used on WsW's farmland; if $f=1$, it is used on bln's farmland. Then: - If $t=1$, it means potion $1$ is used. Then input $3$ integers $x_0,y_0,k$. - If $t=2$, it means potion $2$ is used. Then input $5$ integers $x_0,y_0,k,u,v$. - If $t=3$, it means potion $3$ is used. Then input $5$ integers $x_0,y_0,k,u,v$.

Output Format

Output $q$ lines in total, describing WsW's mood after the potion is used each day. If WsW is very happy, output `Happy`; if WsW is very angry, output `Angry`.

Explanation/Hint

### Sample 1 Explanation The red numbers indicate the growth values in the cells that change on that day. ![](https://cdn.luogu.com.cn/upload/image_hosting/xpcmfh4l.png) It can be seen that only on day $1$ and day $5$ do the corresponding cells in the two farmlands have the same growth values. ### Constraints **This problem uses bundled testdata.** For all testdata, it is guaranteed that: * $1\le n,m\le 800$,$1\le q\le 5\times 10^5$. * For all $a_{x,y},b_{x,y}$, we have $|a_{x,y}|,|b_{x,y}|\le 5\times 10^5$. * $t\in \{1,2,3\}$, $f\in \{0,1\}$. * $1\le x_0\le n$, $1\le y_0\le m$, $|k| \le 5\times 10^5$, $0\le u\le n$, $0\le v\le m$. |Subtask ID|$n,m\le$|$q\le$| $\lvert a_{i,j}\rvert,\lvert b_{i,j}\rvert,\lvert k\rvert\le$ |Special Restriction|Score| |:-:|:-:|:-:|:-:|:-:|:-:| |$1$| $100$ | $100$ | $100$ |Guaranteed that there is no case with $t=3$.|$10$| |$2$| ^ | ^ | ^ | None.|$20$| |$3$| $800$ | $5\times10^5$ | $5\times 10^5$ |Guaranteed that there is no case with $t=3$.|$30$| |$4$| ^ | ^ | ^ | None.|$40$| Translated by ChatGPT 5