//08
#include<iostream>
#include<cmath>

using namespace std;

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

int main(){
  for(int p,n;cin>>p>>n,p|n;){
    double a,b,c,d;
    double sp=sqrt(p);
    bool l=false,h=false;
    for(double i=1;i<=n;i++){
      for(double j=max(int(i/sp),1);j<=min(n,int(i/sp+1));j++){
	if(gcd(i,j)==1){
	  if(i/j<sp){
	    if(!l||i/j>a/b){
	      a=i;
	      b=j;
	      l=true;
	    }
	  }else{
	    if(!h||i/j<c/d){
	      c=i;
	      d=j;
	      h=true;
	    }
	  }
	}
      }
    }
    cout<<c<<'/'<<d<<' '<<a<<'/'<<b<<endl;
  }
  return 0;
}