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

public class Stresser implements Runnable {
	public void run() {
		try {
			solve();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	private void solve() throws IOException {
		Locale.setDefault(Locale.US);
		for (int n = 1; n <= 1000000; n++) {
			int bestArea = Integer.MAX_VALUE;
			int bestSum = Integer.MAX_VALUE;
			int cArea = -1;
			for (int i = 1; i * i * i <= n; i++) if (n % i == 0) {
				int ni = n / i;
				for (int j = i; j * j <= ni; j++) if (ni % j == 0){
					int k = ni / j;
					int sum = i + j + k;
					int area = i * j + i * k + j * k;
					if (sum < bestSum || (sum == bestSum && area < cArea)) {
						bestSum = sum;
						cArea = area;
					}
					if (area < bestArea) {
						bestArea = area;
					}
				}
			}
			if (cArea > bestArea) {
				System.out.println(n);
			}
		}
	}

	public static void main(String[] args) {
		new Thread(new Stresser()).start();
	}
}
