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

public class doall implements Runnable {
    private static final int MAX_N = 100000;
    
	private int testId = 1;

    private Random random = new Random(20091011);
    
    private void generate(int n, double prob_cancel, Integer max_cancel) throws FileNotFoundException {
        PrintWriter out = new PrintWriter(String.format("%d%d", testId / 10, testId % 10));
        testId++;
		out.println(n);
		for (int i = 0; i < n; i++) {
			if (i > 0 && random.nextDouble() <= prob_cancel) {
				int id = max_cancel == null ? random.nextInt(i) + 1 : Math.max(1, i - random.nextInt(max_cancel));
				out.printf("cancel %d%n", id);
			} else {
				out.printf("declare%n");
			}
		}
        out.close();
	}

	private void generateSample1() throws FileNotFoundException {
        PrintWriter out = new PrintWriter(String.format("%d%d", testId / 10, testId % 10));
        testId++;
		out.println(5);
		out.println("declare");
		out.println("cancel 1");
		out.println("declare");
		out.println("cancel 2");
		out.println("cancel 3");
        out.close();
	}

	@Override
    public void run() {
        try {
        	generateSample1();
        	generate(10, 0.5, 15);
        	generate(100, 0.5, null);
        	generate(1000, 0.8, null);
        	generate(MAX_N, 0, null);
        	generate(MAX_N, 1, 1);
        	generate(MAX_N, 0.9, 1);
        	generate(MAX_N, 0.9, 2);
        	generate(MAX_N, 0.9, 100);
        	generate(MAX_N, 0.9, 1000);
        	generate(MAX_N, 0.9, null);
        	generate(MAX_N, 0.1, 1);
        	generate(MAX_N, 0.1, 2);
        	generate(MAX_N, 0.8, null);
        	generate(MAX_N, 0.5, null);
        	generate(MAX_N, 0.1, 1);
        	generate(MAX_N, 0.1, 2);
        	generate(MAX_N, 0.1, null);
        	generate(MAX_N, 0.001, 1);
        	generate(MAX_N, 0.001, 100);
        	generate(MAX_N, 0.001, null);
        	generate(MAX_N, 0.999, 1);
        	generate(MAX_N, 0.999, 100);
        	generate(MAX_N, 0.999, null);
        } 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 doall()).start();
    }
}
