import java.io.*;
import java.util.*;

public class learning_as implements Runnable {

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("learning.in"));
        PrintWriter out = new PrintWriter(new File("learning.out"));

        int n = in.nextInt() + 1;
        boolean[] a = new boolean[1 << n];
        for (int i = 0; i < (1 << n) - 1; i++) {
            a[i + 1] = in.next().charAt(0) == '+';
        }

        int[] remapped = new int[1 << n];

        long[][] p = new long[1 << n][];

        process:

        for (int i = 1; i < 1 << n; i++) {
            if (remapped[i] != 0) {
                continue;
            }
            int j = 0;
            int f = 0;
            int ti = i;
            while (ti < 1 << n) {
                ti *= 2;
                j++;
                if ((1 << (j - 1)) > 64) {
                    f += (1 << (j - 1)) / 64;
                } else {
                    f++;
                }
            }

            p[i] = new long[f];
            int mult = 1;
            int ind = 0;
            int bit = 0;
            for (int k = 0; k < j; k++) {
                for (int l = 0; l < 1 << k; l++) {
                    if (bit == 64) {
                        bit = 0;
                        ind++;
                    }
                    if (a[i * mult + l]) {
                        p[i][ind] |= 1L << bit;
                        //System.out.print("1");
                    } else {
                        //System.out.print("0");
                    }

                    bit++;
                }
                mult *= 2;
                bit = 0;
                ind++;
            }
            //System.out.println("");

            for (int q = 1; q < i; q++) {
                if (remapped[q] != 0) {
                    continue;
                }
                
                boolean match = true;
                for (int z = 0; z < p[i].length; z++) {
                    if (p[i][z] != p[q][z]) {
                        match = false;
                        break;
                    }
                }
                if (match) {
                    remapped[i] = q;

                    mult = 2;
                    for (int k = 1; k < j; k++) {
                        for (int l = 0; l < 1 << k; l++) {
                            //System.out.println(i + " " + mult + " " + k + " " + l + " " + j + " " + l);
                            remapped[i * mult + l] = -1;
                        }
                        mult *= 2;
                    }

                    continue process;
                }
            }
        }

        int map[] = new int[1 << n];
        int ns = 0;
        ArrayList<Integer> term = new ArrayList<Integer>();
        for (int i = 1; i < 1 << n; i++) {
            if (remapped[i] == 0) {
                ns++;
                map[i] = ns;
                if (a[i]) {
                    term.add(ns);
                }
            }
        }

        out.println(ns + " " + 1);
        out.print(term.size());
        for (int x : term) {
            out.print(" " + x);
        }
        out.println();
        for (int i = 1; i < 1 << n; i++) {
            if (remapped[i] == 0) {
                if (2 * i < 1 << n) {
                    if (remapped[2 * i] == 0) {
                        out.print(map[2 * i]);
                    } else {
                        out.print(map[remapped[2 * i]]);
                    }
                    out.print(" ");
                    if (remapped[2 * i + 1] == 0) {
                        out.print(map[2 * i + 1]);
                    } else {
                        out.print(map[remapped[2 * i + 1]]);
                    }
                    out.println();
                } else {
                    out.println("1 1");
                }
            }
        }

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

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace(System.err);
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new learning_as()).start();
    }
}
