#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
struct matrix {
  int sz;
  long long a[105][105];
  matrix &operator=(const matrix &T) {
    sz = T.sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        a[i][j] = T.a[i][j];
      }
    }
    return *this;
  }
  matrix operator+(const matrix &T) const {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        ans.a[i][j] = a[i][j] + T.a[i][j];
        ans.a[i][j] %= (int)(1e9 + 7);
      }
    }
    return ans;
  }
  matrix operator*(const matrix &T) const {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        ans.a[i][j] = 0;
        for (int k = 1; k <= sz; k++) {
          ans.a[i][j] += a[i][k] * T.a[k][j];
          ans.a[i][j] %= (int)(1e9 + 7);
        }
      }
    }
    return ans;
  }
  matrix I() {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        if (i == j)
          ans.a[i][j] = 1;
        else
          ans.a[i][j] = 0;
      }
    }
    return ans;
  }
  matrix power(long long p) {
    if (p == 0) return I();
    if (p == 1) return *this;
    matrix tmp = power(p / 2);
    if (p % 2)
      tmp = tmp * tmp * (*this);
    else
      tmp = tmp * tmp;
    return tmp;
  }
  void print() {
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        printf(j == sz ? "%lld\n" : "%lld ", a[i][j]);
      }
    }
    return;
  }
};
struct polynomial {
  vector<complex<double> > v;
  int sz;
  polynomial operator*(const polynomial &T) const {
    polynomial ans;
    if (sz >= T.sz) {
      ans = *this;
      for (int i = 0; i < T.sz; i++) {
        ans.v[i] *= T.v[i];
      }
    } else {
      ans = T;
      for (int i = 0; i < sz; i++) {
        ans.v[i] *= v[i];
      }
    }
    return ans;
  }
};
polynomial FFT(polynomial a) {
  if (a.sz <= 1) return a;
  polynomial even, odd;
  even.sz = odd.sz = 0;
  for (int i = 0; i < a.sz; i += 2) {
    even.v.push_back(a.v[i]);
    even.sz++;
  }
  for (int i = 1; i < a.sz; i += 2) {
    odd.v.push_back(a.v[i]);
    odd.sz++;
  }
  polynomial Even = FFT(even);
  polynomial Odd = FFT(odd);
  polynomial ans;
  ans.sz = a.sz;
  for (int i = 0; i < ans.sz; i++) {
    ans.v.push_back(0);
  }
  for (int i = 0; i < a.sz / 2; i++) {
    complex<double> w =
        polar(1.0, -2 * (double)3.14159265358979 * i / a.sz) * Odd.v[i];
    ans.v[i] = Even.v[i] + w;
    ans.v[i + a.sz / 2] = Even.v[i] - w;
  }
  return ans;
}
polynomial IFFT(polynomial a) {
  for (int i = 0; i < a.sz; i++) {
    a.v[i] = conj(a.v[i]);
  }
  polynomial ans = FFT(a);
  for (int i = 0; i < a.sz; i++) {
    ans.v[i] = conj(ans.v[i]);
    ans.v[i] /= ans.sz;
  }
  return ans;
}
struct polygon {
  int n;
  pair<int, int> a[1005];
  double area() {
    double d1 = 0, d2 = 0;
    for (int i = 0; i < n; i++) {
      d1 += a[i].first * a[(i + 1) % n].second;
      d2 += a[(i + 1) % n].first * a[i].second;
    }
    return (d1 - d2) / 2;
  }
  bool inside(pair<long double, long double> p) {
    int ct = 0;
    long double d;
    pair<long double, long double> p1 = a[0];
    for (int i = 1; i <= n; i++) {
      pair<long double, long double> p2 = a[i % n];
      if (p.second > min(p1.second, p2.second) &&
          p.second <= max(p1.second, p2.second) &&
          p.first <= max(p1.first, p2.first) && p1.second != p2.second) {
        d = (p.second - p1.second) * (p2.first - p1.first) /
                (p2.second - p1.second) +
            p1.first;
        if (p1.first == p2.first || p.first <= d) ct++;
      }
      p1 = p2;
    }
    return ct % 2;
  }
};
struct graph {
  int n;
  vector<int> v[1005];
  int vis[1005], low[1005], t;
  int indeg[1005];
  stack<int> st;
  int top = 0;
  bool instack[1005];
  int to[1005];
  void tarjanDFS(int first) {
    vis[first] = low[first] = ++t;
    st.push(first);
    instack[first] = true;
    for (auto i : v[first]) {
      if (!vis[i]) tarjanDFS(i);
      if (instack[i]) {
        low[first] = min(low[first], low[i]);
      }
    }
    if (vis[first] == low[first]) {
      int i;
      do {
        i = st.top();
        st.pop();
        instack[i] = false;
        to[i] = first;
      } while (i != first);
    }
  }
  void tarjan() {
    memset(vis, 0, sizeof(vis));
    t = 0;
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) tarjanDFS(i);
    }
    return;
  }
  void calIndeg() {
    for (int i = 1; i <= n; i++) {
      for (auto j : v[i]) indeg[j]++;
    }
    return;
  }
};
struct segtree {
  int l, r, mid;
  long long val = 0, lazy = 0;
  segtree *lc, *rc;
  segtree(int L, int R) {
    l = L;
    r = R;
    mid = (l + r) / 2;
    if (l != r) {
      lc = new segtree(l, mid);
      rc = new segtree(mid + 1, r);
    }
  }
  void apply(long long X) {
    val += X;
    lazy += X;
  }
  void push() {
    if (l == r) return;
    lc->apply(lazy);
    rc->apply(lazy);
    lazy = 0;
  }
  void update(int L, int R, long long X) {
    push();
    if (l == L && r == R) {
      apply(X);
      return;
    } else if (R <= mid)
      lc->update(L, R, X);
    else if (L >= mid + 1)
      rc->update(L, R, X);
    else {
      lc->update(L, mid, X);
      rc->update(mid + 1, R, X);
    }
    val = min(lc->val, rc->val);
  }
  long long query(int L, int R) {
    push();
    if (l == L && r == R)
      return val;
    else if (R <= mid)
      return lc->query(L, R);
    else if (L >= mid + 1)
      return rc->query(L, R);
    else {
      return min(lc->query(L, mid), rc->query(mid + 1, R));
    }
  }
} * segroot;
mt19937 rng(
    (unsigned int)chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r) {
  uniform_int_distribution<int> uni(l, r);
  return uni(rng);
}
vector<long long> fac, inv;
long long power(long long a, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = ans * a % (int)(998244353);
    p >>= 1;
    a = a * a % (int)(998244353);
  }
  return ans;
}
vector<long long> inverse(int n) {
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = ans[(int)(998244353) % i] *
             ((int)(998244353) - (int)(998244353) / i) % (int)(998244353);
  }
  return ans;
}
vector<long long> factorial(int n) {
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = ans[i - 1] * i % (int)(998244353);
  }
  return ans;
}
vector<long long> factorialInverse(int n) {
  vector<long long> inv = inverse(n);
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = inv[i] * ans[i - 1] % (int)(998244353);
  }
  return ans;
}
long long ncr(int n, int r) {
  return fac[n] * inv[r] % (int)(998244353) * inv[n - r] % (int)(998244353);
}
void calfacinv(int n) {
  fac = factorial(n);
  inv = factorialInverse(n);
  return;
}
struct node {
  long long hash, two;
  bool win;
  bool operator<(const node &T) const { return hash < T.hash; }
};
int T;
long long k, A, h;
long long p[105];
long long re;
vector<node> L, R;
pair<long long, int> f(int first, int second, int r) {
  int rank = r + 1;
  pair<long long, int> ans;
  if (first + 1 == second) {
    if (re % 2) {
      ans.second = first;
      ans.first = second * power(A, rank) % (int)(998244353);
      p[second] = rank;
    } else {
      ans.second = second;
      ans.first = first * power(A, rank) % (int)(998244353);
      p[first] = rank;
    }
    re /= 2;
    return ans;
  }
  int mid = (first + second) / 2;
  pair<long long, int> pr1, pr2;
  pr1 = f(first, mid, r * 2);
  pr2 = f(mid + 1, second, r * 2);
  ans.first = pr1.first + pr2.first;
  if (re % 2) {
    ans.second = pr1.second;
    ans.first += pr2.second * power(A, rank) % (int)(998244353);
    p[pr2.second] = rank;
  } else {
    ans.second = pr2.second;
    ans.first += pr1.second * power(A, rank) % (int)(998244353);
    p[pr1.second] = rank;
  }
  re /= 2;
  ans.first %= (int)(998244353);
  return ans;
}
void find(long long tar) {
  int ppl = power(2, k - 1);
  int two = power(2, ppl - 1);
  int p1 = 0;
  int p2 = R.size() - 1;
  while (true) {
    if (p1 == L.size() || p2 < 0) break;
    long long sum = L[p1].hash + R[p2].hash;
    if (sum == tar && (L[p1].win != R[p1].win)) {
      re = L[p1].two;
      pair<long long, int> pr1 = f(1, ppl, 2);
      re = R[p2].two;
      pair<long long, int> pr2 = f(ppl + 1, 2 * ppl, 2);
      if (L[p1].win) {
        p[pr1.second] = 1;
        p[pr2.second] = 2;
      } else {
        p[pr1.second] = 2;
        p[pr2.second] = 1;
      }
      for (int i = 1; i <= 2 * ppl; i++) {
        printf(i == 2 * ppl ? "%lld\n" : "%lld ", p[i]);
      }
      exit(0);
    } else if (sum > tar) {
      p2--;
    } else
      p1++;
  }
  return;
}
void solve(int CASE) {
  scanf("%lld%lld%lld", &k, &A, &h);
  if (k <= 4) {
    int ppl = power(2, k);
    int two = power(2, ppl - 1);
    for (int i = 0; i < two; i++) {
      re = i;
      long long ttl;
      pair<long long, int> pr = f(1, ppl, 1);
      p[pr.second] = 1;
      ttl = pr.first + pr.second * A;
      ttl %= (int)(998244353);
      if (ttl == h) {
        for (int i = 1; i <= ppl; i++) {
          printf(i == ppl ? "%lld\n" : "%lld ", p[i]);
        }
        return;
      }
    }
    printf("-1\n");
    return;
  }
  int ppl = power(2, k - 1);
  int two = power(2, ppl - 1);
  for (int i = 0; i < two; i++) {
    re = i;
    long long ttl;
    pair<long long, int> pr = f(1, ppl, 2);
    node tmp1, tmp2;
    tmp1.two = tmp2.two = i;
    tmp1.win = true;
    tmp2.win = false;
    tmp1.hash = pr.first + pr.second * A;
    tmp1.hash %= (int)(998244353);
    tmp2.hash = pr.first + pr.second * power(A, 2);
    tmp2.hash %= (int)(998244353);
    L.push_back(tmp1);
    L.push_back(tmp2);
  }
  for (int i = 0; i < two; i++) {
    re = i;
    long long ttl;
    pair<long long, int> pr = f(ppl + 1, 2 * ppl, 2);
    node tmp1, tmp2;
    tmp1.two = tmp2.two = i;
    tmp1.win = true;
    tmp2.win = false;
    tmp1.hash = pr.first + pr.second * A;
    tmp1.hash %= (int)(998244353);
    tmp2.hash = pr.first + pr.second * power(A, 2);
    tmp2.hash %= (int)(998244353);
    R.push_back(tmp1);
    R.push_back(tmp2);
  }
  sort(L.begin(), L.end());
  sort(R.begin(), R.end());
  find(h);
  find(h + (int)(998244353));
  printf("-1\n");
  return;
}
int main() {
  T = 1;
  for (int _ = 1; _ <= T; _++) {
    solve(_);
  }
  return 0;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
struct matrix {
  int sz;
  long long a[105][105];
  matrix &operator=(const matrix &T) {
    sz = T.sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        a[i][j] = T.a[i][j];
      }
    }
    return *this;
  }
  matrix operator+(const matrix &T) const {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        ans.a[i][j] = a[i][j] + T.a[i][j];
        ans.a[i][j] %= (int)(1e9 + 7);
      }
    }
    return ans;
  }
  matrix operator*(const matrix &T) const {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        ans.a[i][j] = 0;
        for (int k = 1; k <= sz; k++) {
          ans.a[i][j] += a[i][k] * T.a[k][j];
          ans.a[i][j] %= (int)(1e9 + 7);
        }
      }
    }
    return ans;
  }
  matrix I() {
    matrix ans;
    ans.sz = sz;
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        if (i == j)
          ans.a[i][j] = 1;
        else
          ans.a[i][j] = 0;
      }
    }
    return ans;
  }
  matrix power(long long p) {
    if (p == 0) return I();
    if (p == 1) return *this;
    matrix tmp = power(p / 2);
    if (p % 2)
      tmp = tmp * tmp * (*this);
    else
      tmp = tmp * tmp;
    return tmp;
  }
  void print() {
    for (int i = 1; i <= sz; i++) {
      for (int j = 1; j <= sz; j++) {
        printf(j == sz ? "%lld\n" : "%lld ", a[i][j]);
      }
    }
    return;
  }
};
struct polynomial {
  vector<complex<double> > v;
  int sz;
  polynomial operator*(const polynomial &T) const {
    polynomial ans;
    if (sz >= T.sz) {
      ans = *this;
      for (int i = 0; i < T.sz; i++) {
        ans.v[i] *= T.v[i];
      }
    } else {
      ans = T;
      for (int i = 0; i < sz; i++) {
        ans.v[i] *= v[i];
      }
    }
    return ans;
  }
};
polynomial FFT(polynomial a) {
  if (a.sz <= 1) return a;
  polynomial even, odd;
  even.sz = odd.sz = 0;
  for (int i = 0; i < a.sz; i += 2) {
    even.v.push_back(a.v[i]);
    even.sz++;
  }
  for (int i = 1; i < a.sz; i += 2) {
    odd.v.push_back(a.v[i]);
    odd.sz++;
  }
  polynomial Even = FFT(even);
  polynomial Odd = FFT(odd);
  polynomial ans;
  ans.sz = a.sz;
  for (int i = 0; i < ans.sz; i++) {
    ans.v.push_back(0);
  }
  for (int i = 0; i < a.sz / 2; i++) {
    complex<double> w =
        polar(1.0, -2 * (double)3.14159265358979 * i / a.sz) * Odd.v[i];
    ans.v[i] = Even.v[i] + w;
    ans.v[i + a.sz / 2] = Even.v[i] - w;
  }
  return ans;
}
polynomial IFFT(polynomial a) {
  for (int i = 0; i < a.sz; i++) {
    a.v[i] = conj(a.v[i]);
  }
  polynomial ans = FFT(a);
  for (int i = 0; i < a.sz; i++) {
    ans.v[i] = conj(ans.v[i]);
    ans.v[i] /= ans.sz;
  }
  return ans;
}
struct polygon {
  int n;
  pair<int, int> a[1005];
  double area() {
    double d1 = 0, d2 = 0;
    for (int i = 0; i < n; i++) {
      d1 += a[i].first * a[(i + 1) % n].second;
      d2 += a[(i + 1) % n].first * a[i].second;
    }
    return (d1 - d2) / 2;
  }
  bool inside(pair<long double, long double> p) {
    int ct = 0;
    long double d;
    pair<long double, long double> p1 = a[0];
    for (int i = 1; i <= n; i++) {
      pair<long double, long double> p2 = a[i % n];
      if (p.second > min(p1.second, p2.second) &&
          p.second <= max(p1.second, p2.second) &&
          p.first <= max(p1.first, p2.first) && p1.second != p2.second) {
        d = (p.second - p1.second) * (p2.first - p1.first) /
                (p2.second - p1.second) +
            p1.first;
        if (p1.first == p2.first || p.first <= d) ct++;
      }
      p1 = p2;
    }
    return ct % 2;
  }
};
struct graph {
  int n;
  vector<int> v[1005];
  int vis[1005], low[1005], t;
  int indeg[1005];
  stack<int> st;
  int top = 0;
  bool instack[1005];
  int to[1005];
  void tarjanDFS(int first) {
    vis[first] = low[first] = ++t;
    st.push(first);
    instack[first] = true;
    for (auto i : v[first]) {
      if (!vis[i]) tarjanDFS(i);
      if (instack[i]) {
        low[first] = min(low[first], low[i]);
      }
    }
    if (vis[first] == low[first]) {
      int i;
      do {
        i = st.top();
        st.pop();
        instack[i] = false;
        to[i] = first;
      } while (i != first);
    }
  }
  void tarjan() {
    memset(vis, 0, sizeof(vis));
    t = 0;
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) tarjanDFS(i);
    }
    return;
  }
  void calIndeg() {
    for (int i = 1; i <= n; i++) {
      for (auto j : v[i]) indeg[j]++;
    }
    return;
  }
};
struct segtree {
  int l, r, mid;
  long long val = 0, lazy = 0;
  segtree *lc, *rc;
  segtree(int L, int R) {
    l = L;
    r = R;
    mid = (l + r) / 2;
    if (l != r) {
      lc = new segtree(l, mid);
      rc = new segtree(mid + 1, r);
    }
  }
  void apply(long long X) {
    val += X;
    lazy += X;
  }
  void push() {
    if (l == r) return;
    lc->apply(lazy);
    rc->apply(lazy);
    lazy = 0;
  }
  void update(int L, int R, long long X) {
    push();
    if (l == L && r == R) {
      apply(X);
      return;
    } else if (R <= mid)
      lc->update(L, R, X);
    else if (L >= mid + 1)
      rc->update(L, R, X);
    else {
      lc->update(L, mid, X);
      rc->update(mid + 1, R, X);
    }
    val = min(lc->val, rc->val);
  }
  long long query(int L, int R) {
    push();
    if (l == L && r == R)
      return val;
    else if (R <= mid)
      return lc->query(L, R);
    else if (L >= mid + 1)
      return rc->query(L, R);
    else {
      return min(lc->query(L, mid), rc->query(mid + 1, R));
    }
  }
} * segroot;
mt19937 rng(
    (unsigned int)chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r) {
  uniform_int_distribution<int> uni(l, r);
  return uni(rng);
}
vector<long long> fac, inv;
long long power(long long a, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = ans * a % (int)(998244353);
    p >>= 1;
    a = a * a % (int)(998244353);
  }
  return ans;
}
vector<long long> inverse(int n) {
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = ans[(int)(998244353) % i] *
             ((int)(998244353) - (int)(998244353) / i) % (int)(998244353);
  }
  return ans;
}
vector<long long> factorial(int n) {
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = ans[i - 1] * i % (int)(998244353);
  }
  return ans;
}
vector<long long> factorialInverse(int n) {
  vector<long long> inv = inverse(n);
  vector<long long> ans(n + 1);
  ans[0] = ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    ans[i] = inv[i] * ans[i - 1] % (int)(998244353);
  }
  return ans;
}
long long ncr(int n, int r) {
  return fac[n] * inv[r] % (int)(998244353) * inv[n - r] % (int)(998244353);
}
void calfacinv(int n) {
  fac = factorial(n);
  inv = factorialInverse(n);
  return;
}
struct node {
  long long hash, two;
  bool win;
  bool operator<(const node &T) const { return hash < T.hash; }
};
int T;
long long k, A, h;
long long p[105];
long long re;
vector<node> L, R;
pair<long long, int> f(int first, int second, int r) {
  int rank = r + 1;
  pair<long long, int> ans;
  if (first + 1 == second) {
    if (re % 2) {
      ans.second = first;
      ans.first = second * power(A, rank) % (int)(998244353);
      p[second] = rank;
    } else {
      ans.second = second;
      ans.first = first * power(A, rank) % (int)(998244353);
      p[first] = rank;
    }
    re /= 2;
    return ans;
  }
  int mid = (first + second) / 2;
  pair<long long, int> pr1, pr2;
  pr1 = f(first, mid, r * 2);
  pr2 = f(mid + 1, second, r * 2);
  ans.first = pr1.first + pr2.first;
  if (re % 2) {
    ans.second = pr1.second;
    ans.first += pr2.second * power(A, rank) % (int)(998244353);
    p[pr2.second] = rank;
  } else {
    ans.second = pr2.second;
    ans.first += pr1.second * power(A, rank) % (int)(998244353);
    p[pr1.second] = rank;
  }
  re /= 2;
  ans.first %= (int)(998244353);
  return ans;
}
void find(long long tar) {
  int ppl = power(2, k - 1);
  int two = power(2, ppl - 1);
  int p1 = 0;
  int p2 = R.size() - 1;
  while (true) {
    if (p1 == L.size() || p2 < 0) break;
    long long sum = L[p1].hash + R[p2].hash;
    if (sum == tar && (L[p1].win != R[p1].win)) {
      re = L[p1].two;
      pair<long long, int> pr1 = f(1, ppl, 2);
      re = R[p2].two;
      pair<long long, int> pr2 = f(ppl + 1, 2 * ppl, 2);
      if (L[p1].win) {
        p[pr1.second] = 1;
        p[pr2.second] = 2;
      } else {
        p[pr1.second] = 2;
        p[pr2.second] = 1;
      }
      for (int i = 1; i <= 2 * ppl; i++) {
        printf(i == 2 * ppl ? "%lld\n" : "%lld ", p[i]);
      }
      exit(0);
    } else if (sum > tar) {
      p2--;
    } else
      p1++;
  }
  return;
}
void solve(int CASE) {
  scanf("%lld%lld%lld", &k, &A, &h);
  if (k <= 4) {
    int ppl = power(2, k);
    int two = power(2, ppl - 1);
    for (int i = 0; i < two; i++) {
      re = i;
      long long ttl;
      pair<long long, int> pr = f(1, ppl, 1);
      p[pr.second] = 1;
      ttl = pr.first + pr.second * A;
      ttl %= (int)(998244353);
      if (ttl == h) {
        for (int i = 1; i <= ppl; i++) {
          printf(i == ppl ? "%lld\n" : "%lld ", p[i]);
        }
        return;
      }
    }
    printf("-1\n");
    return;
  }
  int ppl = power(2, k - 1);
  int two = power(2, ppl - 1);
  for (int i = 0; i < two; i++) {
    re = i;
    long long ttl;
    pair<long long, int> pr = f(1, ppl, 2);
    node tmp1, tmp2;
    tmp1.two = tmp2.two = i;
    tmp1.win = true;
    tmp2.win = false;
    tmp1.hash = pr.first + pr.second * A;
    tmp1.hash %= (int)(998244353);
    tmp2.hash = pr.first + pr.second * power(A, 2);
    tmp2.hash %= (int)(998244353);
    L.push_back(tmp1);
    L.push_back(tmp2);
  }
  for (int i = 0; i < two; i++) {
    re = i;
    long long ttl;
    pair<long long, int> pr = f(ppl + 1, 2 * ppl, 2);
    node tmp1, tmp2;
    tmp1.two = tmp2.two = i;
    tmp1.win = true;
    tmp2.win = false;
    tmp1.hash = pr.first + pr.second * A;
    tmp1.hash %= (int)(998244353);
    tmp2.hash = pr.first + pr.second * power(A, 2);
    tmp2.hash %= (int)(998244353);
    R.push_back(tmp1);
    R.push_back(tmp2);
  }
  sort(L.begin(), L.end());
  sort(R.begin(), R.end());
  find(h);
  find(h + (int)(998244353));
  printf("-1\n");
  return;
}
int main() {
  T = 1;
  for (int _ = 1; _ <= T; _++) {
    solve(_);
  }
  return 0;
}

```