import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Random;
import java.util.Scanner;
import java.util.HashSet;


public class TestsGen implements Runnable {
    private Scanner in;
    private int testId;
    private PrintWriter out;

    Random random = new Random(20071121);
    
    private boolean generateTest() throws FileNotFoundException {
        if (!in.hasNext()) {
            return false;
        }
        out = new PrintWriter(String.format("%d%d", testId / 10, testId % 10));
        printList(readPoints());
        printList(readPoints());
        out.close();
        return true;
    }

    private void printList(int[] list) {
        out.println(list.length);
        int now = 0;
        for (int p: list) {
        	out.print(p);
        	if (now++ < list.length - 1) {
        		out.print(" ");
        	}
        }
        out.println();
    }

    private int[] readPoints() {
        String type = in.next();
        if ("random".equals(type)) {
            int[] list = new int[in.nextInt()];
            int max = in.nextInt();
            HashSet<Integer> was = new HashSet<Integer>();
            for (int i = 0; i < list.length; i++) {
            	do {
	            	list[i] = random.nextInt(max) + 1; 
	            } while (was.contains(list[i]));
	            was.add(list[i]);
            }
            return list;
        } else if ("progr".equals(type)) {
            int[] list = new int[in.nextInt()];
            int a = in.nextInt();
            int b = in.nextInt();
            for (int i = 0; i < list.length; i++) {
            	list[i] = a;
            	a += b;
            }
            return list;
        } else {
            int[] list = new int[Integer.parseInt(type)];
            for (int i = 0; i < list.length; i++) {
            	list[i] = in.nextInt(); 
            }
            return list;
        }
    }

    public TestsGen(int test, String file) {
        System.out.printf("Generating tests from file '%s' starting from test #%d\n", file, test);
        try {
            testId = test;
            in = new Scanner(new File(file));
        } catch (FileNotFoundException e) {
            apstenu(e);
        }
    }

//    @Override
    public void run() {
        try {
            while (generateTest()) {
                testId++;
            }
        } catch (FileNotFoundException e) {
            apstenu(e);
        }
    }

    private void apstenu(Exception e) {
        e.printStackTrace();
        System.exit(1);
    }

    public static void main(String[] args) {
        Locale.setDefault(Locale.US);
        new Thread(new TestsGen(Integer.parseInt(args[0]), args[1])).start();
    }
}
