Under construction

Still being built. Things may change

Genome

Time limit1sMemory limit128 MB

Summary
Build the lexicographically smallest sequence that is l adjacent swaps from the first genome and k-l swaps from the second.
Level

Hard9 of 10

Topics
Greedy, Segment tree, Sorting
Solved
No attempts yet

Problem

The genetic information of Byteotian organisms, unlike that of Earth organisms, is encoded not by four but by 10910^9 different chemical compounds called byteacids. A single joined chain of byteacids is called a BNA.

A BNA is especially prone to inversion mutations: one such mutation swaps two adjacent byteacids. Using a theoretical model, the great biotechnologist Byteazar discovered that inversion mutations alone can turn a Byteotian cucumber into a tomato, and that exactly kk inversions of the cucumber's BNA are both necessary and sufficient to do so.

The scientists fix a natural number ll with 0≤l≤k0 \le l \le k and want to build an organism that is a tomato in an l/kl/k fraction and a cucumber in the rest. More precisely, they want to apply exactly ll inversion mutations to the cucumber so that the resulting organism could still be turned into the tomato by exactly k−lk - l further inversions.

For dietary reasons, the smaller the resulting BNA is in lexicographic order, the better. So among all BNAs that meet the requirement above, the scientists want the one whose first byteacid has the smallest possible number; in case of a tie, whose second byteacid has the smallest possible number, and so on.

Input

The first line contains three integers nn, kk, and ll (1≤n≤300 0001 \le n \le 300\,000, 1≤k≤10121 \le k \le 10^{12}, 0≤l≤k0 \le l \le k): the length of the cucumber's BNA (equal to the tomato's), the number of inversions needed to turn the cucumber into the tomato, and the fraction to which the resulting organism should be a tomato.

The next two lines each contain nn integers in the range [1,109][1, 10^9]: the numbers of the successive byteacids of the cucumber's genome and of the tomato's genome, respectively.

You may assume that a sequence of kk inversions transforming the first BNA into the second exists, and that it is a shortest such sequence.

Output

Output one line with nn integers: the numbers of the successive byteacids of the BNA of the desired organism.

Examples2

  1. Example 1

    Input
    6 3 2
    2 1 3 6 4 5
    3 2 1 6 5 4
    
    Expected output
    2 3 1 6 5 4
    
  2. Example 2

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