import java.util.ArrayList;
import java.util.HashMap;
import java.util.Collections;
import java.util.Scanner;
import java.io.IOException;
import java.io.File;
import java.io.PrintWriter;

public class gen_nim implements Runnable {
    HashMap<ArrayList<Integer>, Integer> pos;

    int dfs(ArrayList<Integer> a) {
        if (a.size() == 0) {
            pos.put(a, -1);
            return -1;
        }

        if (pos.containsKey(a)) {
            return pos.get(a);
        }

        boolean win = false;
        for (int i = 0; i < a.size(); i++) {
            int x = a.get(i);
            search:
            for (int y = 1; y < x; y++) {
                for (int j = 0; j < a.size(); j++) {
                    if (i != j && a.get(j) == y) {
                        continue search;
                    }
                }
                ArrayList<Integer> b = new ArrayList<Integer>(a.size());
                for (int j = 0; j < a.size(); j++) {
                    if (i == j) {
                        b.add(y);
                    } else {
                        b.add(a.get(j));
                    }
                }
                Collections.sort(b);
                if (dfs(b) == -1) {
                    pos.put(a, 1);
                    return 1;
                }
            }
            ArrayList<Integer> b = new ArrayList<Integer>(a.size() - 1);
            for (int j = 0; j < a.size(); j++) {
                if (i != j) {
                    b.add(a.get(j));
                }
            }
            if (dfs(b) == -1) {
                pos.put(a, 1);
                win = true;
            }
        }

        if (win) {
            return 1;
        }

        pos.put(a, -1);
        int y = 0;
        for (int x : a) {
            System.out.print(x + " ");
            y ^= (x + 1);
        }
        System.out.println("= " + y);

        return -1;
    }

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

        pos = new HashMap<ArrayList<Integer>, Integer>();
        for (int n = 2; n <= 5; n++) {
            ArrayList<Integer> a = new ArrayList<Integer>(n);
            for (int i = 0; i < n; i++) {
                a.add(20 + i);
            }

            dfs(a);
        }

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

    public void run() {
        try {
            solve();
        } catch (IOException e) {
        }
    }

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