import sys
s, c = input().split()
csz = len(c)
ssz = len(s)
asz = (csz + ssz)//2
for sz in range(asz-2, asz+3):
    if sz < 0 or sz > ssz:
        continue
    a = 0
    for i in range(sz):
        a = 10*a + int(ord(s[i]) - ord('0'))
    b = 0
    for i in range(sz, len(s)):
        b = 10*b + int(ord(s[i]) - ord('0'))
    if a%b == 0 and a//b == int(c):
        print(f"{a} {b}")
        sys.exit(0)