#include <stdio.h>

#define SQ( X ) \
  ( (X) * (X) )

static int
gcd (
  int a,
  int b
  )
{
  do
  {
    const int t = a;
    a = b % a;
    b = t;
  }
  while ( a );

  return ( b );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    int li = 0,     lj = 1
      , ui = 10000, uj = 1;
    int p, n;

    scanf ( "%d%d", &p, &n );
    if ( !( p | n ) ) break ;

    for ( i = 1; i <= n; ++i )
    for ( j = 1; j <= n; ++j )
    {
      const int d = SQ( i ) - p * SQ( j );

      if ( gcd ( i, j ) != 1 )  continue ;

      if ( d < 0 && i * lj > li * j )
        { li = i; lj = j; }
      if ( d > 0 && i * uj < ui * j )
        { ui = i; uj = j; }
    }

    printf ( "%d/%d %d/%d\n", ui, uj, li, lj );
  }

  return ( 0 );
}