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

public class elevator_gk_dump {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(new File("elevator.in"));
        int n = 50;

        int[] q = new int[n];
        int[] v = new int[n];

        for (int a = 1; a <= n; a++) {
            for (int b = 1; b <= a; b++) {
                for (int c = 1; c <= b; c++) {
                    Arrays.fill(q, Integer.MAX_VALUE);
                    Arrays.fill(v, Integer.MAX_VALUE);

                    for (int z = 0; z < c; z++) {
                        int f = a * z;
                        for (int y = a * z; v[y % c] == Integer.MAX_VALUE; y += b) {
                            for (int x = y; q[x % c] == Integer.MAX_VALUE; x += a) {
                                q[x % c] = x;
                            }

                            if (f > q[y % c]) f = q[y % c];
                            v[y % c] = f;
                            f += b;
                        }
                    }
                    System.out.format("------- %d %d %d\n", a, b, c);
                    for (int i = 0; i < c; i++) {
                        System.out.println(v[i]);
                    }
                }
            }
        }
        PrintWriter w = new PrintWriter("elevator.out");
        w.close();
    }
}
