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

public class bacteria_av implements Runnable {
	public static void main(String[] args) {
		new Thread(new bacteria_av()).start();
	}

	BufferedReader br;

	StringTokenizer in;

	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}

		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		
		HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
		int[] pown = new int[1000];
		int[] powm = new int[1000];
		int[] primes = new int[1000];
		
		int t = 0;
		for (int i = 2; i <= Math.sqrt(n); i++) {
			if (n % i == 0){
				hm.put(i, t);
				primes[t] = i;
				int z = 0;
				while (n % i == 0){
					z++;
					n /= i;
				}
				pown[t] = z;
				t++;
			}
		}
		
		if (n > 1){
			hm.put(n, t);
			primes[t] = n;
			pown[t] = 1;
			t++;
		}
		
		int plen = t;
		
		for (int i = 2; i <= Math.sqrt(m); i++) {
			if (m % i == 0){
				if (!hm.containsKey(i)){
					out.println("Impossible");
					return;
				}
				t = hm.get(i);
				int z = 0;
				while (m % i == 0){
					z++;
					m /= i;
				}
				powm[t] = z;
			}
		}
		
		if (m > 1){
			if (!hm.containsKey(m)){
				out.println("Impossible");
				return;
			}
			t = hm.get(m);
			powm[t] = 1;
		}
		
		int ans = Integer.MAX_VALUE;
		int[] answer = new int[1000000];
		int len = 0;
		t = 0;
		int ma = 0;
		int la = 0;
		while (ans > t){
			int z = 0;
				int mz = 1;
			for (int i = 0; i < plen; i++) {
				if (powm[i] > pown[i]){
					z = -1;
					break;
				}
				
				mz *= Math.pow(primes[i], powm[i]);
				
				z += pown[i] - powm[i];
			}
			
			if (z + t > ans)
				break;
			
			if (z != -1){
				ans = (z + t);
				ma = mz;
				la = len;
			}
			
			for (int i = 0; i < plen; i++) {
				if (powm[i] % 2 == 1){
					answer[len] = primes[i];
					len++;
				}
				
				t += powm[i] % 2;
				powm[i] = (powm[i] + 1) / 2;
			}
			answer[len] = 0;
			len++;
			
			t++;
		}
		
		len = la;
		
		for (int i = 0; i < plen; i++) {
			powm[i] = 0;
			while (ma % primes[i] == 0){
				powm[i]++;
				ma /= primes[i];
			}
			
			for (int j = 0; j < pown[i] - powm[i]; j++) {
				answer[len] = primes[i];
				len++;
			}
		}		
		
		for (int i = len - 1; i >= 0; i--) {
			out.print(answer[i] + " ");
		}
	}

	public void run() {
		try {
			br = new BufferedReader(new FileReader("bacteria.in"));
			out = new PrintWriter("bacteria.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
