import Data.List
import Data.Ord

primes = 2:3:[x | i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
 where isPrime n = null [i | i<-takeWhile (\x -> x*x <= n) primes, rem n i == 0]

main = interact $ unlines . map (show' . ceia . map read . words) . init . lines
 where show' (p,q) = show p ++ " " ++ show q

ceia [m,a,b] = maximumBy (comparing (uncurry (*))) pqs
 where
  pqs = [(p,q) | p<-ds, q<-(takeWhile (\d->d*p<=m) ds), cond p q]
  ds = takeWhile (<= div m 2) primes
  cond p q = let [a',b',p',q'] = map fromIntegral [a,b,p,q] in a'/b' <= p'/q' && p'/q' <= 1.0