Permutations#465

Permutations

2 seconds
64 megabytes
Medium

Given a set of distinct positive integers. A permutation of the elements of this set is called a -permutation if, for any two adjacent elements in the permutation, their greatest common divisor is at least . For example, if the given set S = \{6,\ 3,\ 9,\ 8\}, the permutation \{8, 6, 3, 9\} is a -permutation, but \{6, 8, 3, 9\} is not.

The permutation \{p_1, p_2, \dots, p_n\} is lexicographically smaller than the permutation \{q_1, q_2, \dots, q_n\} if there exists an integer (1 \leq i \leq n) such that p_j = q_j for all j < i, and p_i < q_i.

For example, let us list all -permutations of the set above in lexicographical order. There are exactly four -permutations of set : \{3, 9, 6, 8\}, \{8, 6, 3, 9\}, \{8, 6, 9, 3\}, and \{9, 3, 6, 8\}. Thus, the first -permutation in lexicographical order is \{3, 9, 6, 8\}, and the fourth is \{9, 3, 6, 8\}.

Write a program that finds the -th -permutation in this order.

Input

The first line contains three natural numbers (1 \leq n \leq 16), , and (1 \leq m, k \leq 10^9). The second line contains distinct positive integers not exceeding 10^9.

Output

Print the -th -permutation of the given set, or if there is no such permutation.

Examples

Example 1

Loading
Loading