P7873 "SWTR-7" Scores (easy version).

Background

#### This problem is the easy version of Scores. Note that the constraints are different from the [hard](https://www.luogu.com.cn/problem/P7876) version. #### Please pay attention to the special time and memory limits. A simplified statement is provided below the description.

Description

There are $n$ students in Little A's class. They recently took an exam with $m$ subjects. The score of student $i$ in subject $j$ is an **integer** $s_{i,j}\ (0\leq s_{i,j}\leq 100)$. For student $i$, if there **exists another** student $j$ such that student $i$'s score in **every** subject is **not greater than** student $j$'s score, then student $i$ will feel upset. The Mid-Autumn Festival is coming. Kind Little A does not want any classmate to feel upset, so he decides to hack the school's management system and modify everyone’s scores. Before doing such a risky thing, Little A wants to know whether he can achieve his goal. However, since there are too many students and subjects, he asks you to help construct a valid solution. If there exists a score table where no student feels upset, output $\texttt{YES}$ first, and then output **any** score table that satisfies the requirement; otherwise output $\texttt{NO}$. --- **"Simplified Statement"** Try to construct an $n\times m$ matrix $s$ such that all elements are integers in $[0,100]$, and for any $i,j\ (i\neq j)$ there exists a $k$ such that $s_{i,k}>s_{j,k}$.

Input Format

**This problem has multiple test cases.** The first line contains an integer $t$, **indicating the test point ID**. The second line contains an integer $T$, **indicating the number of test cases**. For each test case: One line contains two integers $n,m$.

Output Format

For each test case: If Little A's requirement cannot be achieved, output one line containing the string $\texttt{NO}$. Otherwise, output one line containing the string $\texttt{YES}$, then output $n$ lines, each containing $m$ integers separated by spaces. The $j$-th number on line $i+1$ represents $s_{i,j}$.

Explanation/Hint

**"Special Judge"** **This problem uses Special Judge. Please read the output format carefully. Wrong output format may lead to UKE.** The SPJ will first check whether your first line matches the correct answer. If it matches and the answer is $\texttt{YES}$, the SPJ will then check whether your output satisfies Little A's requirement: - $0\leq s_{i,j}\leq 100$ and $s_{i,j}$ is an integer. - Each student has at least one subject in which their score is higher than another student. If a solution exists and you output $\texttt{YES}$ but your construction is wrong, you will get $50\%$ of the score for that test point. **"Constraints and Notes"** This problem has 6 test points. - Testcase #0 (1 point): the sample. - Testcase #1 (10 points): $n=1$. - Testcase #2 (10 points): $m=1$. - Testcase #3 (20 points): $m=2$. - Testcase #4 (30 points): $n\leq m$. - Testcase #5 (29 points): no special constraints. For $100\%$ of the testdata, $1\leq n,m\leq 100$, $T=20$ (except Testcase #0). For all test points, **time limit is 200 ms, memory limit is 16 MB.** **"Source"** [Sweet Round 07](https://www.luogu.com.cn/contest/51774) A1. idea & solution & data: [Alex_Wei](https://www.luogu.com.cn/user/123294); validation: [chenxia25](https://www.luogu.com.cn/user/138400). Translated by ChatGPT 5