#include <bits/stdc++.h>
using namespace std;
int n, a[22][1 << 18], b[22][1 << 18], c[1 << 18], ans[1 << 18];
int M1, M2, M3, M4, N1, N2;
int add(int x, int y) { return (x + y) & M1; }
int mult(int x, int y) {
  int z = 0;
  int xx = x & N1;
  xx |= xx << 1;
  z = xx & y;
  xx = x & N2;
  xx |= xx >> 1;
  z ^= (xx & y) << 1;
  return z & M1;
}
int zeta(int* a) {
  int i, j, k;
  for (i = 0; i < n; i++) {
    if (i < 3) {
      for (j = 0; j < (1 << max(n - 3, 0)); j++) {
        if (i == 0)
          a[j] = add(a[j], (a[j] & M2) << 4);
        else if (i == 1)
          a[j] = add(a[j], (a[j] & M3) << 8);
        else
          a[j] = add(a[j], (a[j] & M4) << 16);
      }
    } else {
      for (j = 0; j < (1 << (n - 3)); j += (1 << (i - 2))) {
        for (k = 0; k < (1 << (i - 3)); k++)
          a[j ^ k ^ (1 << (i - 3))] = add(a[j ^ k ^ (1 << (i - 3))], a[j ^ k]);
      }
    }
  }
  return 0;
}
int main() {
  int i;
  scanf("%d\n", &n);
  for (i = 0; i < (1 << n); i++)
    a[__builtin_popcount(i)][i >> 3] |= ((getchar() - '0') << ((i & 7) << 2));
  getchar();
  for (i = 0; i < (1 << n); i++)
    b[__builtin_popcount(i)][i >> 3] |= ((getchar() - '0') << ((i & 7) << 2));
  int j, k;
  for (i = 0; i < 32; i++) {
    if ((i & 3) < 2) M1 |= (1 << i);
    if ((i & 7) < 4) M2 |= (1 << i);
    if ((i & 15) < 8) M3 |= (1 << i);
    if ((i & 31) < 16) M4 |= (1 << i);
    if ((i & 3) == 0) N1 |= (1 << i);
    if ((i & 3) == 1) N2 |= (1 << i);
  }
  for (i = 0; i <= n; i++) zeta(a[i]), zeta(b[i]);
  for (i = 0; i <= n; i++) {
    memset(c, 0, sizeof(c));
    for (j = 0; j <= i; j++) {
      for (k = 0; k < (1 << max(n - 3, 0)); k++)
        c[k] = add(c[k], mult(a[j][k], b[i - j][k]));
    }
    for (j = 0; j < (1 << n); j++) {
      if (__builtin_popcount(j) & 1) {
        if (c[j >> 3] & (1 << ((j & 7) << 2)))
          c[j >> 3] ^= (2 << ((j & 7) << 2));
      }
    }
    zeta(c);
    for (j = 0; j < (1 << n); j++) {
      if (__builtin_popcount(j) & 1) {
        if (c[j >> 3] & (1 << ((j & 7) << 2)))
          c[j >> 3] ^= (2 << ((j & 7) << 2));
      }
      if (__builtin_popcount(j) == i)
        ans[j >> 3] ^= c[j >> 3] & (3 << ((j & 7) << 2));
    }
  }
  for (i = 0; i < (1 << n); i++)
    printf("%d", (ans[i >> 3] >> ((i & 7) << 2)) & 3);
  printf("\n");
  return 0;
}
