// AOJ 1208: Rational Irrationals
// 2017.10.14 bal4u@uu

#include <stdio.h>

int n, p;
long long x, y, u, v;

void SternBrocot(long long pl, long long ql, long long pr, long long qr)
{
	long long pm, qm;

	pm = pl + pr, qm = ql + qr;
    if (pm > n || qm > n) return;
    if (p * qm * qm < pm * pm) {
        x = pm, y = qm;
        SternBrocot(pl, ql, pm, qm);
    } else if (p * qm * qm > pm * pm) {
        u = pm, v = qm;
        SternBrocot(pm, qm, pr, qr);
    } else x = u = pm, y = v = qm;
}

int main()
{
	while (scanf("%d%d", &p, &n) && p > 0) {
        SternBrocot(0, 1, 1, 0);
        printf("%lld/%lld %lld/%lld\n", x, y, u, v);
    }
    return 0;
}