program permutations;

const
    pnum = 25;
    maxn = 100;

var
    pn: longint;
    p: array [1..pnum] of longint;
    flag: boolean;
    i, j, k, n, max: longint;
    a: array [0..maxn, 0..pnum] of longint;
    f: array [0..maxn, 0..pnum] of integer;

procedure outp(x, y: longint);
var
    i: longint;
begin
    if x = 0 then exit;
    if y < 0 then y := 0;

    outp(x - f[x][y], y - 1);

    if f[x][y] > 0 then
    begin
        for i := 2 to f[x][y] do
            write(x - f[x][y] + i, ' ');
        write(x - f[x][y] + 1, ' ');
    end;
end;

procedure outp2(x, y: longint);
var
    i: longint;
begin
    if x = 0 then exit;
    if y < 0 then y := 0;

    outp2(x - f[x][y], y - 1);

    write(f[x][y], ' ');
end;

begin
{    assign(input, 'perm.in');
    reset(input);
    assign(output, 'perm.out');
    rewrite(output);}

    pn := 0;
    for i := 2 to maxn do
    begin
        flag := true;
        for j := 2 to i - 1 do
        begin
            if i mod j = 0 then
                flag := false;
        end;
        if flag then
        begin
            inc(pn);
            p[pn] := i;
        end;
    end;

//    while not seekeof do begin

    read(n);

    fillchar(a, sizeof(a), 0);
    for i := 0 to pn do
        a[0][i] := 1;

    for i := 1 to n do
        f[i][0] := 0;

    for i := 1 to n do
        for j := 1 to pn do
        begin
            a[i][j] := a[i][j - 1];
            f[i][j] := 0;
            k := 1;
            while i - k >= 0 do
            begin
                if a[i - k][j - 1] * k > a[i][j] then
                begin
                    a[i][j] := a[i - k][j - 1] * k;
                    f[i][j] := k;
                end;
                k := k * p[j];
            end;
        end;

    max := 0;
    for j := 1 to pn do
    begin
{        writeln(a[n][j]);}
        if a[n][j] > max then
        begin
            max := a[n][j];
            k := j;
        end;
    end;

{    writeln(n);
    writeln(max);
    outp2(n, k);
    writeln;}
    outp(n, k);

    writeln;
    writeln;
//    end;

    close(input);
    close(output);
end.
