loop do
  p, n = gets.split.map(&:to_i)
  break if n == 0
  p = Math.sqrt(p)
  up = (1..n).reduce([n, 1]) do |(x, y), i|
    j = (p * i).ceil
    break [x, y] if j > n
    (x.to_f / y - p) > (j.to_f / i - p) && j * y != i * x ? [j, i] : [x, y]
  end
  low = (1..n).reduce([1, n]) do |(x, y), i|
    j = (p * i).floor
    break [x, y] if j > n
    (p - x.to_f / y) > (p - j.to_f / i) && j * y != i * x ? [j, i] : [x, y]
  end
  puts "#{up[0]}/#{up[1]} #{low[0]}/#{low[1]}"
end