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

public class GenRandom 
{
    Random rnd;
    int n,m,l,d;
    int maxc;
            
    int randInt(int l,int r){
        return rnd.nextInt(r-l)+l;
    }

    void gen() throws IOException {
        out.println(l+" "+d);
        HashSet<Integer> s = new HashSet<Integer>();
        int[] a = new int[n];
        for (int i = 0; i < n; i++){
            do {
                a[i] = randInt(1,maxc);
            } while (s.contains(a[i]));
            s.add(a[i]);
        }
        Arrays.sort(a);
        out.println(n);
        for (int i = 0; i < n; i++)
            out.print(a[i]+(i==n-1?"":" "));
        out.println();

        s = new HashSet<Integer>();

        int[] b = new int[m];
        for (int i = 0; i < m; i++){
            do {
               b[i] = randInt(1,maxc);
            } while (s.contains(b[i]));
            s.add(b[i]);
        }
        Arrays.sort(b);
        out.println(m);
        for (int i = 0; i < m; i++)
            out.print(b[i]+(i==m-1?"":" "));
        out.println();
    }

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

    PrintWriter out;

    void initRandom(String[] args) throws IOException {
        try {
           rnd = new Random(Integer.parseInt(args[0]));
        } catch (Exception e){
           System.err.println("Can't parse randseed");
           e.printStackTrace();
           System.exit(239);
        }
    }

    void parseParametrs(String[] args) throws IOException{
        initRandom(args);
        try {
           l = Integer.parseInt(args[1]);
           d = Integer.parseInt(args[2]);
           n = Integer.parseInt(args[3]);
           m = Integer.parseInt(args[4]);
           if (args.length >= 6)
               maxc = Integer.parseInt(args[5]);
           else
               maxc = 1000000;
        }
        catch (Exception e){
            System.err.println("Usege GenRandom <seed> <l> <d> <n> <m> [<maxc>]");
            e.printStackTrace();
            System.exit(239);
        }
    }

    public void run(String[] args) throws IOException {                            
        try {
            parseParametrs(args);
            Writer writer = new OutputStreamWriter(System.out);
            out = new PrintWriter(writer);
            gen();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(239);
        }       
    }

}                                    
