#include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)


int g(int a,int b){

	int r=max(a,b)%min(a,b);
	if(r==0)  return min(a,b);
	else return g(min(a,b),r);
}

int main(){

	int p,n;
	while(true){

		cin >> p >> n;
		if(p==0 && n==0) break;

		int s1,s2,t1,t2;
		double d1=10000; double d2=10000;


		REP(i,1,n){

		int j=floor(i*sqrt((double)p));

		if(j<=n){
		if(d1>-(double)j/i+sqrt((double)p) && -(double)j/i+sqrt((double)p)>0){

		d1=-(double)j/i+sqrt((double)p);
		t1=i; t2=j;
					}
					}

		int k=ceil(i*sqrt((double)p));

		if(k<=n){
		if(d2>(double)k/i-sqrt((double)p) && (double)k/i-sqrt((double)p)>0){

		d2=(double)k/i-sqrt((double)p);
		s1=i; s2=k;
					}
					}

		}


		int g1=g(s1,s2);
		int g2=g(t1,t2);


		cout << s2/g1 << "/" << s1/g1 << " " << t2/g2 << "/" << t1/g2 << endl;

        s1=0; s2=0; t1=0; t2=0;

	}

	return 0;
}