#include <iostream>
#include <cmath>
using namespace std;

int p;
int up,uq,dp,dq;

void sternBrocot(int n,int pl=0,int ql=1,int pr=1,int qr=0) {
    int pm = pl + pr,qm = ql + qr;
    if(pm > n || qm > n) return;

    if(pm > sqrt(p)*qm) {
        if(up*qm - pm*uq > 0) {
            up = pm, uq = qm;
        }
        sternBrocot(n, pl, ql, pm, qm);
    }else{
        if(pm*dq - dp*qm > 0) {
            dp = pm, dq = qm;
        }
        sternBrocot(n, pm, qm, pr, qr);
    }
}

int main() {
    int n;
    while(cin>>p>>n, p|n) {
        up = p, uq = 1, dp = 0, dq = 1;
        sternBrocot(n);

        cout<<up<<"/"<<uq<<" "<<dp<<"/"<<dq<<endl;
    }
}