import java.math.BigInteger;
import java.io.IOException;
import java.io.File;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Arrays;

public class separable_as_backtrack {
    boolean isSeparable(boolean[][] a) {
        boolean can = true;
        search:
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a[i].length; j++) {
                if (a[i][j] && !a[i + 1][j]) {
                    can = false;
                    break search;
                }
            }
        }
        if (can) return true;

        can = true;
        search:
        for (int i = 1; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                if (a[i][j] && !a[i - 1][j]) {
                    can = false;
                    break search;
                }
            }
        }
        if (can) return true;

        can = true;
        search:
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length - 1; j++) {
                if (a[i][j] && !a[i][j + 1]) {
                    can = false;
                    break search;
                }
            }
        }
        if (can) return true;

        can = true;
        search:
        for (int i = 0; i < a.length; i++) {
            for (int j = 1; j < a[i].length; j++) {
                if (a[i][j] && !a[i][j - 1]) {
                    can = false;
                    break search;
                }
            }
        }
        if (can) return true;

        return false;
    }

    boolean[][] x;
    boolean[][] v;

    int[] dx = new int[]{0, 1, 0, -1};
    int[] dy = new int[]{1, 0, -1, 0};

    void dfs(int i, int j, boolean what) {
        v[i][j] = true;
        for (int k = 0; k < 4; k++) {
            int ni = i + dx[k];
            int nj = j + dy[k];
            if (ni < 0 || ni > x.length - 1 || nj < 0 || nj > x[0].length - 1) {
                continue;
            }

            if (!v[ni][nj] && x[ni][nj] == what) {
                dfs(ni, nj, what);
            }
        }
    }

    boolean isValid(boolean[][] a) {
        boolean ok = false;
        int ti = -1;
        int tj = -1;
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                if (a[i][j]) {
                    ok = true;
                    ti = i;
                    tj = j;
                }
            }
        }
        if (!ok) return false;

        x = a;
        for (int i = 0; i < v.length; i++) {
            Arrays.fill(v[i], false);
        }

        dfs(0, 0, false);
        dfs(ti, tj, true);
        for (int i = 0; i < v.length; i++) {
            for (int j = 0; j < v[i].length; j++) {
                if (!v[i][j]) {
                    return false;
                }
            }
        }
        return true;
    }

    int m;
    int n;

    int res;
    int z = 0;
    boolean print = false;

    void backtrack(int i, int j, boolean[][] a) {
        if (i == m) {
            z++;
            if (isValid(a) && isSeparable(a)) {
                res++;
                if (print) {
                    for (int x = 0; x < a.length; x++) {
                        for (int y = 0; y < a[x].length; y++) {
                            System.out.print(a[x][y] ? "." : "*");
                        }
                        System.out.println("");
                    }
                    System.out.println("GOOD " + z);
                    System.out.println("");
                }
            } else {
                if (print) {
                    for (int x = 0; x < a.length; x++) {
                        for (int y = 0; y < a[x].length; y++) {
                            System.out.print(a[x][y] ? "." : "*");
                        }
                        System.out.println("");
                    }
                    System.out.println("BAD " + z);
                    System.out.println("");
                }
            }
            return;
        }
        if (j == n) {
            backtrack(i + 1, 0, a);
            return;
        }

        backtrack(i, j + 1, a);
        if (i > 0 || j > 0) {
            a[i][j] = true;
            backtrack(i, j + 1, a);
            a[i][j] = false;
        }
    }

    public void run() throws IOException {
        Scanner in = new Scanner(new File("separable.in"));
        PrintWriter out = new PrintWriter(new File("separable.ouu"));

        m = in.nextInt();
        n = in.nextInt();

        for (m = 1; m < 6; m++) {
            for (n = 1; n < 5; n++) {

//        m = 2;
//        n = 3;
                res = 0;
                v = new boolean[m][n];
                backtrack(0, 0, new boolean[m][n]);

                out.println(m + " " + n + " " + res);

            }
        }

        in.close();
        out.close();
    }

    public static void main(String[] arg) throws IOException {
        new separable_as_backtrack().run();
    }
}
