QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#14522. Military Training I

统计

Siri is bored while standing in formation during military training, so she thinks of a problem.

In the queue training, students must stand in formation strictly according to the instructor's requirements. The formation of Siri's company is an $n \times m$ rectangle. When the instructor directs their training, there are four types of commands: move forward, move backward, align left, and align right.

  • After the "move forward" command is issued, students will move as far forward as possible without changing their column. That is, if there are a total of $c_i$ students in column $i$ before the command is issued, then after the students execute the command, the first $c_i$ rows of column $i$ will each have a student, and the remaining $n - c_i$ rows will have no students. The "move backward" command works similarly.
  • After the "align left" command is issued, students will move as far to the left as possible without changing their row. That is, if there are a total of $r_i$ students in row $i$ before the command is issued, then after the students execute the command, the first $r_i$ columns of row $i$ will each have a student, and the remaining $m - r_i$ columns will have no students. The "align right" command works similarly.

Siri discovers that after the instructor uses the above four types of commands for at most $10^{18}$ adjustments (or even zero commands), the students' positions may vary. Here, we consider students to be identical; that is, two states are different if and only if there exists a position that has a student in one state but not in the other.

Siri wants to know if there exists an initial configuration such that there are exactly $k$ distinct states.

Input

The first line contains an integer $T$ ($1 \le T \le 10^3$), representing the number of test cases.

For the next $T$ lines, each line contains three integers $n, m, k$ ($1 \le n, m \le 1000, 1 \le k \le 10^9$), representing the length and width of the company formation and the required number of states.

It is guaranteed that $\sum n \times m \le 10^6$.

Output

For each test case, output Yes or No on the first line to indicate whether a solution exists.

If a solution exists, output $n$ strings of length $m$ consisting only of - and * in the next $n$ lines. If the $j$-th character of the $i$-th string is *, it means there is a student at the $i$-th row and $j$-th column of the initial formation. If a solution exists, your output must ensure that at least one student is present; otherwise, it will be considered an incorrect answer.

Note: In this problem, please do not output extra spaces at the end of lines.

Examples

Input 1

6
1 1 1
2 3 3
9 9 8
2 4 4
3 5 3
2 2 5

Output 1

Yes
*
Yes
*-*
*-*
No
Yes
**--
****
Yes
*-***
*-***
*-***
Yes
-*
*-

Note

For the second example, there are the following three states:

*-* **- -** *-* **- -**

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.