**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
k  =int(input())
for i in range(k):
    n, c, d = map(int, input().split())
    l = list(map(int, input().split()))
    s = sum(l)
    x = (n**2)*(n-1)*(d+c)/2
    if s < x :print('NO')
    elif (s - x)%(n**2) !=0 : print('NO')
    else:print('YES')

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the given buggy code, we need to focus on edge cases and scenarios that can cause the code to fail. The buggy code has a few potential issues:

1. **Incorrect Calculation of the Sum of the Progressive Square:**
   - The formula used to calculate the sum of the elements in the progressive square is:
     \[
     x = \frac{n^2 \cdot (n-1) \cdot (d + c)}{2}
     \]
   - This formula is incorrect. The correct sum should be:
     \[
     x = n^2 \cdot a_{1,1} + n \cdot \frac{(n-1) \cdot c \cdot (n-1) \cdot d}{2}
     \]

2. **Incorrect Check for Validity:**
   - The code checks if the difference between the sum of the input array and the calculated sum is divisible by \( n^2 \). This is not a valid check for the correctness of the progressive square.

To expose these issues, we can create test cases that:

1. **Use a small \( n \) to ensure the output is manageable.**
2. **Use values of \( c \) and \( d \) that are large enough to cause the incorrect sum calculation to produce a different result from the correct sum.**
3. **Use an array that is not a valid progressive square to see if the code correctly identifies it as invalid.**

Here is a small-scale test input that should expose the bug:

```plaintext
5
3 2 3
3 9 6 5 7 1 11 4 8
3 2 3
3 9 6 5 7 1 10 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
```

This test input includes:
- A test case with a valid progressive square.
- A test case with an invalid progressive square due to a different value in the array.
- A test case with large values of \( c \) and \( d \) to test the sum calculation.
- A test case with a repeated value in the array to test the validity check.
- A test case with a larger \( n \) to test the general correctness.

The expected output for this test input should be:
```plaintext
NO
YES
YES
NO
NO
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
t=int(input())
for i in range(t):
    n,c,d=map(int,input().split())
    a=list(map(int,input().split()))
    xiao=min(a)
    f=1
    for j in range(n):
        for k in range(n):
            if(xiao+j*c+k*d not in a):
                f=0
                print("NO")
            else:
                a.remove(xiao+j*c+k*d)
    if(f==1):
        print("YES")

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases or scenarios that can cause the code to fail. The bug in the provided code is that it uses `a.remove(xiao+j*c+k*d)` to remove elements from the list, which can lead to issues if the list contains duplicate values or if the element is not found in the list.

Here are some scenarios to consider:
1. **Duplicate Values in the Input List**: If the input list contains duplicate values, the `remove` method will only remove the first occurrence, which can cause the code to fail.
2. **Missing Values**: If the input list is missing any value that should be in the progressive square, the code will fail.
3. **Small and Simple Test Cases**: To ensure the test input is small and complete, we can use a small `n` value and specific values for `c` and `d`.

Let's create a test case that includes duplicate values and a missing value:

```plaintext
3
3 2 3
3 9 6 5 7 1 11 4 8
3 2 3
3 9 6 5 7 1 11 4 8 8
3 2 3
3 9 6 5 7 1 11 4 12
```

Explanation:
1. **First Test Case**: This is a valid progressive square, and the code should output "YES".
2. **Second Test Case**: This test case includes a duplicate value (8) in the input list. The code will remove the first 8 and then try to remove the second 8, which will cause an error and the code will output "NO".
3. **Third Test Case**: This test case includes a missing value (8 is replaced by 12). The code will not find 8 in the list and will output "NO".

This test input should effectively expose the bug in the provided code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
from collections import Counter
t=int(input())
for _ in range(t):
    n,c,d=map(int,input().split())
    a=list(map(int,input().split()))
    b=[[0] * n for  i in range(n)]
    b[0][0]=min(a)
    for i in range(n):
        for j in range(n):
            if i==0 and j==0:
                continue
            elif i==0:
                b[i][j]=b[i][j-1]+d
            elif j==0:
                b[i][j]=b[i-1][j]+c
            else:
                b[i][j]=max(b[i][j-1],b[i-1][j]+min(c,d))
    e=set(a)
    x=[]
    e2=(i for j in b for i in j)
    for i in b:
        for j in i:
            x.append(j)
    y=Counter(x)
    z=Counter(a)
    e1=set(e2)
    if(e==e1 and y==z):
        print("Yes")
    else:
        print("No")

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To create a challenging test input that exposes the bug in the given buggy code, we need to focus on edge cases or scenarios that might cause the code to fail. Here are some considerations:

1. **Duplicate Values in the Input Array**: The buggy code might not handle duplicate values correctly. If the input array contains duplicate values, the code might incorrectly construct the matrix and fail to match the original array.

2. **Large Values for `c` and `d`**: The code might have issues with large values of `c` and `d`, leading to overflow or incorrect matrix construction.

3. **Small `n` Values**: The code might have issues with very small values of `n`, such as `n = 2`.

4. **Randomly Shuffled Array**: The input array should be randomly shuffled to ensure that the code correctly reconstructs the matrix.

Given these considerations, let's create a small-scale test input that includes duplicate values and a small `n` value.

```plaintext
3
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
3 1 1
1 2 3 4 5 6 7 8 9
```

### Explanation:
1. **Test Case 1**:
   - `n = 2`, `c = 100`, `d = 100`
   - Input array: `400 300 400 500`
   - This test case includes duplicate values (400) and large values for `c` and `d`.

2. **Test Case 2**:
   - `n = 3`, `c = 2`, `d = 3`
   - Input array: `3 9 6 6 5 1 11 4 8`
   - This test case includes duplicate values (6) and a small `n` value.

3. **Test Case 3**:
   - `n = 3`, `c = 1`, `d = 1`
   - Input array: `1 2 3 4 5 6 7 8 9`
   - This test case includes a small `n` value and a simple progressive square.

These test cases should help expose the bug in the given buggy code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import java.util.*;

public class Main {
    public static void main(String[] args) {

    Scanner scanner = new Scanner(System.in);
		int tc = scanner.nextInt();

		while(tc-->0){
		int n =  scanner.nextInt();
    int c =  scanner.nextInt();
		int d =  scanner.nextInt();
		int m = n*n;
		long[] arr = new long[m];

		 for(int i=0;i<m;i++){
		   arr[i] = scanner.nextLong();
		 }

		 Arrays.sort(arr);

		// for(int i=0;i<m;i++){
		//   System.out.print(arr[i]+" ");
		// }

		 long sm = arr[0];

		// System.out.println(sm);

		 ArrayList<Long> list = new ArrayList<>();

		 for(int i=0;i<n;i++){
		   if(i!=0){
		   sm = arr[i-1] + c;
		   }
		    for(int j=0;j<n;j++){
		      list.add(sm);
		      // System.out.print(sm +" ");
		      sm += d;
		    }
		    // System.out.println();
		    sm = 0;
		  }

		  long[] brr = new long[m];

		  for(int i=0;i<m;i++){
		    brr[i] = list.get(i);
		  }

		  Arrays.sort(brr);

		// System.out.println();

		// for(int i=0;i<m;i++){
		//   System.out.print(arr[i]+" ");
		// }

		  boolean flag = true;

		  for(int i=0;i<m;i++){
		    if(arr[i]!=brr[i]){
		      // System.out.println("Elements" + arr[i] +" "+brr[i]);
		      System.out.println("NO");
		      flag=false;
		      break;
		    }
		  }

		  if(flag){
		    System.out.println("YES");
		  }

		}

  }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the buggy code, we need to consider edge cases and scenarios where the code might fail. The buggy code has several potential issues, such as incorrect handling of the initial value and the way it constructs the matrix.

### Key Points to Consider:
1. **Initial Value Handling**: The code incorrectly sets the initial value `sm` to `arr[0]` and then uses it to construct the matrix. This can lead to incorrect values if the initial value in the array is not the correct starting value for the matrix.
2. **Matrix Construction**: The code constructs the matrix by iterating over rows and columns, but it does not correctly handle the initial value for each row.

### Challenging Test Input:
We can create a test input where the initial value in the array is not the correct starting value for the matrix, and the values in the array are such that they should form a valid matrix but the code fails to recognize it.

### Test Input:
```plaintext
3
3 2 3
1 4 7 3 6 9 5 8 11
3 2 3
2 5 8 4 7 10 6 9 12
3 2 3
2 5 8 4 7 10 6 9 13
```

### Explanation:
1. **Test Case 1**:
   - `n = 3`, `c = 2`, `d = 3`
   - Array: `1 4 7 3 6 9 5 8 11`
   - This should form a valid matrix:
     ```
     1 4 7
     3 6 9
     5 8 11
     ```
   - The code should output "YES".

2. **Test Case 2**:
   - `n = 3`, `c = 2`, `d = 3`
   - Array: `2 5 8 4 7 10 6 9 12`
   - This should form a valid matrix:
     ```
     2 5 8
     4 7 10
     6 9 12
     ```
   - The code should output "YES".

3. **Test Case 3**:
   - `n = 3`, `c = 2`, `d = 3`
   - Array: `2 5 8 4 7 10 6 9 13`
   - This should not form a valid matrix because the value `13` is not part of the progressive sequence.
   - The code should output "NO".

This test input should expose the bug in the buggy code, particularly in how it handles the initial value and constructs the matrix.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.in;
import static java.lang.System.out;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Q1 {
    public static void main(String[] args) {
        InputStream inputStream = in;
        OutputStream outputStream = out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int tests = in.nextInt();
        for (int i = 0; i < tests; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), c = in.nextInt(), d = in.nextInt();

            Map<Long, Integer> m1 = new TreeMap<>();
            Long sum1 = Long.valueOf(0);
            for (int i = 0; i < n * n; i++) {
                Long x = in.nextLong();
                if (m1.containsKey(x)) {
                    m1.put(x, m1.get(x) + 1);
                } else {
                    m1.put(x, 1);
                }
                sum1 += x;
            }

            Long sum2 = Long.valueOf(0);
            {
                Long cur = Long.valueOf(0);
                for (int i = 0; i < n; i++) {
                    Long val = cur;
                    for (int j = 0; j < n; j++) {
                        sum2 += val;
                        val += d;
                    }
                    cur += c;
                }
            }
            // out.println(sum1 + " " + sum2);

            Boolean flag = true;
            Long a11 = (sum1 - sum2);
            if (a11 % (n * n) == 0) {
                a11 /= (n * n);
                // out.println("a11 is: " + a11);
            } else {
                flag = false;
            }

            if (flag) {
                Long cur = a11;
                for (int i = 0; i < n; i++) {
                    Long val = cur;
                    for (int j = 0; j < n; j++) {
                        if (m1.containsKey(val)) {
                            m1.put(val, m1.get(val) - 1);
                        }
                        // out.println("val is: " + val);
                        val += d;
                    }
                    cur += c;
                }
                Boolean f = true;
                for (Map.Entry<Long, Integer> m : m1.entrySet()) {
                    // out.println(m.getValue());
                    if (m.getValue() != 0) {
                        f = false;
                    }
                }
                // out.println(m1);
                if (f) {
                    out.println("YES");
                } else {
                    out.println("WTFNO");
                }
            } else {
                out.println("NO");
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return parseInt(next());
        }

        public long nextLong() {
            return parseLong(next());
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
3 2 3
3 9 6 5 7 1 11 4 8
3 2 3
3 9 6 5 7 1 10 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
int a[505][505],x[N],y[N];
int main()
{
    int t;cin>>t;
    while(t--)
    {
        int n,c,d;cin>>n>>c>>d;
        for(int i=1;i<=n*n;i++)
            cin>>x[i];
        sort(x+1,x+n*n+1);
        int k=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(i==1&&j==1) a[1][1]=x[1];
                else if(j==1) a[i][j]=a[i-1][j]+c;
                else a[i][j]=a[i][j-1]+d;
                y[++k]=a[i][j];
            }
        }
        sort(y+1,y+k+1);
        int flag=0;
        for(int i=1;i<=k;i++)
        {
            if(x[i]!=y[i])
            {
                flag=1;
                break;
            }
        }
        if(flag) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
2 1000000 1000000
1 2000001 1000001 2000002
```

### Explanation:
1. **Test Case Setup:**
   - **t = 1**: Only one test case.
   - **n = 2**: A 2x2 matrix.
   - **c = 1000000**: The value added to move down a row.
   - **d = 1000000**: The value added to move right a column.

2. **Array Elements:**
   - **b = [1, 2000001, 1000001, 2000002]**: These are the elements in the array.

3. **Expected Progressive Square:**
   - The expected progressive square should be:
     ```
     1 1000001
     1000001 2000001
     ```
   - However, the array provided is:
     ```
     1 2000001 1000001 2000002
     ```
   - Notice that the value 2000002 is not part of the expected square. This should expose the bug in the code.

4. **Why This Test Case is Challenging:**
   - The values in the array are large, which can cause overflow issues if the code is not handling large integers correctly.
   - The array contains an element (2000002) that is not part of the expected progressive square, which should make the code output "NO".

This test case is designed to expose the bug in the code by providing an array that cannot form the expected progressive square.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
const int N=250010;
int arr[N];
int acl[N];
int n,c,d,t;
int minn;
int flag;
int main()
{
	cin>>t;
	while(t--)
	{
		cin>>n>>c>>d;
		flag=1;
		minn=N;
		for(int i=1;i<=n*n;i++) {
			scanf("%d",&arr[i]);
			if(minn>arr[i]) minn=arr[i];
		}

		for(int i=0;i<=n-1;i++){
			for(int j=0;j<=n-1;j++){
				acl[i*n+j]=minn+i*c+j*d;
			}
		}
		/*cout<<minn<<endl;
		for(int i=0;i<=n*n-1;i++) cout<<acl[i]<<" ";
		cout<<endl; */
		sort(arr+1,arr+n*n+1);
		sort(acl,acl+n*n);
		/*for(int i=1;i<=n*n;i++) cout<<arr[i]<<" ";
		cout<<endl;
		for(int i=0;i<=n*n-1;i++) cout<<acl[i]<<" ";
		cout<<endl; */
		for(int i=1,j=0;i<=n*n,j<=n*n-1;i++,j++)
		{
			if(arr[i]!=acl[j]){
				flag=0;
				break;
			}
		}
		if(flag==1) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided code, we need to consider edge cases and scenarios that can cause the code to fail. Here are the steps to think through this:

1. **Edge Cases for `n`, `c`, and `d`:**
   - `n` should be at the boundary of the allowed range (2 and 500).
   - `c` and `d` should be at the boundary of the allowed range (1 and 10^6).

2. **Special Cases for the Array `b`:**
   - The array `b` should contain all the elements that can form a valid progressive square.
   - The array `b` should be in a random order to ensure the code handles sorting correctly.
   - The array `b` should contain duplicate values to test how the code handles duplicates.
   - The array `b` should be missing one or more elements to test the code's ability to detect invalid inputs.

3. **Test Case to Expose the Bug:**
   - The provided code has a bug in the way it constructs the `acl` array and compares it with the sorted `arr` array. Specifically, the code uses `i*n+j` to index the `acl` array, which is incorrect. The correct indexing should be `i*n + j`.

Given these considerations, let's construct a test case that includes a large `n` and values of `c` and `d` that are at the boundary of their allowed ranges. We will also include a duplicate value in the array `b` to test the code's handling of duplicates.

```plaintext
1
500 1 1
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
for _ in range(int(input())) :
    n, c, d = map(int, input().split())
    a = list(map(int, input().split()))
    mn = min(a)
    test = True
    for i in range(mn, mn+d*(n-1)+1, d) :
        if not test :
            break
        elif i in a :
            a.remove(i)
            for j in range(i+c, i+c*(n-1)+1, c) :
                if j in a :
                    a.remove(j)
                else :
                    test = False
                    break
        else :
            test = False
            break
    print("YES" if test else "NO")

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
3 2 3
1 4 7 3 6 9 5 8 11
3 2 3
1 4 7 3 6 9 5 8 12
2 100 100
300 400 500 600
3 2 3
1 4 7 3 6 9 5 8 10
4 4 4
3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63
```

### Explanation:
1. **Test Case 1**:
   - **Input**: `3 2 3` with array `1 4 7 3 6 9 5 8 11`
   - **Output**: `YES`
   - **Reason**: The array can form the progressive square correctly.

2. **Test Case 2**:
   - **Input**: `3 2 3` with array `1 4 7 3 6 9 5 8 12`
   - **Output**: `NO`
   - **Reason**: The array contains `12` which does not fit into the progressive square.

3. **Test Case 3**:
   - **Input**: `2 100 100` with array `300 400 500 600`
   - **Output**: `NO`
   - **Reason**: The array contains `600` which does not fit into the progressive square.

4. **Test Case 4**:
   - **Input**: `3 2 3` with array `1 4 7 3 6 9 5 8 10`
   - **Output**: `NO`
   - **Reason**: The array contains `10` which does not fit into the progressive square.

5. **Test Case 5**:
   - **Input**: `4 4 4` with array `3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63`
   - **Output**: `NO`
   - **Reason**: The array does not form a progressive square with the given `c` and `d` values. The values are not in the correct sequence.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
def initialize_array(n, a, c, d):
    array = [[0] * n for _ in range(n)]  # Create an n x n array filled with zeros
    array[0][0] = a  # Start with 1 at the top-left corner
    for i in range(n):
        for j in range(n):
            if i+1 < n:
                array[i+1][j] = array[i][j] + c
            if j+1 < n:
                array[i][j+1] = array[i][j] + d
    return array

def change_to_arr(arr, n):
    array = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            array[i][j] = arr[i*n + j]
    return array
def check(arr1, arr2, n):
    counts = {}
    for row in arr2:
        for element in row:
            if element in counts:
                counts[element] += 1
            else:
                counts[element] = 1
    for element in arr1:
        if counts.get(element, 0) != arr1.count(element):
            return False
    return True

test = int(input())
for i in range(0,test):
    n,c,d = map(int, input().split(" "))
    arr = [int(x) for x in input().split(" ")]
    arr.sort()
    result_arr = initialize_array(n,arr[0],c,d)
    if(check(arr, result_arr,n)):
        print("YES")
    else:
        print("NO")

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided code, we need to consider edge cases and scenarios where the code might fail. Here are the steps to think through this:

1. **Edge Cases for Input Values**:
   - Minimum and maximum values for `n`, `c`, and `d`.
   - Special values for `c` and `d` that might cause issues in the array construction (e.g., `c = d`).

2. **Edge Cases for Array Construction**:
   - Ensure that the array elements can form a valid progressive square.
   - Check for cases where the array elements might not be unique.

3. **Edge Cases for the `check` Function**:
   - Ensure that the `check` function correctly counts and compares elements.

4. **Small-Scale Test Input**:
   - Use a small value for `t` to keep the input manageable.
   - Use small values for `n` to ensure the input is not too large.

Based on these considerations, let's create a small-scale test input that includes edge cases:

```plaintext
3
2 1 1
1 2 2 3
3 1 1
1 2 3 4 5 6 7 8 9
3 2 2
1 3 5 7 9 11 13 15 17
```

### Explanation:
1. **Test Case 1**:
   - `n = 2`, `c = 1`, `d = 1`
   - Array: `[1, 2, 2, 3]`
   - This is a valid progressive square. The expected output is "YES".

2. **Test Case 2**:
   - `n = 3`, `c = 1`, `d = 1`
   - Array: `[1, 2, 3, 4, 5, 6, 7, 8, 9]`
   - This is a valid progressive square. The expected output is "YES".

3. **Test Case 3**:
   - `n = 3`, `c = 2`, `d = 2`
   - Array: `[1, 3, 5, 7, 9, 11, 13, 15, 17]`
   - This is a valid progressive square. The expected output is "YES".

These test cases cover small values of `n` and `c`, `d` to ensure the input is manageable. They also include cases where the elements form valid progressive squares, which should help in exposing any bugs in the code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import java.util.*;
public class problem{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long t=sc.nextInt();
		for(long i=0;i<t;i++) {
			long n=sc.nextInt();
			long c=sc.nextInt();
			long d=sc.nextInt();
			ArrayList<Long> x=new ArrayList<>();
			for(long j=0;j<n*n;j++) {
				long b=sc.nextInt();
				x.add(b);
			}
			Collections.sort(x);
			long y=x.get(0);
			boolean b=true;
			for(int j=0;j<n;j++) {
				if(!x.contains(y)&&b) {
					System.out.println("No");
					b=false;
					break;
				}else {
					x.remove(Long.valueOf(y));
				}
				long z=y+d;
				for(int k=1;k<n;k++) {
					if(!x.contains(z)&&b) {
						System.out.println("No");
						b=false;
						break;
					}else {
						x.remove(Long.valueOf(z));
						z=z+d;
					}
				}
				if(!b) {
					break;
				}
				y=y+c;
			}
			if(b) {
				System.out.println("Yes");
			}
		}
	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
3 1 1
1 2 3 2 3 4 3 4 5
2 1000000 1000000
1 1000001 1 1000001
4 1 1
1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7
2 1 1
1 2 1 2
3 2 3
3 9 6 5 7 1 11 4 8
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import java.util.*;

public class B {
    static int[][] squares;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int t = Integer.parseInt(sc.nextLine());
        int[] inputs;
        List<Integer> numbers;
        for (int i = 0; i < t; i++) {

            inputs = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            numbers = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt).sorted().toList();
            squares = new int[inputs[0]][inputs[0]];

            generateSquare(0,0,inputs[0],numbers.getFirst(),inputs[1],inputs[2]);

            List<Integer> squareList = new ArrayList<>();
            for (int[] square : squares) {
                for (int j : square) {
                    squareList.add(j);
                }
            }
            squareList = squareList.stream().sorted().toList();
            if(squareList.equals(numbers)){
                System.out.println("YES");
            }else System.out.println("NO");
        }
    }
    public static void generateSquare(int i, int j, int n, int curr,int c, int d){
        if(i == n || j == n){
            return;
        }
        squares[i][j] = curr;
        generateSquare(i+1, j, n, curr+c,c,d);
        generateSquare(i,j+1, n, curr+d,c,d);

    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the provided buggy code, we need to focus on edge cases and scenarios that can cause the code to fail. Here are some potential issues to consider:

1. **Duplicate Values in the Input Array**: The code assumes that all values in the input array are unique. If there are duplicate values, the sorted list of the generated square and the input array will not match, even if the values are correct.

2. **Edge Cases for \( n \), \( c \), and \( d \)**: Values of \( n \), \( c \), and \( d \) that are at the boundaries of the allowed ranges can cause unexpected behavior.

3. **Non-Sequential Values**: The code assumes that the values in the input array are sequential. If the values are not sequential, the code might fail to correctly generate the square.

Given these considerations, let's create a small-scale test input that can expose the bug:

```plaintext
1
3 2 3
1 4 7 3 6 9 5 8 11
```

This input is designed to:
- Use a small \( n \) (3) to keep the input size manageable.
- Use values of \( c \) and \( d \) (2 and 3) that are typical and within the allowed range.
- Include all the values that should be in the progressive square, but in a different order to test the sorting and matching logic.

This input should work correctly if the code is implemented correctly. However, if the code has the bug of not handling duplicate values or non-sequential values correctly, it will fail to match the sorted list of the generated square with the sorted list of the input array.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
//Coder= Al-Amin Bhuiyan
// from DUET
#include<bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

#define  lli     long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char capital_Alphabet[26] = {
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
    'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
    'U', 'V', 'W', 'X', 'Y', 'Z'
};
#define  nl      "\n"
#define  ce      cout<<"\n"
#define  INF    (1<<30)
#define  pb      push_back
#define vi       vector<int>
#define vl       vector<lli>
#define  yes     cout<<"YES"<<"\n"
#define  no      cout<<"NO"<<"\n"
#define S        size()
#define L        length()
#define B        begin()
#define E        end()
#define F        first
#define se       second
#define INF      (1<<30)
#define lcm(a,b) a*b/__gcd(a,b)
#define for_t(i,j,n) for(int i=0,int j=n-1;i<j;i++,j--)
#define g_arr(a,n) sort(arr,arr+n,greater<int>())
#define dsort sort(vec.begin(), vec.end(), greater<int>())
#define PI 3.1415926535897932384626433832795
#define isort sort(vec.B,vec.E)
#define fpre for(int i=1;i<n;i++){pre[i]=pre[i-1]+vec[i];}
#define sp " "
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define fo(x,n) for (int i = x; i < n; ++i)
#define fo_index(i,k,n) for ( int i = k; i <= n; ++i)
#define rev_fo_index(i,k,n) for (int i = k; i >= n; --i)
//--------------ordered set Functionality-----------------
/*
//-------------Ordered set declared with name o_set--------
    ordered_set o_set;

//-------------Finding the second smallest element--------

    cout << *(o_set.find_by_order(1))<< endl;

//------------Finding the number of elements strictly less than k=4--------------

    cout << o_set.order_of_key(4)<< endl;
*/

#ifndef ONLINE_JUDGE
#define debug(x) cerr<< #x <<"=";_print(x);cerr<<nl;
#else
#define debug(x)
#endif
void _print(int a){cerr<<a;}
void _print(lli a){cerr<<a;}
void _print(double a){cerr<<a;}
void _print(char a){cerr<<a;}
void _print(bool a){cerr<<a;}
void _print(string a){cerr<<a;}

template<class T>void _print(vector<T>vec){
    cerr <<"[ ";
    for(T it:vec){
        cerr<<it<<" , ";
    }
    cerr<<" ]";
}
 template<class T>
void _print(stack<T> s) {
    cerr << "[ ";
    while (!s.empty()) {
        cerr << s.top() << " , ";
        s.pop();
    }
    cerr << "]\n";
}
template<class T>void _print(set<T>st){
    cerr <<"[ ";
    for(T it:st){
        cerr<<it<<" , ";
    }
    cerr<<" ]";
}
void _print(const vector<vector<int>>& vec) {
    cerr << "{\n";
    for (const auto& row : vec) { // Iterate through each row
        cerr << "  { ";
        for (const auto& element : row) { // Iterate through each element in the row
            cerr << element << " ";
        }
        cerr << "}\n";
    }
    cerr << "}\n";
}
void _print(const set<vector<int>>& vecSet) {
    cerr << "{\n"; // Start of the set
    for (const auto& vec : vecSet) { // Iterate through each vector in the set
        cerr << "  { ";
        for (const auto& element : vec) { // Iterate through each element in the vector
            cerr << element << " "; // Print each element
        }
        cerr << "}\n"; // End of the vector
    }
    cerr << "}\n"; // End of the set
}
template<class T1, class T2>
void _print(const vector<pair<T1, T2>>& vec) {
    cerr << "{ ";
    for(const auto& pair : vec) {
        cerr << "(" << pair.first << ", " << pair.second << ") ";
    }
    cerr << "}" << endl;
}

template<class T1,class T2>
void _print(const map<T1, T2>& mp) {
    cerr << "{ ";
    for(const auto& pair : mp) {
        cerr <<"( " << pair.first << " : " << pair.second << ") ";;
    }
    cerr << " }" << nl;
}
template<class T>
void _print(const unordered_map<T, T>& mp) {
    cerr << "{ ";
    for(const auto& pair : mp) {
        cerr <<"( " << pair.first << " : " << pair.second << ") ";;
    }
    cerr << " }" << nl;
}
void _print(priority_queue<int> pq) {
    cerr << "{ ";
    // Temporary vector to restore the original state of priority_queue
    vector<int> temp;

    // Pop elements from priority_queue and print them
    while (!pq.empty()) {
        int top = pq.top();
        cerr << top << " ";
        temp.push_back(top);  // Store the element in temp vector
        pq.pop();             // Pop the element from priority_queue
    }

    // Restore the original state of priority_queue
    for (int num : temp) {
        pq.push(num);
    }

    cerr << "}" << endl;
}
void _print(priority_queue<pair<int, int>> pq) {
    cerr << "{ ";

    // Temporary vector to restore the original state of priority_queue
    vector<pair<int, int>> temp;

    // Pop elements from priority_queue and print them
    while (!pq.empty()) {
        auto top = pq.top();
        cerr << "(" << top.first << "," << top.second << ") ";
        temp.push_back(top);  // Store the element in temp vector
        pq.pop();             // Pop the element from priority_queue
    }

    // Restore the original state of priority_queue
    for (auto& elem : temp) {
        pq.push(elem);
    }

    cerr << "}" << endl;
}
template<class T>
void _print(const vector<pair<T, T>>& vec) {
    cerr << "{ ";
    for(const auto& pair : vec) {
        cerr << "(" << pair.first << ", " << pair.second << ") ";
    }
    cerr << "}" << endl;
}
template<class T,class V>void _print(pair<T,V>pa){
    cerr <<"[ ";
    _print(pa.F);
    cerr<<sp;
    _print(pa.se);
    cerr<<" ]";
}
const int N=1e6+10;
lli   M=1e9+7;
int lim=1e7+10;

int arr[N]={0};
int prime[N];
int fact[N];
int inver_fact[N];

// 2D vector with size...............
// vector<vector<int>> vec( row_size , vector<int> (col_size));

lli mini=1e18;
template<typename T, typename U>
static inline void amin(T &x, U &y){if (y < x)x = y;}

lli maxi=-1e18;
template<typename T, typename U>
static inline void amax(T &x, U &y) {if (x < y) x = y; }
lli mod(lli x){
    return ((x%M+M)%M);
}

lli power_Bigmod(lli x, lli y, lli p)
{
    lli res = 1;
    while (y > 0) {
        if (y % 2 == 1)
            res = mod(mod(res) *1ll* mod(x));
        // y = y/2
        y = y >> 1;
        x = mod(mod(x) *1ll* mod(x));
    }
    return res % p;
}

lli add(lli a, lli b){
    return mod(mod(a)+mod(b));
}
lli mul(lli a,lli b){
    return mod(mod(a)*1ll*mod(b));
}
lli sub(lli a, lli b){
    return mod(mod(a)+mod(b)+ M);
}
lli Div(lli a,lli b){
    return mod(mod(a)*mod(power_Bigmod(b,M-2,M)));
}
long double eDis(long double x1,long double y1,long double x2,long double y2){
    return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
void factorial(){
    fact[0]=1;

    for(int i=1;i<N;i++){
    //    debug(fact[i-1])
        fact[i]=(fact[i-1]*1ll*i)%M;
        inver_fact[i]=power_Bigmod(fact[i],M-2,M);

    }
}

lli nCr(lli n,lli r){
    if(n<r) return 0;
    lli res=fact[n];
    res=(res*power_Bigmod(fact[r],M-2,M))%M;
    res=(res*power_Bigmod(fact[n-r],M-2,M))%M;
    return res;
}

lli  amin(lli x,lli y){
    if(x>y) return y;
    else return x;
}
lli amax(lli x,lli y){
    if(x<y)return y;
    else return x;
}

//set bit in position index
int set_bit(int n,int index){
    return (n| (1<<index));

}
//Flip bit in position index
int Flip_bit(int n,int index){
    return (n^ (1<<index));

}

// check is it set bit in position index
int check_bit(int n,int index){
    return (n & (1<<index));
}

bool primality_test(lli n){
      if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for(lli i=5;i*i<=n;i++){
        if (n % i == 0) return false;

        }

    return true;

}

void seive(){
    for(int i=1;i<=N;i++){
        prime[i]=i;
    }
 for(int i=2;i*i<=N;i++){
    if(prime[i]==i){
        for(int j=2*i;j<=N;j+=i){
            prime[j]=i;
        }
    }
   }

}

void seive_for_segment_sieve(vector<long long int>&prime,long long int high){
   bool ck[high + 1];
    memset(ck, true, sizeof(ck));
    ck[1] = false;
    ck[0] = false;
    for (int i = 2; (i * i) <= high; i++) {
        if (ck[i] == true) {
            for (int j = i * i; j <= sqrt(high); j = j + i) {
                ck[j] = false;
            }
        }
    }
    for (int i = 2; i * i <= high; i++) {
        if (ck[i] == true) {
            prime.push_back(i);
        }
    }
//  debug(prime)
}
// Segment sieve

void segment_sieve(long long low,long long int high){
    if (low<2 and high>=2){
        low = 2;
    }
    bool prime[high - low + 1];

    memset(prime, true, sizeof(prime));

    vector<long long int> chprime;
    seive_for_segment_sieve(chprime, high);

    for (int i : chprime) {
        int lower = (low / i);

        if (lower <= 1) {
            lower = i + i;
        }
        else if (low % i) {
            lower = (lower * i) + i;
        }
        else {
            lower = (lower * i);
        }
        for (int j = lower; j <= high; j = j + i) {
            prime[j - low] = false;
        }
    }

    for (int i = low; i <= high; i++) {
        if (prime[i - low] == true) {
            cout << (i) << " ";
        }
    }
}
//count number of coprime

void phi_1_to_n(int n) {
    vector<pair<int,int>> phi(n + 1);
    for (int i = 0; i <= n; i++)
       { phi[i].first = i;
    phi[i].se=i;}

    for (int i = 2; i <= n; i++) {
        if (phi[i].first == i) {
            for (int j = i; j <= n; j += i)
               {

                 phi[j].first -= phi[j].first / i;

               }
        }
    }
    for(auto it:phi){cout<<it.F<<sp<<it.se<<nl;}
}
lli binary(lli n){
    lli low=0,high=1e9;
    while (low < high) {
            lli mid = (low + high+1)>>1;
            if (mid*(mid+1)/2<= n) {
                low = mid;
            } else {
                high = mid -1;
            }
        }
    return low;
}
//Harmonic Series
//Calculate Total number of divisor
vector<int>total_divisor(lim,1);
void divisor_count(){
    for(int i=2;i<lim;i++){
        for(int j=i;j<lim;j+=i){
            total_divisor[j]++;
        }
    }

}

 map<int,int>mp;
void prime_factor(lli n){
         for(lli j=2;j*j<=n;j++){
        if(n%j==0){
            lli cnt=0;
            while(n%j==0){
                cnt++;
                n/=j;
            }
           mp[j]=cnt;

        }
    }
     if(n>1){
           mp[n]=1;
        }
      }

double eDis(double x1,double y1,double x2,double y2){
    return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

lli power(lli base, lli exponent) {
    lli result = 1;
    //base = base % modulus;
    while (exponent > 0) {
        if (exponent % 2 == 1) {
            result = (result * base) ;
        }
        exponent = exponent >> 1;
        base = (base * base);
    }
    return result;
}

string bin(lli x)
{
    // Convert to binary using 64 bits for large numbers
    string binary = bitset<64>(x).to_string();

    // Find the position of the first '1'
    size_t firstOnePos = binary.find('1');

    // If there is no '1', the number is zero
    if (firstOnePos != string::npos) {
        // Return the substring from the first '1' to the end
        return binary.substr(firstOnePos);
    }

    // Return "0" for the case where the number is zero
    return "0";
}

inline void MODE() {

#ifndef ONLINE_JUDGE

freopen("inputf.txt", "r", stdin);

freopen("outputf.txt", "w", stdout);

freopen("expected output_txt.txt","w",stderr);

#endif // ONLINE_JUDGE
}
struct Comparator {
    bool operator()(const pair<int, int>& a, const pair<int, int>& b) const {
        if (a.first == b.first) {
            return a.second < b.second; // Compare second values if first values are equal
        }
        return a.first < b.first; // Compare first values
    }
};

lli gcd(lli a, lli b) {
    if(a<b){
        swap(a,b);
    }

    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int ceil(int a,int b)
{
    return (a+b-1)/b;
}

bool compareFirst(const vector<int>& a, const vector<int>& b) {
    return a[0] < b[0];
}

int path(int x,int y,int m,int n,int (&dp)[105][105]){
    if(x==m-1 and y==n-1)return 1;

    int ans1=0,ans2=0;

    if(dp[x][y]!=-1)return dp[x][y];

    if(x<m-1)
    ans1=  path(x+1,y,m,n,dp);

    if(y<n-1)
     ans2=  path(x,y+1,m,n,dp);
 //  cout<<dp[x][y+1]+dp[x+1][y]<<nl;

  return  dp[x][y]=ans1+ans2;

}
//find a string first occarance  and find a string last occarance in a stiring
/*
 size_t first_digit=str.find_first_of(s);
   size_t last_digit=str.find_last_of(s);
   */

bool check(lli mid,vector<lli>&vec, lli n){

    lli temp=0;

    for(int i=0;i<n;i+=2){
        if(vec[i]+mid<vec[i+1] or i==n-1){
            if(temp){
                return false;

            }
            temp++;
            i--;
        }
    }
    return true;
}
int binarySearch( vector<lli>vec, int  target) {
    int left = 0;
    int right = vec.size() - 1;

    int result = -1;  // To store the index of the target if found

    while (left <= right) {
        int mid = left + (right - left) / 2;

        if (vec[mid] == target) {
           return mid;
       }
         else if (vec[mid] < target) {
            left = mid + 1;
        } else {
            right = mid - 1;
        }
    }

    return -1;
}

int findRoots(double a, double b, double c) {

    double discriminant = b * b - 4 * a * c;

    if (discriminant > 0) {
        // Two distinct real roots
        double root1 = (-b + sqrt(discriminant)) / (2 * a);
        double root2 = (-b - sqrt(discriminant)) / (2 * a);
     return max(root1,root2);
    } else if (discriminant == 0) {
        // One real root (repeated)
        double root = -b / (2 * a);
      return root;
    } else {
        // Complex roots
        double realPart = -b / (2 * a);
        double imagPart = sqrt(-discriminant) / (2 * a);
     return realPart;
    }
    return 0;
}
long long binToDec(const string& binary) {
    return stoll(binary, nullptr, 2);  // Convert from base 2 (binary) to decimal
}

 lli n,a,b,c,d,e,f,g;
 bool flag=false;
int calculateSum(const vector<int>& seq) {
    int sum = 0;
    for (int num : seq) {
        sum += num;
    }
    return sum;
}

vector<int> differenceSequence(const vector<int>& seq) {
    vector<int> diff;
    for (int i = 1; i < seq.size(); i++) {
        diff.push_back(seq[i] - seq[i - 1]);
    }
    return diff;
}
void solve() {

   int n;
   cin>>n;
   lli c,d;
   cin>>c>>d;

   vl vec(n*n);

   fo(0,n*n)cin>>vec[i];

   sort(vec.B,vec.E);
   int x=vec[0];

   for(int i=0;i<n;i++){
    int t=x;

    for(int j=0;j<n;j++){
        debug(t)
        int v=binarySearch(vec,t);
        if(v!=-1){
            vec[v]=-1;
            sort(vec.B,vec.E);
        }
        else{
            no;return;
        }
        t+=c;

    }
    x+=d;

   }
   yes;

}

int32_t main(){

    fast;
    MODE();
//  seive();
    //factorial();

    int test;
    cin>>test;

    for(int i=1;i<=test;i++){
        solve();
    }

}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided code, we need to focus on edge cases and scenarios that are likely to cause issues. Here are some considerations:

1. **Duplicate Elements**: The code sorts the array and uses binary search to find elements, but it does not handle duplicates correctly. If there are duplicate elements, the binary search might return an incorrect index, leading to incorrect removal and potentially missing elements.

2. **Negative Values**: The problem statement specifies that the elements are in the range [1, 10^9]. However, if the code does not handle negative values correctly, it could be a source of bugs.

3. **Large Values**: Using large values for `c` and `d` can cause overflow issues if the code does not handle large numbers correctly.

4. **Small Matrix**: A small matrix (e.g., 2x2) with a specific pattern can help identify issues in the logic.

5. **Random Order**: The elements are given in random order, so we need to ensure that the test case includes elements in a non-sequential order.

Given these considerations, let's create a test case that includes duplicate elements and a small matrix:

```plaintext
1
2 2 2
1 3 5 3
```

### Explanation:
- **Test Case**: 1
- **Matrix Size**: 2
- **c**: 2
- **d**: 2
- **Elements**: 1, 3, 5, 3

### Expected Output:
- **Output**: NO

### Reasoning:
- The elements 1, 3, 5, 3 should form a progressive square with the given `c` and `d` values. However, the presence of duplicate elements (3) will cause issues in the binary search and removal process, leading to an incorrect result.

This test case is designed to expose the bug in the code's handling of duplicate elements.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
t=int(input())
for x in range(t):
    n,c,d = input().split(' ')
    n = int(n)
    c = int(c)
    d = int(d)
    inp = list(map(int, input().split(' ')))
    done=0
    lol=[0]*n*n
    lol[0]=min(inp)
    for i in range(0,n):
        if(i!=0):
            lol[i*n]=lol[(i-1)*n]+c
        for j in range(1,n):
            lol[i*n+j]=lol[i*n+j-1]+d
    for o in lol:
        if o not in inp or lol.count(o) != inp.count(o):
            print("NO")
            done = 1
            break
    if(done==0):
        print("YES")

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
for _ in range(int(input())):
    n, c, d = map(int, input().split())
    l = list(map(int, input().split()))
    ln = []
    for i in range(n):
        for j in range(n):
            ln.append(min(l) + c*i + d*j)
    l.sort()
    ln.sort()
    if l == ln:
        print('YES')
    else:
        print('NO')

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a test input that exposes the bug in the provided buggy code, we need to focus on edge cases where the algorithm might fail. The primary issue in the buggy code is that it always starts from the minimum value in the list and constructs the progressive square from there, which is not always correct. The correct approach should be to find the initial value \( a_{1,1} \) and then construct the progressive square based on that.

### Step-by-Step Reasoning:

1. **Identify the Bug**: The code always starts from the minimum value in the list \( l \) and constructs the progressive square. This is incorrect because the minimum value in the list might not be the initial value \( a_{1,1} \).

2. **Edge Case**: A good edge case to expose this bug is a scenario where the minimum value in the list is not the initial value \( a_{1,1} \). This can happen if the values in the list are such that the minimum value is not at the top-left corner of the progressive square.

3. **Construct the Test Case**:
   - Choose \( n \), \( c \), and \( d \) such that the progressive square is not trivial.
   - Generate a progressive square with a specific \( a_{1,1} \).
   - Modify the list by swapping the minimum value with another value to ensure it is not at the top-left corner.

### Example Test Case:

- **Input**:
  - \( n = 3 \)
  - \( c = 2 \)
  - \( d = 3 \)
  - Progressive square:
    \[
    \begin{pmatrix}
    1 & 4 & 7 \\
    3 & 6 & 9 \\
    5 & 8 & 11
    \end{pmatrix}
    \]
  - List \( b \) with the minimum value \( 1 \) swapped with \( 5 \):
    \[
    b = [5, 9, 6, 3, 7, 1, 11, 4, 8]
    \]

### Test Input:

```plaintext
1
3 2 3
5 9 6 3 7 1 11 4 8
```

This test input should expose the bug in the buggy code because the minimum value \( 1 \) is not at the top-left corner of the progressive square, and the code will incorrectly construct the square starting from \( 1 \). The correct answer should be "NO" because the list \( b \) cannot form the progressive square with the given \( n \), \( c \), and \( d \).


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import java.util.*;

import javax.print.DocFlavor.READER;

public class Main
{

   static void test(int n,int c,int d,long arr[])
   {
     int len=(int)Math.sqrt((int)arr.length);
       Arrays.sort(arr);
       long temp=arr[0];

       long dp[][]=new long[len][len];
       for (int i = 0; i<len; i++)
       {
          dp[i][0]=temp;
           for (int j = 1; j <len; j++)
           {
              dp[i][j]=dp[i][j-1]+d;
           }
           temp=temp+c;
       }

       for (int i = 0; i<len; i++)
       {

           for (int j = 0; j <len; j++)
           {
               boolean flag=false;

                for (int k = 0; k < arr.length; k++)
                {
                   if(arr[k]==dp[i][j])
                   {
                      arr[k]=-1;
                      flag=true;
                      break;

                   }
                }
                if (!flag)
                {
                  System.out.println("NO");
                  return;
                }

           }

       }
       System.out.println("YES");

   }

    public static void main(String[] args)
    {

        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();

        while (n-->0)
        {
           int x=sc.nextInt();
           int a=sc.nextInt();
           int b=sc.nextInt();
           long arr[]=new long[x*x];
           for (int i = 0; i < arr.length; i++)
           {
             arr[i]=sc.nextLong();
           }
           test(x, a, b,arr);

        }

}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the given code, we need to focus on edge cases or scenarios that can cause the faulty solution to fail. Here are the key points to consider:

1. **Duplicate Values**: The code assumes that each value in the array is unique. If there are duplicate values, the code might incorrectly match values.
2. **Large Values**: The code might have issues with large values that could cause overflow or other unexpected behavior.
3. **Small and Large Matrices**: Test both small and large matrices to ensure the code handles all sizes correctly.
4. **Zero Values**: Test cases with values that could be zero to see how the code handles them.

Given these considerations, let's create a test input that includes these scenarios:

```plaintext
4
3 2 3
1 4 7 3 6 9 5 8 11
3 2 3
1 4 7 3 6 9 5 8 8
2 100 100
100 200 300 400
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
```

Explanation:
1. The first test case is a valid progressive square, so it should output "YES".
2. The second test case has a duplicate value (8), which should cause the code to output "NO".
3. The third test case has large values that should still form a valid progressive square, so it should output "YES".
4. The fourth test case has multiple duplicate values and should output "NO".

This test input is small-scale but complete and valid, and it should expose the bug in the given code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Progressive Square
time_limit_ms: 2000
memory_limit_mb: 256
Description: A progressive square of size $$$n$$$ is an $$$n \times n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules:

$$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$

$$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$

For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$, $$$c=2$$$, and $$$d=3$$$, then the progressive square looks as follows:

$$$$$$ \begin{pmatrix} 1 & 4 & 7 \\ 3 & 6 & 9 \\ 5 & 8 & 11 \end{pmatrix} $$$$$$

Last month Maxim constructed a progressive square and remembered the values of $$$n$$$, $$$c$$$, and $$$d$$$. Recently, he found an array $$$b$$$ of $$$n^2$$$ integers in random order and wants to make sure that these elements are the elements of that specific square.

It can be shown that for any values of $$$n$$$, $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$, there exists exactly one progressive square that satisfies all the rules.

Input: The first line contains an integer $$$t$$$ ($$$1 \le t \le {10} ^ 4$$$) — the number of test cases.

The first line of each test case contains three integers $$$n$$$, $$$c$$$, and $$$d$$$ ($$$2 \le n \le 500$$$, $$$1 \le c, d \le 10^6$$$) — the size of the square and the values of $$$c$$$ and $$$d$$$ as described in the statement.

The second line of each test case contains $$$n \cdot n$$$ integers $$$b_1, b_2, \dots, b_{n \cdot n}$$$ ($$$1 \le b_i \le 10^9$$$) — the elements found by Maxim.

It is guaranteed that the sum of $$$n ^ 2$$$ over all test cases does not exceed $$$25 \cdot {10} ^ 4$$$.

Output: For each test case, output "YES" in a separate line if a progressive square for the given $$$n$$$, $$$c$$$, and $$$d$$$ can be constructed from the array elements $$$a$$$, otherwise output "NO".

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

Examples:
input:
5
3 2 3
3 9 6 5 7 1 10 4 8
3 2 3
3 9 6 5 7 1 11 4 8
2 100 100
400 300 400 500
3 2 3
3 9 6 6 5 1 11 4 8
4 4 4
15 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
output:
NO
YES
YES
NO
NO

Note:

Buggy Code:
import java.util.*;
public class progressiveSquare{
    public static boolean check(int[] arr , int x ){
        for(int i=0;i<arr.length;i++){
            if(arr[i]==x){
                arr[i]=-arr[i];
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        while(t-->0){
            int n = input.nextInt();
            int c = input.nextInt();
            int d = input.nextInt();
            ArrayList<Integer> found = new ArrayList<>();

            int arr[] = new int[n*n];
            int row[] = new int[n];
            int col[] = new int[n];
            int a=Integer.MAX_VALUE;
            for(int i=0;i<n*n;i++){
                arr[i]=input.nextInt();
                a = Math.min(a, arr[i]);
            }
            int flag=1;
            for(int i = 0 ; i<n ; i++){
                col[i] = a + c*i;
                // System.out.println(col[i]+ " col");
                if(!check(arr,col[i])){
                    flag=0;
                    break;
                }
                else{
                    found.add(col[i]);
                }
            }
            int x;
            for(int i =0; i<n;i++){
                 for(int j = 0 ; j<n-1; j++){
                    x = col[i] + d*(j+1);
                    // System.out.println(x+ " x");
                    if(!check(arr,x)){
                        flag=0;
                        break;
                    }
                    else{
                        found.add(x);
                    }
                 }
            }
            // System.out.println(found);
            if(flag==1 && found.size() == n*n){
                System.out.println("yes");
            }
            else{
                System.out.println("No");
            }
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 2 3
1 4 7 3 6 9 5 8 11
```