Problem: In this task you have to write a program dealing with nonograms on fields no larger than 5 × 20.

Simplified nonogram is a task where you have to build such field (each cell is either white or black) that satisfies the given information about rows and columns. For each row and each column the number of contiguous black segments is specified. 

For example if size of the field is n = 3, m = 5, аnd numbers of contiguous black segments in rows are: [2, 3, 2] and in columns are: [1, 0, 1, 2, 1] then the solution may look like:

<image>

It is guaranteed that on each test in the testset there exists at least one solution.

Input

In the first line there follow two integers n, m (1 ≤ n ≤ 5, 1 ≤ m ≤ 20) — number of rows and number of columns respectively.

Second line contains n integers a1, a2, ..., an where ai is the number of contiguous black segments in i-th row of the field. 

Similarly, third line contains m integers b1, b2, ..., bm where bi is the number of contiguous black segments in the i-th column of the field.

It is guaranteed that there exists at least one solution.

Output

Output any possible solution. Output should consist of n lines each containing m characters. Denote white cell as "." and black cell as "*".

Examples

Input

3 5
2 3 2
1 0 1 2 1


Output

*.**.
*.*.*
*..**

Input

3 3
2 1 2
2 1 2


Output

*.*
.*.
*.*


Input

3 3
1 0 1
2 2 2


Output

***
...
***

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
const int N = 5;
const int M = 20;
const int B = 6;
const int S = 7776;
int n, m, a[N], b[M], bc[1 << N];
typedef char dpmat[M / 2 + 2][S][1 << N];
int c[M + 1];
dpmat lft, rgt;
int make_move(int s, int mask1, int mask2, int mul) {
  int ns = s;
  int dm = mask2 & (mask1 ^ mask2);
  int pw = 1 * mul;
  for (int c = 0; c < n; c++) {
    if (dm & (1 << c)) ns += pw;
    pw *= B;
  }
  return ns;
}
char ans[N][M + 1];
void calcdp(int m, dpmat dp) {
  for (int i = 0; i <= m; i++)
    for (int s = 0; s < S; s++)
      for (int j = 0; j < (1 << n); j++) dp[i][s][j] = -1;
  dp[0][0][0] = 0;
  for (int i = 0; i < m; i++) {
    for (int s = 0; s < S; s++) {
      for (int mask1 = 0; mask1 < (1 << n); mask1++) {
        if (bc[mask1] != c[i]) continue;
        if (dp[i][s][mask1] == -1) continue;
        for (int mask2 = 0; mask2 < (1 << n); mask2++) {
          if (bc[mask2] != c[i + 1]) continue;
          int ns = make_move(s, mask1, mask2, +1);
          dp[i + 1][ns][mask2] = mask1;
        }
      }
    }
  }
}
int res[M];
int al[M], ar[M];
void restore(int m, int s, int mask, dpmat dp) {
  for (int i = m; i >= 1; i--) {
    res[i - 1] = mask;
    int pmask = dp[i][s][mask];
    s = make_move(s, pmask, mask, -1);
    mask = pmask;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < (1 << n); i++) {
    int c = 0;
    int prv = 0;
    for (int j = 0; j < n; j++) {
      int cur = ((i >> j) & 1);
      if (cur && cur != prv) c++;
      prv = cur;
    }
    bc[i] = c;
  }
  int l = m / 2, r = m - l;
  int il = l - 1, ir = l;
  for (int i = 0; i < l; i++) c[i + 1] = b[i];
  calcdp(l, lft);
  for (int i = 0; i < r; i++) c[i + 1] = b[m - i - 1];
  calcdp(r, rgt);
  for (int sl = 0; sl < S; sl++) {
    for (int ml = 0; ml < (1 << n); ml++) {
      if (bc[ml] != b[il]) continue;
      if (lft[l][sl][ml] == -1) continue;
      for (int mr = 0; mr < (1 << n); mr++) {
        if (bc[mr] != b[ir]) continue;
        int sr = 0;
        int pw = 1;
        int csl = sl;
        for (int i = 0; i < n; i++) {
          int cs = a[i];
          int cl = csl % B;
          csl /= B;
          al[i] = cl;
          int cr = cs - cl;
          if (mr & ml & (1 << i)) cr++;
          if (cr < 0 || cr >= B) {
            sr = -1;
            break;
          }
          sr += pw * cr;
          ar[i] = cr;
          pw *= B;
        }
        if (sr == -1) continue;
        if (rgt[r][sr][mr] != -1) {
          restore(l, sl, ml, lft);
          for (int i = 0; i < l; i++) {
            for (int j = 0; j < n; j++) {
              ans[j][i] = ((res[i] >> j) & 1) ? '*' : '.';
            }
          }
          restore(r, sr, mr, rgt);
          for (int i = 0; i < r; i++) {
            for (int j = 0; j < n; j++) {
              ans[j][m - 1 - i] = ((res[i] >> j) & 1) ? '*' : '.';
            }
          }
          for (int i = 0; i < n; i++) puts(ans[i]);
          return 0;
        }
      }
    }
  }
  puts("Impossible");
  return 0;
}