Matrix Subtraction
题号:NC211822
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given a matrix of size and two integers , determine weither it is possible to make all entrys of zero by repeatedly choosing submatrices and reduce the values in the chosen matrices by 1. If possible, print "^_^" in one line, or print "QAQ" in one line.

输入描述:

The first line contains one integer , denoting the number of test cases.

For each test case:

The first line contains four integers , denoting the size of given matrix and the size of chosen submatrices respectively.

The next lines each contains integers , denoting the entrys of matrix .

It's guaranteed that .

输出描述:

Print  lines each containing a string "^_^" or "QAQ", denoting the answer to each test case.
示例1

输入

复制
2
2 2 1 2
1 2
1 2
2 3 1 2
1 2 1
1 2 1

输出

复制
QAQ
^_^

说明

For the second case, one possible scheme is to choose (1, 1) - (1, 2), (1, 2) - (1, 3), (2, 1) - (2, 2), (2, 2) - (2, 3)_{} respectively.