#include <bits/stdc++.h>
using namespace std;
int recur_depth = 0;
const long long sz = 50, mod = 998244353;
long long pos[sz], k, h, A, n, lev[sz], ok, pw[sz], half;
unordered_map<long long, unordered_map<long long, vector<int>>> rest;
vector<long long> other;
long long iter;
void solve1(long long x, long long msk, long long hsh) {
  if (ok) return;
  if (x == 1) {
    long long frst;
    for (long long i = 0; i < half; ++i) {
      if (msk >> i & 1) frst = i;
    }
    vector<int> v;
    for (long long i = 0; i < half; ++i) v.push_back(pos[i]);
    rest[frst][hsh] = v;
    return;
  }
  vector<pair<int, int>> lst;
  long long x1 = -1;
  for (long long i = 0; i < half; ++i) {
    if ((msk >> i) & 1) {
      if (x1 == -1)
        x1 = i;
      else {
        lst.push_back(make_pair(x1, i));
        x1 = -1;
      }
    }
  }
  long long lim = 1 << lst.size();
  int pos2[half];
  for (long long i = 0; i < lim; ++i) {
    long long nmsk = msk, cur = hsh;
    for (long long j = 0; j < half; ++j) pos2[j] = pos[j];
    for (long long j = 0; j < lst.size(); ++j) {
      auto& [a, b] = lst[j];
      if ((i >> j) & 1) {
        nmsk ^= (1 << a);
        pos[a] = lev[x], cur = (cur + (a + 1) * pw[pos[a]]) % mod;
      } else {
        nmsk ^= (1 << b);
        pos[b] = lev[x], cur = (cur + (b + 1) * pw[pos[b]]) % mod;
        ;
      }
    }
    solve1(x - 1, nmsk, cur);
    for (long long j = 0; j < half; ++j) pos[j] = pos2[j];
  }
}
inline long long make_Hash(long long hsh, long long p1, long long p2) {
  hsh = (hsh + p1 * pw[1]) % mod;
  hsh = (hsh + p2 * pw[2]) % mod;
  return hsh;
}
inline bool doExist(long long hsh, long long ph) {
  auto it = rest[ph].find(hsh);
  return it != rest[ph].end();
}
void solve2(long long x, long long msk, long long hsh) {
  if (ok) return;
  if (x == 1) {
    long long frst;
    for (int i = half; i < n; i++) {
      if ((msk >> i) & 1) frst = i;
    }
    for (long long i = 0; i < half; ++i) {
      long long cur = make_Hash(hsh, frst + 1, i + 1), need = (h - cur);
      if (need < 0) need += mod;
      if (!doExist(need, i)) continue;
      auto it = rest[i].find(need);
      for (long long j = 0; j < half; ++j) pos[j] = it->second[j];
      pos[i] = 2, pos[frst] = 1, ok = 1;
      return;
    }
    for (long long i = 0; i < half; ++i) {
      long long cur = make_Hash(hsh, i + 1, frst + 1), need = (h - cur);
      if (need < 0) need += mod;
      if (!doExist(need, i)) continue;
      auto it = rest[i].find(need);
      for (long long j = 0; j < half; ++j) pos[j] = it->second[j];
      pos[i] = 1, pos[frst] = 2, ok = 1;
      return;
    }
    return;
  }
  vector<pair<int, int>> lst;
  long long x1 = -1;
  for (int i = half; i < n; i++) {
    if ((msk >> i) & 1) {
      if (x1 == -1)
        x1 = i;
      else {
        lst.push_back(make_pair(x1, i));
        x1 = -1;
      }
    }
  }
  long long lim = 1 << lst.size();
  int pos2[n];
  for (long long i = 0; i < lim; ++i) {
    long long nmsk = msk, cur = hsh;
    for (int j = half; j < n; j++) pos2[j] = pos[j];
    for (long long j = 0; j < lst.size(); ++j) {
      auto& [a, b] = lst[j];
      if ((i >> j) & 1) {
        nmsk ^= (1 << a);
        pos[a] = lev[x], cur = (cur + (a + 1) * pw[pos[a]]) % mod;
      } else {
        nmsk ^= (1 << b);
        pos[b] = lev[x], cur = (cur + (b + 1) * pw[pos[b]]) % mod;
        ;
      }
    }
    solve2(x - 1, nmsk, cur);
    if (ok) return;
    for (int j = half; j < n; j++) pos[j] = pos2[j];
  }
}
int main() {
  cin >> k >> A >> h;
  pw[0] = 1;
  for (long long i = 1; i <= sz - 1; ++i) pw[i] = (pw[i - 1] * A) % mod;
  lev[0] = 1, lev[1] = 2;
  for (long long i = 2; i <= k; i++) lev[i] = (1LL << (i - 1)) + 1;
  n = 1LL << k, half = n / 2;
  solve1(k, (1LL << half) - 1, 0);
  solve2(k, ((1LL << n) - 1) ^ ((1LL << half) - 1), 0);
  if (ok) {
    for (long long i = 0; i < n; ++i) printf("%lld ", pos[i]);
    printf("\n");
  } else
    printf("-1\n");
  return 0;
}

### Prompt

Create a solution in CPP for the following problem:

2^k teams participate in a playoff tournament. The tournament consists of 2^k - 1 games. They are held as follows: first of all, the teams are split into pairs: team 1 plays against team 2, team 3 plays against team 4 (exactly in this order), and so on (so, 2^{k-1} games are played in that phase). When a team loses a game, it is eliminated, and each game results in elimination of one team (there are no ties). After that, only 2^{k-1} teams remain. If only one team remains, it is declared the champion; otherwise, 2^{k-2} games are played: in the first one of them, the winner of the game "1 vs 2" plays against the winner of the game "3 vs 4", then the winner of the game "5 vs 6" plays against the winner of the game "7 vs 8", and so on. This process repeats until only one team remains.

After the tournament ends, the teams are assigned places according to the tournament phase when they were eliminated. In particular:

  * the winner of the tournament gets place 1; 
  * the team eliminated in the finals gets place 2; 
  * both teams eliminated in the semifinals get place 3; 
  * all teams eliminated in the quarterfinals get place 5; 
  * all teams eliminated in the 1/8 finals get place 9, and so on. 



For example, this picture describes one of the possible ways the tournament can go with k = 3, and the resulting places of the teams:

<image>

After a tournament which was conducted by the aforementioned rules ended, its results were encoded in the following way. Let p_i be the place of the i-th team in the tournament. The hash value of the tournament h is calculated as h = (∑ _{i=1}^{2^k} i ⋅ A^{p_i}) mod 998244353, where A is some given integer.

Unfortunately, due to a system crash, almost all tournament-related data was lost. The only pieces of data that remain are the values of k, A and h. You are asked to restore the resulting placing of the teams in the tournament, if it is possible at all.

Input

The only line contains three integers k, A and h (1 ≤ k ≤ 5; 100 ≤ A ≤ 10^8; 0 ≤ h ≤ 998244352).

Output

If it is impossible to find any placing of the teams that is consistent with the data you have, print one integer -1.

Otherwise, print 2^k integers, where i-th integer should be equal to p_i (the place of the i-th team). Note that your answer should be consistent with one of the possible ways the tournament could go, and note that the initial structure of the tournament is fixed (for example, teams 1 and 2 always play in the first phase of the tournament against each other). If there are multiple ways to restore the places of the teams which are consistent with the data you have, print any of them.

Examples

Input


3 1337 75275197


Output


5 3 5 2 1 5 5 3 


Input


2 100 5040100


Output


1 3 3 2 


Input


2 100 7020100


Output


-1

Note

The tournament for the first example is described in the statement.

For the third example, the placing [1, 2, 3, 3] (team 1 gets place 1, team 2 gets place 2, teams 3 and 4 get place 3) could result in a hash value of 7020100 with A = 100, but no tournament can result in such placing since teams 1 and 2 play against each other in the semifinals, so they cannot get two first places.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int recur_depth = 0;
const long long sz = 50, mod = 998244353;
long long pos[sz], k, h, A, n, lev[sz], ok, pw[sz], half;
unordered_map<long long, unordered_map<long long, vector<int>>> rest;
vector<long long> other;
long long iter;
void solve1(long long x, long long msk, long long hsh) {
  if (ok) return;
  if (x == 1) {
    long long frst;
    for (long long i = 0; i < half; ++i) {
      if (msk >> i & 1) frst = i;
    }
    vector<int> v;
    for (long long i = 0; i < half; ++i) v.push_back(pos[i]);
    rest[frst][hsh] = v;
    return;
  }
  vector<pair<int, int>> lst;
  long long x1 = -1;
  for (long long i = 0; i < half; ++i) {
    if ((msk >> i) & 1) {
      if (x1 == -1)
        x1 = i;
      else {
        lst.push_back(make_pair(x1, i));
        x1 = -1;
      }
    }
  }
  long long lim = 1 << lst.size();
  int pos2[half];
  for (long long i = 0; i < lim; ++i) {
    long long nmsk = msk, cur = hsh;
    for (long long j = 0; j < half; ++j) pos2[j] = pos[j];
    for (long long j = 0; j < lst.size(); ++j) {
      auto& [a, b] = lst[j];
      if ((i >> j) & 1) {
        nmsk ^= (1 << a);
        pos[a] = lev[x], cur = (cur + (a + 1) * pw[pos[a]]) % mod;
      } else {
        nmsk ^= (1 << b);
        pos[b] = lev[x], cur = (cur + (b + 1) * pw[pos[b]]) % mod;
        ;
      }
    }
    solve1(x - 1, nmsk, cur);
    for (long long j = 0; j < half; ++j) pos[j] = pos2[j];
  }
}
inline long long make_Hash(long long hsh, long long p1, long long p2) {
  hsh = (hsh + p1 * pw[1]) % mod;
  hsh = (hsh + p2 * pw[2]) % mod;
  return hsh;
}
inline bool doExist(long long hsh, long long ph) {
  auto it = rest[ph].find(hsh);
  return it != rest[ph].end();
}
void solve2(long long x, long long msk, long long hsh) {
  if (ok) return;
  if (x == 1) {
    long long frst;
    for (int i = half; i < n; i++) {
      if ((msk >> i) & 1) frst = i;
    }
    for (long long i = 0; i < half; ++i) {
      long long cur = make_Hash(hsh, frst + 1, i + 1), need = (h - cur);
      if (need < 0) need += mod;
      if (!doExist(need, i)) continue;
      auto it = rest[i].find(need);
      for (long long j = 0; j < half; ++j) pos[j] = it->second[j];
      pos[i] = 2, pos[frst] = 1, ok = 1;
      return;
    }
    for (long long i = 0; i < half; ++i) {
      long long cur = make_Hash(hsh, i + 1, frst + 1), need = (h - cur);
      if (need < 0) need += mod;
      if (!doExist(need, i)) continue;
      auto it = rest[i].find(need);
      for (long long j = 0; j < half; ++j) pos[j] = it->second[j];
      pos[i] = 1, pos[frst] = 2, ok = 1;
      return;
    }
    return;
  }
  vector<pair<int, int>> lst;
  long long x1 = -1;
  for (int i = half; i < n; i++) {
    if ((msk >> i) & 1) {
      if (x1 == -1)
        x1 = i;
      else {
        lst.push_back(make_pair(x1, i));
        x1 = -1;
      }
    }
  }
  long long lim = 1 << lst.size();
  int pos2[n];
  for (long long i = 0; i < lim; ++i) {
    long long nmsk = msk, cur = hsh;
    for (int j = half; j < n; j++) pos2[j] = pos[j];
    for (long long j = 0; j < lst.size(); ++j) {
      auto& [a, b] = lst[j];
      if ((i >> j) & 1) {
        nmsk ^= (1 << a);
        pos[a] = lev[x], cur = (cur + (a + 1) * pw[pos[a]]) % mod;
      } else {
        nmsk ^= (1 << b);
        pos[b] = lev[x], cur = (cur + (b + 1) * pw[pos[b]]) % mod;
        ;
      }
    }
    solve2(x - 1, nmsk, cur);
    if (ok) return;
    for (int j = half; j < n; j++) pos[j] = pos2[j];
  }
}
int main() {
  cin >> k >> A >> h;
  pw[0] = 1;
  for (long long i = 1; i <= sz - 1; ++i) pw[i] = (pw[i - 1] * A) % mod;
  lev[0] = 1, lev[1] = 2;
  for (long long i = 2; i <= k; i++) lev[i] = (1LL << (i - 1)) + 1;
  n = 1LL << k, half = n / 2;
  solve1(k, (1LL << half) - 1, 0);
  solve2(k, ((1LL << n) - 1) ^ ((1LL << half) - 1), 0);
  if (ok) {
    for (long long i = 0; i < n; ++i) printf("%lld ", pos[i]);
    printf("\n");
  } else
    printf("-1\n");
  return 0;
}

```