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

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}

int near(int p, int n)
{
	int base=(int)(sqrt(p)*n)-1;
	for(int i=0; i<=2; i++)
	{
		if(1.0*(base+i)/n > sqrt(p)) return base+i-1;
	}
	
	return base+2;
}

int main()
{
	int p,n;
	while(scanf("%d%d", &p,&n), (p||n))
	{
		int sn=0,sd=1,ln=9999,ld=1;
		
		for(int i=1; i<=n; i++)
		{
			int nume=near(p,i);
			if(nume>n) nume=n;
			if(1.0*sn/sd < 1.0*nume/i)
			{
				sn=nume;
				sd=i;
			}
			
			if(nume>=n) nume--;
			if(1.0*(nume+1)/i < sqrt(p)) continue;
			if(1.0*ln/ld > 1.0*(nume+1)/i)
			{
				ln=nume+1;
				ld=i;
			}
		}
		
		int com=gcd(ln,ld);
		ln/=com; ld/=com;
		
		com=gcd(sn,sd);
		sn/=com; sd/=com;
		
		printf("%d/%d %d/%d\n", ln,ld,sn,sd);
	}
}