// Arup Guha
// 11/13/2012
// Solution to 2012 Division 2 South East Regional Problem C: Do it Wrong, Get it Right

import java.util.*;

public class c {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		// Go through the input.
		long b = stdin.nextLong();
		long n = stdin.nextLong();

		while (n != 0) {

			ArrayList<frac> ans = new ArrayList<frac>();

			// We can prove that these are the only values of m we need to try, otherwise
			// divisibility is impossible to achieve an integral a.
			for (long m=n/gcd(b,n); m<=2*n; m=m+n/gcd(b,n)) {

				if (m == n) continue;

				// We only get a valid fraction if the value stated is divisible by n^2.
				if ((b*(m-n)*(m-n))%(n*n) == 0) {
					long a = b - b*(m-n)*(m-n)/n/n;
					ans.add(new frac(a,m));
				}
			}

			// We can just sort and output.
			Collections.sort(ans);
			for (int i=0; i<ans.size()-1; i++)
				System.out.print(ans.get(i)+" ");
			System.out.println(ans.get(ans.size()-1));

			b = stdin.nextLong();
			n = stdin.nextLong();
		}
	}

	public static long gcd(long x, long y) {

		if (x < 0) x = -x;
		if (y < 0) y = -y;

		if (x == 0) return y;
		if (y == 0) return x;
		return gcd(y, x%y);
	}
}

class frac implements Comparable<frac> {

	public long num;
	public long den;
	public double val;

	public frac(long n, long d) {
		num = n;
		den = d;
		val = (double)n/d;
	}

	// Uses the sorting rules given in the problem for fractions.
	public int compareTo(frac other) {

		// Integer comparisons are fine since I am using long.
		if (num*other.den < other.num*den)
			return -1;
		else if (num*other.den > other.num*den)
			return 1;

		// Tie-breaker for equality of fractions.
		if (den < other.den)
			return -1;
		else if (den > other.den)
			return 1;

		return 0;
	}

	public String toString() {
		return num+"/"+den;
	}
}