Under construction

Still being built. Things may change

Omar's Bug

Interview

Time limit1sMemory limit128 MB

Summary
For each query with N, X and a flag, build the lexicographically smallest sorted array that makes the buggy lower bound return a right or wrong answer.
Level

Medium5 of 10

Topics
Binary search, Greedy
Solved
No attempts yet

Problem

Omar is the youngest programmer in the world. He is only 11 months old. He read an explanation of binary search and decided to write it himself.

Here is the function he wrote. The syntax is valid and it behaves the same way in C++ and in Java.

int findFirstGreaterThanOrEqual(int array[], int N, int X) {
    int start = 0, end = N;
    while (start < end) {
        int middle = (start + end) / 2;
        if (array[middle] > X) {
            end = middle;
        } else {
            start = middle + 1;
        }
    }
    return start;
}

The function is always called with arguments that satisfy all of these conditions.

  1. The first argument is an array holding at least 1 and at most 99 integers.
  2. The integers in the array are distinct and sorted in increasing order.
  3. Every integer in the array is positive and at most 100.
  4. NN is the number of elements in the array.
  5. XX is a positive integer that is at most 100.

This is how Omar wants the function to behave. If the array holds no integer greater than or equal to XX, the function returns NN. Otherwise it returns the index of the smallest integer in the array that is greater than or equal to XX. The first element has index 0.

The function has a bug, so it returns a wrong value for some inputs, and Omar is too young to find it. Help him by building arrays that test his function.

Input

The first line holds one integer TT, the number of test cases (1≤T≤1001 \le T \le 100).

Each of the next TT lines describes one test case with three integers separated by a single space, NN XX YY (1≤N≤991 \le N \le 99, 1≤X≤1001 \le X \le 100, 1≤Y≤21 \le Y \le 2). NN is the value of the second argument and XX is the value of the third argument. If YY is 1, build an array that makes the function return the correct value for those arguments. If YY is 2, build an array that makes the function return a wrong value. In both cases the array must satisfy the conditions above.

Correct and wrong are judged against the behaviour Omar wants, not against what the code actually does.

Output

For each test case print one line with the NN integers of your array, in the order they appear in the array, separated by a single space. If more than one array satisfies the conditions, print the lexicographically smallest one.

When two arrays of the same length are compared, the lexicographically smaller one is the array holding the smaller value at the first index where they differ.

Examples1

  1. Example 1

    Input
    2
    3 3 1
    4 7 2
    
    Expected output
    1 2 4
    1 2 3 7