Buggy python submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


class Prime():
    def __init__(self, n):
        self.M = m = int(math.sqrt(n)) + 10
        self.A = a = [True] * m
        a[0] = a[1] = False
        self.T = t = []
        for i in range(2, m):
            if not a[i]:
                continue
            t.append(i)
            for j in range(i*i,m,i):
                a[j] = False

    def is_prime(self, n):
        return self.A[n]

def main():
    rr = []
    pr = Prime(100000**2)
    tl = len(pr.T)

    while True:
        n,a,b = LI()
        if n == 0:
            break
        m = fractions.Fraction(a,b)
        sn = n ** 0.5
        r = 0
        rs = ''
        for ni in range(tl):
            i = pr.T[ni]
            if i > sn:
                break
            for nj in range(ni,tl):
                j = pr.T[nj]
                if i*j > n:
                    break
                if i*j <= r:
                    continue
                if fractions.Fraction(i,j) < m:
                    continue
                r = i*j
                rs = '{} {}'.format(i,j)

        rr.append(rs)

    return '\n'.join(map(str, rr))


print(main())




Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


class Prime():
    def __init__(self, n):
        self.M = m = int(math.sqrt(n)) + 10
        self.A = a = [True] * m
        a[0] = a[1] = False
        self.T = t = []
        for i in range(2, m):
            if not a[i]:
                continue
            t.append(i)
            for j in range(i*i,m,i):
                a[j] = False

    def is_prime(self, n):
        return self.A[n]

def main():
    rr = []
    pr = Prime(100000**2)
    tl = len(pr.T)

    while True:
        n,a,b = LI()
        if n == 0:
            break
        m = fractions.Fraction(a,b)
        sn = n ** 0.5
        r = 0
        rs = ''
        for ni in range(tl):
            i = pr.T[ni]
            if i > sn:
                break
            j = min(n // i, int(i/m)+1)
            if j < i:
                continue
            while not pr.is_prime(j):
                j -= 1
            ji = pr.T.index(j)
            while fractions.Fraction(i,pr.T[ji]) < m:
                ji -= 1
            j = pr.T[ji]
            if i*j <= r:
                continue
            r = i*j
            rs = '{} {}'.format(i,j)

        rr.append(rs)

    return '\n'.join(map(str, rr))


print(main())