Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation $a + 1 = b$ with positive integers $a$ and $b$, but Kolya forgot the numbers $a$ and $b$. He does, however, remember that the first (leftmost) digit of $a$ was $d_a$, and the first (leftmost) digit of $b$ was $d_b$.

Can you reconstruct any equation $a + 1 = b$ that satisfies this property? It may be possible that Kolya misremembers the digits, and there is no suitable equation, in which case report so.


-----Input-----

The only line contains two space-separated digits $d_a$ and $d_b$ ($1 \leq d_a, d_b \leq 9$).


-----Output-----

If there is no equation $a + 1 = b$ with positive integers $a$ and $b$ such that the first digit of $a$ is $d_a$, and the first digit of $b$ is $d_b$, print a single number $-1$.

Otherwise, print any suitable $a$ and $b$ that both are positive and do not exceed $10^9$. It is guaranteed that if a solution exists, there also exists a solution with both numbers not exceeding $10^9$.


-----Examples-----
Input
1 2

Output
199 200

Input
4 4

Output
412 413

Input
5 7

Output
-1

Input
6 2

Output
-1

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
(a, b) = map(int, input().split())
if a - b == 0:
	print('%d1 %d2' % (a, b))
elif b - a == 1:
	print('%d99 %d00' % (a, b))
elif a == 9 and b == 1:
	print('99 100')
else:
	print(-1)


(a, b) = map(int, input().split())
if a - b == 0:
	a1 = int(str(a) + str('12'))
	b1 = int(str(b) + str('13'))
	print(a1, b1)
elif a < b and b - a < 2:
	a1 = int(str(a) + str('99'))
	b1 = int(str(b) + str('00'))
	print(a1, b1)
elif a > b and b == 1 and (a == 9):
	print(a, int(str(b) + str('0')))
else:
	print(-1)


(a, b) = list(input().split())
if int(b) - int(a) == 1:
	print(a + '9', b + '0')
elif a == '9' and b == '1':
	print(a + '9', b + '00')
elif a == b:
	print(a + '1', b + '2')
else:
	print(-1)


(da, db) = map(int, input().split())
if da + 1 == db:
	print(da, db)
elif da == db:
	print(da, 0, ' ', db, 1, sep='')
elif da == 9 and db == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(a * 10, b * 10 + 1)
elif a + 1 == b:
	print(a * 10 + 9, b * 10)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(a1, b1) = map(int, input().split())
if a1 == b1:
	print(a1 * 10, b1 * 10 + 1)
elif b1 - 1 == a1:
	print(a1, b1)
elif b1 == 1 and a1 == 9:
	print(9, 10)
elif a1 > b1 or b1 - 1 > a1:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
elif 0 > int(b) - int(a) or int(b) - int(a) >= 2:
	print(-1)
elif int(b) - int(a) == 1:
	print(str(a) + '9', str(b) + '0')
else:
	print(str(a) + '1', str(b) + '2')


l1 = [int(x) for x in input().split()]
a = l1[0]
b = l1[1]
if a == 9:
	if b == 1:
		print(9, 10)
	elif b == 9:
		print(91, 92)
	else:
		print(-1)
elif b == a + 1:
	print(str(a) + '9', str(b) + '0')
elif b == a:
	print(str(b) + '0', str(a) + '1')
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if b - a >= 2 or (b < a and (not (b == 1 and a == 9))):
	print(-1)
else:
	if b == 1 and a == 9:
		print(str(a) + '9 ' + str(b) + '00')
	if b - a == 1:
		print(str(a) + '9 ' + str(b) + '0')
	elif b == a:
		print(str(a) + '1 ' + str(b) + '2')


(da, db) = [int(i) for i in input().split()]
if da == db:
	print(da * 10, da * 10 + 1)
elif da + 1 == db or (da == 9 and db == 1):
	print(da * 10 + 9, da * 10 + 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
elif b - a > 1 or a > b:
	print(-1)
elif a == b:
	print(str(a) + '0', str(b) + '1')
else:
	print(str(a) + '9', str(b) + '0')


(da, db) = map(int, input().split())
if da + 1 == db:
	print(f'{da}99 {db}00')
elif da == db:
	print(f'{da}00 {db}01')
elif da == 9 and db == 1:
	print(f'999 1000')
else:
	print(f'-1')


(n, m) = map(int, input().split())
if n == 9 and m == 1:
	print(99, 100)
elif n - m == 0:
	print(n * 100, n * 100 + 1)
elif m - n == 1:
	print(n * 10 + 9, n * 10 + 10)
else:
	print(-1)


(a, b) = list(map(str, input().split()))
if b == '1' and a == '9':
	print(99, 100)
elif abs(int(a) - int(b)) > 1 or a > b:
	print(-1)
elif a == b:
	print(a + '0', b + '1')
else:
	ans1 = ''
	ans2 = ''
	ans1 += a + '9'
	ans2 += b + '0'
	print(ans1, ans2)


(a, b) = map(int, input().strip().split())
if a == 9 and b == 1:
	print(99, 100)
	exit(0)
if abs(a - b) >= 2:
	print(-1)
	exit(0)
elif a == b:
	a = 100 * a + 23
	print(a, a + 1)
elif a < b:
	a = 100 * a + 99
	print(a, a + 1)
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if b - a > 1:
	print(-1)
elif a == b:
	new = int(str(a) + '00') + 1
	print(str(a) + '00', str(new))
elif a == 9 and b == 1:
	print(9, 10)
elif b < a:
	print(-1)
else:
	print(a, b)


s = list(map(int, input().split()))
if s[0] - s[1] == 0:
	a = s[0] * 10
	b = s[1] * 10 + 1
	print(a, b)
elif s[1] - s[0] == 1:
	a = s[0] * 10 + 9
	b = s[1] * 10
	print(a, b)
elif s[0] == 9 and s[1] == 1:
	a = s[0]
	b = s[1] * 10
	print(a, b)
else:
	print('-1')


(da, db) = map(int, input().split())
if da == db:
	print(da * 10 + 1, db * 10 + 2)
elif da > db:
	if da == 9 and db == 1:
		print(9, 10)
	else:
		print(-1)
elif db - da == 1:
	print(da * 10 + 9, db * 10)
else:
	print(-1)


def forget(a, b):
	temp = b - a
	if 1 >= temp and temp >= 0:
		if a == b:
			a = a * 10
			b = b * 10 + 1
			print(a, b)
			return
		b = b * 10
		a = b - 1
		print(a, b)
		return
	if a - b == 8:
		print(a, b * 10)
		return
	print(-1)
n = list(map(int, input().split(' ')))
forget(n[0], n[1])


(a, b) = map(int, input().split())
if abs(a - b) > 1 and abs(a - b) != 8:
	print(-1)
elif abs(a - b) == 1 and a < b:
	print(a, end='')
	print('9 ', end='')
	print(b, end='')
	print('0')
elif abs(a - b) == 8 and a > b:
	print('99 100')
elif a == b:
	print(b, end='')
	print('1 ', end='')
	print(a, end='')
	print('2')
else:
	print('-1')


n = str(input())
a = int(n[0])
b = int(n[2])
if b - 1 == a:
	print(a, b)
elif b == a:
	print(str(a) + '1', str(b) + '2')
elif b == 1 and a == 9:
	print(9, 10)
else:
	print(-1)


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
elif a > b:
	print(-1)
elif b - a > 1 or a - b > 1:
	print(-1)
elif abs(b - a) == 1:
	print(str(a) + '9', str(b) + '0')
else:
	print(str(a) + '1', str(b) + '2')


(a, b) = map(str, input().split())
f = 0
if int(a) <= int(b) and (int(a) - int(b) == 0 or int(b) - int(a) == 1) or (int(a) == 9 and int(b) == 1):
	for i in ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
		for j in ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
			if int(a + str(i)) - int(b + str(j)) == -1:
				print(a + str(i), b + str(j))
				f = 1
				break
		if f:
			break
if f == 0:
	print(-1)


(a, b) = map(int, input().split())
if a + 1 == b or a == b or (a == 9 and b == 1):
	if a == b:
		print(a * 100 + 12, b * 100 + 13)
	elif a + 1 == b:
		print(a * 100 + 99, b * 100)
	elif a == 9 and b == 1:
		print(a * 10 + 9, b * 100)
else:
	print(-1)


(da, db) = map(int, input().split())
if da == db:
	print(da * 100, db * 100 + 1)
elif da + 1 == db:
	print(da * 100 + 99, db * 100)
elif da == 9 and db == 1:
	print(da, db * 10)
else:
	print(-1)


(da, db) = map(int, input().split())
if da > db and (da != 9 or db != 1) or db - da > 1:
	print(-1)
else:
	if da == db:
		ansa = da * 10
		ansb = db * 10 + 1
	elif da == 9 and db == 1:
		ansa = 99
		ansb = 100
	else:
		ansa = da * 10 + 9
		ansb = db * 10
	print(ansa, ansb)


(a, b) = map(int, input().split())
if a * 100 == b * 100:
	print(a * 100, b * 100 + 1)
elif b * 100 - a * 100 == 100:
	print(b * 100 - 1, b * 100)
elif b * 1000 - a * 100 == 100:
	print(b * 1000 - 1, b * 1000)
else:
	print(-1)


(n, m) = map(int, input().split())
if n == 9 and m == 1:
	print(9, 10)
elif m - n > 1 or n > m:
	print(-1)
elif m - n == 1:
	print(n * 100 + 99, m * 100)
elif m - n == 0:
	print(n * 100 + 12, m * 100 + 13)


import math
(a, b) = map(int, input().split())
if b - a == 1:
	print(str(a) + '9', str(b) + '0')
elif b - a == 0:
	print(str(a) + '3', str(a) + '4')
elif a == 9 and b == 1:
	print(str(a) + '9', str(b) + '00')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(str(99) + ' ' + str(100))
elif abs(a - b) > 1:
	print(str(-1))
elif a == b:
	print(str(a * 10) + ' ' + str(a * 10 + 1))
elif a > b:
	print(str(-1))
else:
	print(str(a * 10 + 9) + ' ' + str(b * 10))


(a, b) = [int(x) for x in input().split()]
if a == 9 and b == 1:
	print(9, 10)
elif a > b:
	print(-1)
elif a == b:
	print(a * 100, a * 100 + 1)
elif b - a == 1:
	print(a * 100 + 99, b * 100)
else:
	print(-1)


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	(a, b) = read_ints()
	if a == b:
		x = 10 * a + 1
		y = x + 1
		print(x, y)
	elif b - a == 1:
		print(a, b)
	elif a == 9 and b == 1:
		print(9, 10)
	else:
		print(-1)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		debug(n, i)
		if n % i == 0:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P

def is_lucky(n):
	return set(list(str(n))).issubset({'4', '7'})
main()


(a, b) = map(int, input().split())
if b > a + 1 and a != 9 and (b != 1):
	print(-1)
elif a + 1 == b:
	print(a * 100 + 99, b * 100)
elif a == 9 and b == 1:
	print(99, 100)
elif a == b:
	print(a * 100, a * 100 + 1)
elif a > b:
	print(-1)


a = list(map(int, input().split()))
if a[1] - a[0] == 1:
	print(str(a[0]) + '9 ' + str(a[1]) + '0')
elif a[1] == a[0]:
	print(str(a[0]) + '1 ' + str(a[1]) + '2')
elif a[1] == 1 and a[0] == 9:
	print('99 100')
else:
	print(-1)


(a, b) = map(int, input().split(' '))
if abs(a - b) == 0:
	print(str(a) + '12', str(b) + '13')
elif b - a == 1:
	print(str(a) + '99', str(b) + '00')
elif a - b == 8:
	print('999', '1000')
else:
	print(-1)


(a, b) = map(int, input().split())
ans_a = str(a)
ans_b = str(b)
if a - b not in [-1, 0] and (a, b) != (9, 1):
	print(-1)
elif a == 9 and b == 1:
	ans_a += '9'
	ans_b += '00'
	print(int(ans_a), int(ans_b))
else:
	if a != b:
		ans_a += '9'
		ans_b += '0'
	else:
		ans_a += '1'
		ans_b += '2'
	print(int(ans_a), int(ans_b))


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
elif a not in range(1, 10) or b not in range(1, 10):
	print(-1)
elif a == b:
	print(a * 10, a * 10 + 1)
elif b - a == 1:
	print(a * 10 + 9, b * 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(str(a), str(b) + '0')
elif a == b:
	print(str(a) + '8', str(b) + '9')
elif b == a + 1:
	print(str(a) + '9', str(b) + '0')
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if a == 9 and b == 1:
	print(9, 10)
elif b - a > 1 or b - a < 0:
	print(-1)
elif b - a == 0:
	print(a * 10, a * 10 + 1)
else:
	print(a * 10 + 9, b * 10)


(da, db) = input().split()
da = int(da)
db = int(db)
if da <= 0 or db > 9:
	print(-1)
if da == 9 and db == 1:
	print(9, 10)
elif da + 1 == db or da == db:
	if da + 1 == db:
		a = da * 10 + 9
		b = a + 1
		print(a, b)
	if da == db:
		a = da * 10 + 1
		b = a + 1
		print(a, b)
else:
	print(-1)


(da, db) = [int(s) for s in input().split()]
flag = 0
if da == db:
	print(da, 1, ' ', db, 2, sep='')
	flag = 1
if da + 1 == db:
	print(da, 9, ' ', db, 0, sep='')
	flag = 1
if db == 1 and da == 9:
	print(da, 9, ' ', db, 0, 0, sep='')
	flag = 1
if flag == 0:
	print(-1)


(da, db) = map(int, input().split())
if da - db != 8 and (da > db or abs(db - da) > 1):
	print('-1')
elif da - db == 8:
	print(str(da), str(db) + '0')
elif db - da:
	print(str(da) + '9', str(db) + '0')
else:
	print(str(da) + '8', str(db) + '9')


(a, b) = map(int, input().split())
if b - a == 1:
	print(str(a) + '9' + '9', str(b) + '0' + '0')
elif a == b:
	print(str(a) + '9' + '8', str(b) + '9' + '9')
elif b + 8 == a:
	print(999, 1000)
else:
	print(-1)


(a, b) = list(map(int, input().split()))
if a == 9 and b == 1:
	print(99, 100)
elif a > b:
	print(-1)
elif b - a > 1:
	print(-1)
elif b - a == 1:
	print(a * 10 + 9, b * 10)
else:
	print(a * 10, a * 10 + 1)


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
(da, db) = read_int_line()
if db == da:
	print(da * 10 + 1, db * 10 + 2)
elif db == da + 1:
	print(da, db)
elif db == 1 and da == 9:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 1:
	print(f'{a}9 {b}0')
elif a == b:
	print(f'{a}1 {b}2')
elif a - b == 8:
	print('99 100')
else:
	print(-1)


C = list(map(int, input().split()))
a = C[0]
b = C[1]
if (b - a < 0 or b - a > 1) and (a != 9 or b != 1):
	print(-1)
elif a == 9 and b == 1:
	print('99 100')
elif a == b:
	print(str(a) + '12', str(b) + '13')
else:
	print(str(a) + '99', str(b) + '00')


sp = [int(i) for i in input().split()]
c = sp[0]
d = sp[1]
flag = 0
for i in range(1000000):
	i1 = int(str(c) + str(i))
	x = i1 + 1
	if int(str(x)[0]) == int(d):
		print(i1, x)
		flag = 1
		break
if flag != 1:
	print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
s1 = str(a)
s2 = str(b)
if a == 9 and b == 1:
	s1 += '99'
	s2 += '000'
	print(s1 + ' ' + s2)
elif a == b:
	s1 += '15'
	s2 += '16'
	print(s1 + ' ' + s2)
elif a + 1 == b:
	s1 += '99'
	s2 += '00'
	print(s1 + ' ' + s2)
else:
	print('-1')


import sys
import math

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')

def printchk(*args):
	return print(*args, end=' \\ ')
MODPRIME = int(1000000000.0 + 7)
BABYMODPR = 998244353
ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	sys.stderr = open('output.txt', 'w')
(da, db) = get_ints()
if da == db:
	print(str(da) + '1', str(db) + '2')
elif da + 1 == db:
	print(str(da) + '9', str(db) + '0')
elif da == 9 and db == 1:
	print('99', '100')
else:
	print(-1)


(da, db) = map(int, input().split())
if da > 0:
	if db - da == 1:
		print(da * 10 + 9, db * 10)
	elif db - da == 0:
		print(da * 10 + 1, db * 10 + 2)
	elif da == 9 and db == 1:
		print(999, 1000)
	else:
		print(-1)


(d1, d2) = list(map(int, input().split()))
if d1 == d2:
	print(d1 * 10, d2 * 10 + 1)
elif d1 == 9 and d2 == 1:
	print(d1 * 100 + 99, d2 * 1000)
elif d2 - d1 == 1:
	print(d1 * 100 + 99, d2 * 100)
else:
	print(-1)


(da, db) = map(int, input().split())
if db - da == 0:
	print(str(da) + '0', str(db) + '1')
elif db - da == 1:
	print(str(da) + '9', str(db) + '0')
elif da == 9 and db == 1:
	print(99, 100)
else:
	print(-1)


l = [int(x) for x in input().split()]
(da, db) = (l[0], l[1])
if da == db:
	print('{0}0 {1}1'.format(da, db))
elif da == db - 1:
	print(da, db, sep=' ')
elif da - db == 8:
	print('9 10')
else:
	print(-1)


(a, b) = [int(x) for x in input().split()]
if a == 9 and b == 1:
	print(9, 10)
elif abs(a - b) > 1 or a > b:
	print(-1)
elif a == b:
	print(str(a) + '12', str(a) + '13')
elif b > a:
	print(str(a) + '99', str(b) + '00')


(da, db) = map(int, input().split())
if da == 9 and db == 1:
	print('99 100')
elif db < da or db - da > 1:
	print(-1)
elif db > da:
	print(da, 9, ' ', db, 0, sep='')
else:
	print(da, '0', ' ', db, '1', sep='')


(a, b) = map(int, input().split())
flag = 0
if a == 9 and b == 1:
	print(9, 10)
	flag = 1
if a + 1 == b:
	print(a, b)
	flag = 1
k = b - a
if flag != 1:
	if k == 0:
		print(a, end='')
		print(1, end=' ')
		print(b, end='')
		print(2)
	else:
		print(-1)


(a, b) = [int(x) for x in input().split()]
if b - a == 1:
	print(str(a) + '9', str(b) + '0')
elif b - a == 0:
	print(str(a) + '1', str(b) + '2')
elif a == 9 and b == 1:
	print('99', '100')
else:
	print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
if a == 9 and b == 1:
	print('9 10')
elif a > b:
	print('-1')
elif b - a > 1:
	print('-1')
elif b - a == 1:
	print(str(a) + '9', str(b) + '0')
elif a == b:
	print(str(a) + '1', str(b) + '2')


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
	exit()
z = b - a
if z == 1:
	x1 = str(a) + '9'
	x2 = str(b) + '0'
	print(x1, x2)
elif z == 0:
	x1 = str(a) + '1'
	x2 = str(a) + '2'
	print(x1, x2)
else:
	print(-1)


string = input()
a = int(string.split(' ')[0])
b = int(string.split(' ')[1])
counter = 1
while True:
	if a == 0:
		print(-1)
		quit()
	if a == b:
		print(str(a), '00 ', str(b), '01', sep='')
		quit()
	elif a == 9 and b == 1:
		print(str(a), '99 ', str(b), '000', sep='')
		quit()
	elif a == b - 1:
		print(str(a), '99 ', str(b), '00', sep='')
		quit()
	else:
		print(-1)
		quit()


(d_a, d_b) = map(int, input().split())
if (d_a - d_b > 0 or d_b - d_a > 1) and d_a != 9 and (d_b != 1):
	print(-1)
elif d_a == d_b:
	print(str(d_a) + str(1), str(d_b) + str(2))
elif d_a == 9 and d_b == 1:
	print(str(d_a), str(d_b) + str(0))
elif d_a - d_b > 0:
	print(-1)
else:
	print(str(d_a) + str(9), str(d_b) + str(0))


(Da, Db) = map(int, input().split())
l1 = len(str(Da))
l2 = len(str(Db))
if Da == 0 and Db == 1:
	print(0, 1)
elif Da == 9 and Db == 1:
	print(9, 10)
elif Db - Da == 1:
	a = str(Da) + '99'
	b = str(Db) + '00'
	print(a, b)
elif Db - Da >= 2:
	print(-1)
elif Da > Db:
	print(-1)
elif Da == 0 and Db == 0:
	print(-1)
elif Da == Db and Da != 0 or Db != 0:
	a = str(Da) + '12'
	b = str(Db) + '13'
	print(a, b)


(a, b) = (int(i) for i in input().split())
if a == b:
	print(a * 10 + 1, b * 10 + 2)
elif a == b - 1:
	print(a, b)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print('-1')


import random
a = list(map(int, input().split()))
if a[0] + 1 == a[1]:
	a[0] = a[0] * 100 + 99
	a[1] *= 100
	print(*a)
elif a[0] == a[1]:
	a[0] = a[0] * 100 + random.randint(1, 99)
	a[1] = a[0] + 1
	print(*a)
elif (a[0] + 1) // 10 == a[1]:
	a[0] = 99
	a[1] *= 100
	print(*a)
else:
	print(-1)


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
(x, y) = mi()
if x == y:
	print(x, end='')
	print('1', end=' ')
	print(y, end='')
	print('2')
elif y - x == 1:
	print(x, end='')
	print('9', end=' ')
	print(y, end='')
	print('0')
elif x == 9 and y == 1:
	print(x, end='')
	print('9', end=' ')
	print(y, end='')
	print('00')
else:
	print('-1')


import math
import random
(a, b) = map(int, input().split())
if a > b and (a != 9 and b != 1):
	print(-1)
elif a == b - 1 and (a != 9 and b != 1):
	print(a * 10 + 9, b * 10)
elif a == 9 and b == 1:
	print(99, 100)
elif a == b:
	x = random.randrange(1, 8)
	print(10 * a + x, 10 * a + x + 1)
else:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 1:
	print(str(a) + '99', str(b) + '00')
elif b - a == 0:
	print(str(a) + '12', str(b) + '13')
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	a = a * 100 + 10
	b = a + 1
	print(a, b)
elif a - b == -1:
	b = b * 100
	a = b - 1
	print(a, b)
elif a - b == 8:
	print(999, 1000)
else:
	print(-1)


(a, b) = input().split()
(a, b) = (int(a), int(b))
if a + 1 == b * 10:
	print(a, a + 1)
elif b - a > 1 or b - a < 0:
	print(-1)
elif b - a == 0:
	print(a * 10, b * 10 + 1)
elif b - a == 1:
	print(a * 10 + 9, b * 10)


(d1, d2) = input().split()
d1 = int(d1)
d2 = int(d2)
a = 0
b = 0
c = 0
if d2 - d1 == 1:
	a = d1 * 10 + 9
	b = d2 * 10
	print(a, b)
if d2 == d1:
	a = d1 * 10
	b = d2 * 10 + 1
	print(a, b)
if d1 == 9 and d2 == 1:
	a = d1 * 10 + 9
	b = d2 * 100
	c += 1
	print(a, b)
if (d2 - d1 > 1 or d2 - d1 < 0) and c == 0:
	print(-1)


a = input().split()
a[1] = int(a[1])
a[0] = int(a[0])
if a[1] == a[0]:
	print(str(a[0]) + '7', str(a[1]) + '8')
elif a[0] + 1 == a[1]:
	print(str(a[0]) + '9', str(a[1]) + '0')
elif a[0] == 9 and a[1] == 1:
	print(str(a[0]) + '9', str(a[1]) + '00')
else:
	print(-1)


st = input()
aa = st[0]
bb = st[2]
if int(bb) - int(aa) == 1:
	print(aa + '9 ' + bb + '0')
elif int(bb) == int(aa):
	print(aa + '1 ' + bb + '2')
elif int(aa) == 9 and int(bb) == 1:
	print(aa + ' ' + bb + '0')
else:
	print('-1')


(a, b) = list(map(int, input().split()))
if a == b:
	print(a, end='')
	print(0, end=' ')
	print(b, end='')
	print(1, end=' ')
elif a + 1 == b:
	print(a, end='')
	print(9, end=' ')
	print(b, end='')
	print(0, end=' ')
elif a == 9 and b == 1:
	print('99 100')
else:
	print(-1)


(n, m) = list(map(int, input().split()))
if n == m - 1:
	print(n, m)
elif n == m:
	print(n * 10, n * 10 + 1)
elif n == 9 and m == 1:
	print(9, 10)
else:
	print(-1)


import random
(a, b) = map(int, input().split())
if a - b == -1 or (a == 9 and b == 1):
	b = b * 10
	print(b - 1, b)
elif a == b:
	temp = str(a) + str(random.randrange(0, 9))
	b = int(temp) + 1
	print(temp, end=' ')
	print(b)
else:
	print('-1')


(a, b) = input().split(' ')
a = int(a)
b = int(b)
if b - a < 0 and b - a != -8:
	print(-1)
elif b - a > 1:
	print(-1)
elif b - a == 0:
	b = b * 100 + 4
	a = b - 1
	print(str(a) + ' ' + str(b))
elif b - a == 1:
	b = b * 100
	a = b - 1
	print(str(a) + ' ' + str(b))
elif a == 9 and b == 1:
	print('9 10')


(n, m) = map(int, input().split())
if n >= 10 or m >= 10:
	print(-1)
elif n == m:
	print(n * 10 + 1, m * 10 + 2)
elif m == n + 1:
	print(n * 10 + 9, m * 10)
elif n == 9 and m == 1:
	print(99, 100)
else:
	print(-1)


(da, db) = [int(i) for i in input().split()]
if da == db:
	print(da * 10 + 1, da * 10 + 2)
elif da + 1 == db:
	print(da * 10 + 9, db * 10)
elif da == 9 and db == 1:
	print(99, 100)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
	exit()
if 0 <= b - a < 2:
	if b - a == 0:
		print(a * 10, b * 10 + 1)
	else:
		print(a, b)
else:
	print(-1)


(x, y) = map(int, input().split())
if x == 9 and y == 1:
	print(9, 10)
elif abs(x - y) > 1 or x > y:
	exit(print(-1))
else:
	print(str(x) + '99 ' + str(y * 100) if x != y else str(x) + '12 ' + str(y) + '13')


(n, k) = map(int, input().split())
if n == 9 and k == 1:
	print(n, 10)
elif k - n == 1 or k - n == 0:
	n = str(n)
	k = str(k)
	if n != k:
		print(n + '9', k + '0')
	else:
		print(n + '1' + '0', k + '1' + '1')
else:
	print('-1')


(da, db) = map(int, input().split())
if db - da == 0:
	print(da, 12, ' ', db, 13, sep='')
elif db - da == 1:
	print(da, 99, ' ', db, '00', sep='')
elif da == 9 and db == 1:
	print(999, 1000)
else:
	print(-1)


(da, db) = map(int, input().split())
if db - da == 1:
	print(db * 100 - 1, db * 100)
elif db - da == 0:
	print(db * 10, db * 10 + 1)
elif da - db == 8:
	print(da, db * 10)
else:
	print(-1)


import sys
import math
(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
elif a == b:
	print(a * 10, b * 10 + 1)
elif a - b == -1:
	print(a * 10 + 9, b * 10)
else:
	print(-1)


(a, b) = [int(x) for x in input().split()]
res = 0
if abs(a - b) > 1 or a > b:
	if a == 9 and b == 1:
		print(f'{a}99 {b}000')
		exit()
	res = -1
if res != -1:
	if a == b:
		print(f'{a}12 {b}13')
	else:
		print(f'{a}99 {b}00')
else:
	print(res)


def solve(da, db):
	if da == 9 and db == 1:
		return (9, 10)
	if da > db or abs(da - db) > 1:
		return [-1]
	if da == db:
		return (10 * da, 10 * db + 1)
	return (da, db)
(da, db) = map(int, input().split())
print(*solve(da, db))


d = [int(x) for x in input().split(' ')]
if d[0] == d[1]:
	print(str(d[0]) + '0', str(d[1]) + '1')
elif d[1] - d[0] == 1:
	print(d[0], d[1])
elif d == [9, 1]:
	print(9, 10)
else:
	print(-1)


(x, y) = map(int, input().split())
if x == 9 and y == 1:
	print(9, 10)
elif x > y or abs(x - y) > 1:
	print(-1)
elif x == y:
	print(x * 10, y * 10 + 1)
else:
	print(x * 10 + 9, y * 10)


(d0, d1) = map(int, input().split())
if d0 == d1:
	print(d0 * 100, d1 * 100 + 1)
elif d0 == d1 - 1:
	print(d0 * 100 + 99, d1 * 100)
elif d0 == 9 and d1 == 1:
	print('9 10')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(str(a) + '0', str(b) + '1')
elif b - a == 1:
	print(str(a) + '9', str(b) + '0')
elif a - b == 8:
	print(99, 100)
else:
	print(-1)


a = input().split()
if a[0] == a[1]:
	print(a[0] + '3', a[0] + '4')
elif int(a[0]) + 1 == int(a[1]):
	print(a[0] + '9', a[1] + '0')
elif int(a[0]) == 9 and int(a[1]) == 1:
	print(a[0] + '9', a[1] + '00')
else:
	print(-1)


(a0, b0) = map(int, input().split())
if a0 + 1 == b0:
	print(str(a0) + '9', str(b0) + '0')
elif a0 == b0:
	print(str(a0) + '1', str(b0) + '2')
elif b0 > a0 + 1:
	print(-1)
elif a0 == 9 and b0 == 1:
	print(9, 10)
else:
	print(-1)


s = input().split()
da = int(s[0])
db = int(s[1])
if da + 1 == db:
	print(da, db)
elif da == 9 and db == 1:
	print(9, 10)
elif da == db:
	print(da * 10, db * 10 + 1)
else:
	print(-1)


(l, r) = map(int, input().split())
if l == r:
	print(l, '0', ' ', r, 1, sep='')
elif l < r and r - l == 1:
	print(l, '9', ' ', r, '0', sep='')
elif l == 9 and r == 1:
	print(l, '9', ' ', '100', sep='')
else:
	print(-1)


(a, b) = list(map(int, input().split()))
if b - a == 1:
	print('{0}99 {1}00'.format(a, b))
elif b - a == 0:
	print('{0}98 {1}99'.format(a, b))
elif a == 9 and b == 1:
	print('99 100')
else:
	print(-1)


(da, db) = input().split()
da = int(da)
db = int(db)
if da > db:
	if da == 9 and db == 1:
		print(9, 10)
	else:
		print(-1)
elif da == db:
	a = int(str(da) + str(1))
	print(a, a + 1)
elif db - da == 1:
	a = int(str(da) + str(9))
	print(a, a + 1)
else:
	print(-1)


nums = input().split()
if nums[1] == nums[0]:
	print(nums[1] + '0', nums[1] + '1')
elif nums[0] == '9' and nums[1] == '1':
	print(99, 100)
elif abs(int(nums[0]) - int(nums[1])) == 1:
	if int(nums[0]) > int(nums[1]):
		print(-1)
	else:
		print(nums[0] + '9', nums[1] + '0')
else:
	print(-1)


(a, b) = map(int, input().split())
if b == 1 and a == 9:
	print(99, 100)
	exit()
b = b * 10
s = b - 1
if s // 10 == a:
	print(s, b)
else:
	b = b // 10
	if a == b:
		print(a * 10, b * 10 + 1)
	else:
		print(-1)


values = input().split()
(a, b) = (int(values[0]), int(values[1]))
if a == b:
	print(a * 10, b * 10 + 1)
elif a + 1 == b:
	print(a * 10 + 9, b * 10)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
if a == b:
	print(str(a) + '0 ' + str(b) + '1')
elif a == 9:
	if b == 1:
		print('9 10')
	else:
		print(-1)
elif a + 1 == b:
	print(str(a) + ' ' + str(b))
else:
	print(-1)


def distance(a, b):
	if a == 9 and b == 1:
		return ('9', '10')
	elif abs(a - b) > 1 or a > b:
		return -1
	elif abs(a - b) == 1:
		return (str(a) + '9', str(b) + '0')
	return (str(a) + '0', str(b) + '1')
(a, b) = map(int, input().split())
try:
	for n in distance(a, b):
		print(n, end=' ')
except:
	print(-1)


(da, db) = map(int, input().split())
if da == db:
	print(da, '1', ' ', db, '2', sep='')
elif da + 1 == db:
	print(da, '9', ' ', db, '0', sep='')
elif da == 9 and db == 1:
	print(da, '9', ' ', db, '00', sep='')
else:
	print(-1)


(a, b) = input().split()
(a, b) = (int(a), int(b))
if a == 9 and b == 1:
	print(9, 10)
elif a > b or abs(a - b) > 1 or (a == 0 and a == b):
	print(-1)
elif a == b:
	print(10 * a, 10 * a + 1)
else:
	print(a, b)


(a, b) = [int(x) for x in input().split()]
if b == a:
	print(a, 0, sep='', end=' ')
	print(a, 1, sep='', end='')
elif b - a == 1:
	print(a, b, end='')
elif a == 9 and b == 1:
	print(9, 10, end='')
else:
	print(-1)


def solve(a, b):
	for c in range(10):
		d = a + str(c)
		e = str(int(d) + 1)
		if e[0] == b:
			return (d, e)
	return [-1]
(a, b) = input().split()
print(*solve(a, b))


from random import randrange
(a, b) = [int(i) for i in input().split()]
if a == 9 and b == 1:
	print('9 10')
elif abs(b - a) <= 1 and b >= a:
	if b - a == 1:
		print(b * 100 - 1, b * 100, sep=' ')
	else:
		b = randrange(a * 100, a * 100 + 99)
		print(b, b + 1)
else:
	print('-1')


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(max(a, b), min(a, b) * 10)
elif a > b:
	print(-1)
	exit()
elif max(a, b) == min(a, b):
	print(a * 100 + 12, b * 100 + 13)
elif max(a, b) == min(a, b) + 1:
	print(min(a, b) * 100 + 99, max(a, b) * 100)
else:
	print(-1)


import math
(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
	exit()
if math.fabs(a - b) > 1 or a > b:
	print(-1)
elif a == b:
	print(a * 10, b * 10 + 1)
elif a + 1 == b:
	print((a + 1) * 10 - 1, b * 10)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
elif a == b:
	print(a, '1 ', b, '2', sep='')
elif a == b - 1:
	print(a, '9 ', b, '0', sep='')
else:
	print(-1)


(a, b) = map(int, input().split())
s = str()
s1 = str()
if a == 9 and b == 1:
	print(99, 100)
elif abs(a - b) > 1:
	print(-1)
elif a <= b:
	if a == b:
		s = str(a) + '0'
		s1 = str(b) + '1'
		print(s, s1)
	else:
		s += str(a) + '9'
		s1 += str(b) + '0'
		print(s, s1)
else:
	print(-1)


(d1, d2) = [int(x) for x in input().split()]
if d2 == d1 + 1:
	print(d1, d2)
elif d1 == d2:
	print(10 * d1, 10 * d2 + 1)
elif d1 == 9 and d2 == 1:
	print(99, 100)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(a, a + 1)
elif abs(b - a) >= 2 or a > b:
	print(-1)
else:
	if a == b:
		a = a * 10
		b = a + 1
	else:
		a = a * 10 + 9
		b = a + 1
	print(a, b)


import sys, math
from collections import defaultdict

def get_ints():
	return map(str, I().split())

def get_list():
	return list(map(int, I().split()))

def I():
	return sys.stdin.readline()
(a, b) = get_ints()
if int(b) - int(a) == 1:
	print(a + '9', b + '0')
elif a == '9' and b == '1':
	print(a + '9', b + '00')
elif a == b:
	print(a + '1', b + '2')
else:
	print(-1)


(a, b) = map(int, input().split())
ans = [[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, (10, 11), (1, 2), -1, -1, -1, -1, -1, -1, -1], [-1, -1, (20, 21), (2, 3), -1, -1, -1, -1, -1, -1], [-1, -1, -1, (30, 31), (3, 4), -1, -1, -1, -1, -1], [-1, -1, -1, -1, (40, 41), (4, 5), -1, -1, -1, -1], [-1, -1, -1, -1, -1, (50, 51), (5, 6), -1, -1, -1], [-1, -1, -1, -1, -1, -1, (60, 61), (6, 7), -1, -1], [-1, -1, -1, -1, -1, -1, -1, (70, 71), (7, 8), -1], [-1, -1, -1, -1, -1, -1, -1, -1, (80, 81), (8, 9)], [-1, (9, 10), -1, -1, -1, -1, -1, -1, -1, (90, 91)]]
answer = ans[a][b]
if type(answer) is type(tuple()):
	print(*answer)
else:
	print(answer)


(da, db) = map(int, input().split())
if 0 <= db - da <= 1 or da - db == 8:
	if db == da:
		print(da, 1, sep='', end=' ')
		print(db, 2, sep='')
	elif da - db == 8:
		print(da, end=' ')
		print(db, 0, sep='')
	else:
		print(da, 9, sep='', end=' ')
		print(db, 0, sep='')
else:
	print(-1)


(n, m) = [int(i) for i in input().split()]
if n == 9 and m == 1:
	print(99, 100)
	quit()
if not m - n == 1 and (not m - n == 0):
	print(-1)
elif n == m:
	print(int(str(n) + '0'), int(str(m) + '1'))
else:
	print(int(str(n) + '9'), int(str(m) + '0'))


a = input().split(' ')
n = int(a[0])
m = int(a[1])
if m == 1 and n == 9:
	print(9, 10)
elif m < n or m > n + 1:
	print(-1)
elif m == n:
	print(m * 10, n * 10 + 1)
else:
	print(m * 10 - 1, m * 10)


(dA, dB) = [int(i) for i in input().split()]
if dA == 9 and dB == 1:
	res = '9 10'
elif abs(dB - dA) > 1:
	res = -1
elif dB == dA:
	A = dA * 10
	B = dB * 10 + 1
	res = str(A) + ' ' + str(B)
elif dB > dA:
	B = dB * 10
	A = dA * 10 + 9
	res = str(A) + ' ' + str(B)
else:
	res = -1
print(res)


(l, r) = map(int, input().split())
if l == r:
	print(l * 10, l * 10 + 1)
elif l + 1 == r:
	print(r * 10 - 1, r * 10)
elif l + 1 == r * 10:
	print(l, r * 10)
else:
	print(-1)


st = input().split(' ')
a = int(st[0])
b = int(st[1])
keep = True
if a == 9:
	if b == 1:
		print('9 10')
		keep = False
if keep:
	if a > b:
		print(-1)
		keep = False
if b - a == 1:
	print(b * 100 - 1, end=' ')
	print(b * 100)
if b == a:
	print(b * 100 + 13, end=' ')
	print(b * 100 + 14)
if (b - a > 1) | (a - b > 1):
	if keep:
		print(-1)


(a, b) = map(int, input().split())
x = a
y = b
if x + 1 == y:
	print(x, y)
elif a == b:
	m = a * 10
	n = b * 10 + 1
	print(m, n)
elif b * 10 - 1 == a:
	print(a, b * 10)
else:
	print('-1')


(a, b) = map(int, input().split())
if a == b or a + 1 == b or (a == 9 and b == 1):
	if a == b:
		print(str(a) + '12' + ' ' + str(b) + '13')
	if a + 1 == b:
		print(str(a) + '99' + ' ' + str(b) + '00')
	if a == 9 and b == 1:
		print(999, 1000)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
	exit(0)
if b - a >= 2 or b < a:
	print(-1)
elif a == b:
	s = str(a) + '0'
	s1 = str(b) + '1'
	print(s, s1)
else:
	print(a, b)


(a, b) = map(int, input().split())
if b - a != 1 and b - a != -8 and (b - a != 0):
	print(-1)
elif b - a == 1:
	print(a * 10 + 9, b * 10)
elif b - a == 0:
	print(a * 10, b * 10 + 1)
else:
	print(99, 100)


(a, b) = input().split()
for i in range(10000):
	if str(i)[0] == a and str(i + 1)[0] == b:
		print(i, i + 1)
		return
print(-1)


(da, db) = map(int, input().split())
if db == da:
	l = [str(10 * da), str(10 * da + 1)]
	print(' '.join(l))
elif db == da + 1:
	l = [str(10 * da + 9), str(10 * db)]
	print(' '.join(l))
elif da == 9 and db == 1:
	print('9 10')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
elif b - 1 > a:
	print(-1)
elif a == b:
	print('{}0 {}1'.format(a, b))
elif b - 1 == a:
	print('{}9 {}0'.format(a, a + 1))
elif a > b:
	print(-1)


(x, y) = map(int, input().strip().split())
if x != 9 and y == x + 1:
	print(x, y)
elif x == y:
	print(x * 10, x * 10 + 1)
elif x == 9 and y == 1:
	print(9, 10)
else:
	print(-1)


def inp_n():
	return int(input())

def inp_list():
	return list(map(int, input().split()))

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False
(a, b) = inp_mul_num()
if b - a == 1:
	print(a, b)
elif b == a:
	b = b * 10 + 1
	print(a * 10, b)
elif a == 9 and b == 1:
	print(a, 10)
else:
	print(-1)


(x, y) = [int(x) for x in input().split()]
if x == y:
	print(str(x) + '0', str(y) + '1')
elif y == x + 1:
	print(str(x) + '9', str(y) + '0')
elif x == 9 and y == 1:
	print(str(x), str(y) + '0')
else:
	print(-1)


from sys import stdin
inp = stdin.readline
(a, b) = [int(x) for x in inp().strip().split()]
if a == 9 and b == 1:
	print(99, 100)
elif abs(a - b) > 1 or a > b:
	print(-1)
elif a == b:
	print(a * 10, b * 10 + 1)
else:
	print(a * 10 + 9, b * 10)


(a, b) = map(int, input().split())
abr = a == b
abb = a + 1 == b
abdo = a == 9 and b == 1
ab = abr or abb or abdo
if ab:
	if abr:
		print(int(str(a) + '0'), int(str(b) + '1'))
	elif abb:
		print(int(str(a) + '9'), int(str(b) + '0'))
	elif abdo:
		print(int(str(a) + '9'), int(str(b) + '00'))
else:
	print(-1)


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(a, b) = int_array()
if a + 1 == b:
	print(a, b)
elif a == 9 and b == 1:
	print(a, 10)
elif a == b:
	a = str(a) + '0'
	b = str(b) + '1'
	print(a, b)
else:
	print(-1)


a = list(map(int, input().split()))
da = a[0]
db = a[1]
check = 1
if da == db:
	a = 100 * da
	b = 100 * db + 1
elif da + 1 == db:
	a = 10 * da + 9
	b = 10 * db
elif da == 9 and db == 1:
	a = 99
	b = 100
else:
	check = 0
if check == 0:
	print(-1)
else:
	print(a, b)


(num1, num2) = [int(i) for i in input().split()]
if num2 - num1 == 1:
	print(str(num1) + ' ' + str(num2))
elif num1 == num2:
	print(str(num1) + '1' + ' ' + str(num2) + '2')
elif num1 == 9 and num2 == 1:
	print('99' + ' ' + '100')
else:
	print(-1)


(da, db) = map(int, input().split())
if da - db == -1:
	print(str(da) + '9' + ' ' + str(db) + '0')
if not abs(da - db):
	print(str(da) + '0' + ' ' + str(db) + '1')
if abs(da - db) > 1 or da - db > 0:
	print(-1 if [da, db] != [9, 1] else '9 10')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
(a, b) = get_int_list()
if a == b - 1:
	print(int(str(a) + '99'), int(str(b) + '00'))
elif a == b:
	print(int(str(a) + '12'), int(str(b) + '13'))
elif a == 9 and b == 1:
	print(int(str(a)), int(str(b) + '0'))
else:
	print(-1)


c = map(int, input().split(' '))
c = list(c)
da = c[0]
db = c[1]
if da == db:
	print(str(da) + '0' + ' ' + str(db) + '1')
elif da == db - 1:
	print(str(da) + '9' + ' ' + str(db) + '0')
elif da == 9 and db == 1:
	print(str(da) + '9' + ' ' + str(db) + '00')
else:
	print('-1')


import os, sys, atexit
import collections
from io import BytesIO, StringIO
input = sys.stdin.readline
(a, b) = map(int, input().strip().split())
if a == 9 and b == 1:
	print(9, 10)
elif b - a > 1 or b < a:
	print(-1)
elif b == a:
	print(a * 10, a * 10 + 1)
else:
	print(a, b)


(a, b) = [int(i) for i in input().split()]
resA = '' + str(a)
resB = '' + str(b)
if a == b or a + 1 == b or (b == 1 and a == 9):
	if a == 9 and b == 1:
		print(99, 100)
	elif a == b:
		print(resA + '0', resB + '1')
	else:
		print(resA + '9', resB + '0')
else:
	print(-1)


firnum = [int(s) for s in input().split()]
a = firnum[0]
b = firnum[1]
if a == 9 and b == 1:
	print(9, 10)
elif a > b:
	print('-1')
elif b - a > 1:
	print('-1')
elif a == b:
	print(a * 10, b * 10 + 1)
else:
	print(a, b)


(a, b) = list(map(int, input().split(' ')))
if a > b or abs(a - b) > 1:
	if a - b == 8:
		print(str(a) + '99', str(b) + '000')
	else:
		print(-1)
elif a + 1 == b:
	print(a, b)
else:
	print(str(a) + '10', str(b) + '11')


(a, b) = map(int, input().split())
if a > b:
	t = len(str(a))
	b = str(b) + '0' * t
	if int(b) - a == 1:
		print(a, b)
	else:
		print(-1)
elif b - a == 1:
	print(str(a) + '9', str(b) + '0')
elif b - a == 0:
	print(str(a) + '8', str(b) + '9')
else:
	print(-1)


a = list(map(int, input().split()))
a_s = ''
if a[0] == a[1]:
	a_s += str(a[0])
	a_s += '00 '
	a_s += str(a[1])
	a_s += '01'
elif a[0] == a[1] - 1:
	a_s += str(a[0])
	a_s += '99 '
	a_s += str(a[1])
	a_s += '00'
elif a[0] == 9 and a[1] == 1:
	print('999 1000')
else:
	a_s = -1
print(a_s)


(a, b) = map(int, input().split())
if abs(a - b) > 1 and a != 9:
	print(-1)
	exit()
if a > b and a != 9:
	print(-1)
	exit()
if a > b and b > 1:
	print(-1)
	exit()
if a == b:
	print(a * 10, a * 10 + 1)
else:
	print(a * 10 + 9, (a + 1) * 10)


(a, b) = map(int, input().split())
if b - a == 1:
	print(str(a) + '99', str(int(str(a) + '99') + 1))
elif abs(a - b) == 0:
	print(str(a) + '11', str(int(str(a) + '11') + 1))
elif a - b == 8:
	print('99', '100')
else:
	print('-1')


s = input()
s = s.split(' ')
da = int(s[0])
db = int(s[1])
if da == db:
	a = 100 * da + 12
	b = 100 * db + 13
	print(a, b)
elif da == db - 1:
	a = 100 * da + 99
	b = 100 * db
	print(a, b)
elif da == 9 and db == 1:
	a = 9
	b = 10
	print(a, b)
else:
	print(-1)


n = [int(i) for i in input().split()]
if n[0] - n[1] == 0:
	print(str(n[0]) + '0', str(n[1]) + '1')
elif n[1] - n[0] == 1:
	print(n[0], n[1])
elif n[0] == 9 and n[1] == 1:
	print(str(n[0]) + '9', str(n[1]) + '00')
else:
	print(-1)


(a, b) = map(int, input().split())
if abs(a - b) > 1 and a - b != 8:
	print(-1)
elif a > b and a - b != 8:
	print(-1)
elif a - b == 0:
	print(a * 10 + 1, a * 10 + 2)
elif a == 9 and b == 1:
	print(a, b * 10)
else:
	print(a * 10 + 9, b * 10)


(x, y) = [int(i) for i in input().split()]
if x == 9 and y == 1:
	print(9, 10)
elif y - x == 1:
	print(x, y)
elif x == y:
	print(x * 10, y * 10 + 1)
else:
	print(-1)


(a, b) = map(int, input().split())
print(*[[[-1], [10 * a + [0, 9][b > a], 10 * b + [1, 0][b > a]]][0 <= b - a < 2], [9, 10]][a - b > 7])


(d1, d2) = map(int, input().split())
if d1 == d2:
	print(d1 * 10, d1 * 10 + 1, end=' ')
elif d1 + 1 == d2:
	print(d1, d2, end=' ')
elif d1 == 9 and d2 == 1:
	print(d1, d2 * 10, end=' ')
else:
	print(-1)


(n, m) = map(int, input().split())
if m - n == 1:
	print(n, m)
	exit()
if m == 1 and n == 9:
	print(n, 10)
	exit()
if m == n:
	print(n, 1, ' ', m, 2, sep='')
	exit()
print(-1)


data = input()
data = data.split(' ')
A = data[0]
B = data[1]
if int(A) - int(B) == 0:
	A += '1'
	B += '2'
	print(A + ' ' + B)
elif int(A) == 9 and int(B) == 1:
	B += '0'
	print(A + ' ' + B)
elif int(A) - int(B) == -1:
	A += '9'
	B += '0'
	print(A + ' ' + B)
else:
	print('-1')


(a, b) = map(int, input().split())
if b - a == 1:
	print(str(a) + ' ' + str(b))
elif b == a:
	print(str(a * 10) + ' ' + str(b * 10 + 1))
elif a - b * 10 == -1:
	print(str(a) + ' ' + str(b * 10))
else:
	print(-1)


(n, m) = map(int, input().split())
if m - n == 0:
	print(n, '01', sep='', end=' ')
	print(m, '02', sep='')
elif m - n == 1:
	print(n, m)
elif m == 1 and n == 9:
	print('9 10')
else:
	print('-1')


(a, b) = map(int, input().split())
if b - a == 1:
	print(a, end='')
	print('99', b, end='')
	print('00')
elif b == a:
	print(a, end='')
	print('12', b, end='')
	print('13')
elif a == 9 and b == 1:
	print('99 100')
else:
	print('-1')


from collections import defaultdict
from math import log2, floor
from pprint import pprint
mod = pow(10, 9) + 7
(a, b) = map(int, input().split())
if a + 1 == b:
	print(a, b)
elif a == b:
	print(a * 10 + 8, b * 10 + 9)
elif a == 9 and b == 1:
	print(99, 100)
else:
	print(-1)


(x, y) = map(int, input().split())
if x in [y, y - 1] or (x == 9 and y == 1):
	if x == 9 and y == 1:
		a = 9
		b = 10
	elif x == y - 1:
		a = x * 10 + 9
		b = y * 10 + 0
	else:
		a = x * 10
		b = y * 10 + 1
	print(a, b)
else:
	print(-1)


(a, b) = list(map(int, input().split()))
if a == b:
	print(str(a) + '0', str(b) + '1')
elif a - b == -1:
	print(str(a) + '9', str(b) + '0')
elif a - b == 8:
	print(a, b * 10)
else:
	print(-1)


(da, db) = list(map(int, input().split()))
if da == 9 and db == 1:
	print(99, 100)
elif db - da > 1 or da > db:
	print(-1)
elif db - da == 1:
	a = da * 100 + 99
	b = db * 100
	print(a, b)
elif db - da == 0:
	a = da * 100 + 13
	b = db * 100 + 14
	print(a, b)


s = input()
a = s.split()
da = int(a[0])
db = int(a[1])
if db - da == 1:
	print(str(da) + ' ' + str(db))
elif da == 9 and db == 1:
	sa = str(da) + '9'
	sb = str(db) + '00'
	print(sa + ' ' + sb)
elif db == da:
	sa = str(da) + '0'
	sb = str(db) + '1'
	print(sa + ' ' + sb)
else:
	print(-1)


(da, db) = [int(x) for x in input().split()]
if db - da == 1:
	print(da * 100 + 99, db * 100)
elif db == da:
	print(da * 100, db * 100 + 1)
elif da == 9 and db == 1:
	print(99, 100)
else:
	print(-1)


I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
(a, b) = IL()
if a == b:
	print(a * 10 + 4, b * 10 + 5)
elif a + 1 == b:
	print(a * 10 + 9, b * 10)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(int(str(a) + '10'), int(str(b) + '11'))
elif b - a == 1:
	print(int(str(a) + '9'), int(str(b) + '0'))
elif b == 1 and a == 9:
	print('9 10')
else:
	print(-1)


X = list(map(int, input().split()))
print(str(X[0]) + '0 ' + str(X[0]) + '1' if X[0] == X[1] else str(X[0]) + '9 ' + str(X[1]) + '0' if X[1] - X[0] == 1 else '9 10' if X[0] - X[1] == 8 else -1)


line = input()
a = int(line[0])
b = int(line[-1])
if a == 9 and b == 1:
	print(a, 10)
elif b - a == 1:
	print(a, b)
elif a - b == 0:
	print(a * 10, b * 10 + 1)
else:
	print(-1)


(n1, n2) = map(int, input().split())
if (n1 - n2 >= 2 or n1 - n2 <= -2) and (n1 != 9 and n2 != 1):
	print(-1)
elif n1 == 9 and n2 == 1:
	print(99, 100, end=' ')
	print()
elif n1 == n2:
	n1 = n1 * 10 + 1
	n2 = n2 * 10 + 2
	print(n1, n2, end=' ')
	print()
elif n1 > n2:
	print(-1)
elif n2 > n1:
	n1 = n1 * 10 + 9
	n2 = n2 * 10
	print(n1, n2, end=' ')
	print()


(a, b) = map(int, input().split(' '))
if a + 1 == b:
	b = a + 1
	print(a, b)
elif a == 9 and b == 1:
	a = 9
	b = 10
	print(a, b)
elif a == b:
	a = a * 10 + 8
	b = b * 10 + 9
	print(a, b)
elif a > b or b > a + 1:
	print('-1')


(da, db) = [int(i) for i in input().split()]
if db == da + 1 or db == da or da - db == 8:
	if da - db == 8:
		print(999, 1000)
	else:
		b = int(str(db) + '0' + '1') - (db - da)
		a = b - 1
		print(a, b)
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if b - a == 1:
	print(a, b)
elif a == b:
	print(str(a) + '12', str(b) + '13')
elif a == 9 and b == 1:
	print('99', '100')
else:
	print(-1)


(d_a, d_b) = map(int, input().split())
if d_b - d_a == 1:
	print(str(d_a) + '9', str(d_b) + '0')
elif d_a == 9 and d_b == 1:
	print(9, 10)
elif d_b - d_a == 0:
	print(str(d_a) + '2', str(d_b) + '3')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(a, str(b) + '0')
elif b > a + 1 or a > b:
	print(-1)
if a == b:
	print(str(a) + '11', str(b) + '12')
elif b == a + 1:
	print(str(a) + '9', str(b) + '0')


a = list(map(int, input().split()))
if a[0] == 9 and a[1] == 1:
	print(a[0], '10')
elif abs(a[0] - a[1]) >= 2 or a[0] > a[1]:
	print('-1')
elif a[0] + 1 == a[1]:
	print(a[0], a[1])
elif a[0] == a[1]:
	print(a[0] * 10, a[0] * 10 + 1)
elif a[0] == 9 and a[1] == 1:
	print(a[0], '10')


(da, db) = map(int, input().split())
if db == 1 and da == 9:
	print(9, 10, sep=' ')
	exit()
if db < da or db - da > 1:
	print(-1)
	exit()
if db == da:
	print(str(da) + '0', str(db) + '1', sep=' ')
else:
	print(str(da) + '9', str(db) + '0', sep=' ')


x = input()
xx = x.split()
da = int(xx[0])
db = int(xx[1])
if da == 9 and db == 1:
	a = str(da) + '9'
	b = int(a) + 1
	print(a, end=' ')
	print(b)
elif da > db or db - da >= 2:
	print(-1)
elif db - da == 1:
	a = str(da) + '9'
	b = int(a) + 1
	print(a, end=' ')
	print(b)
elif db == da:
	a = str(da) + '0'
	b = str(db) + '1'
	print(a, end=' ')
	print(b)


(a, b) = map(int, input().split())
if a == b:
	print(str(a) + '0', str(b) + '1')
elif a + 1 == b:
	print(a, b)
elif int(str(a)) + 1 == int(str(b) + '0' * (len(str(a)) - len(str(b)) + 1)):
	print(int(str(a)), int(str(b) + '0' * (len(str(a)) - len(str(b)) + 1)))
else:
	print(-1)


def print2d(a):
	for i in a:
		print(' '.join(list(map(str, i))))
(n, m) = list(map(int, input().split()))
if n == m:
	print(str(n) + '1' + ' ' + str(m) + '2')
elif n == m - 1:
	print(n, m)
elif n == 9 and m == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(999, 1000)
elif a * 100 + 99 + 1 == b * 100:
	print(a * 100 + 99, b * 100)
elif a == b:
	print(a * 100 + 12, b * 100 + 13)
else:
	print(-1)


import sys
inp = list(map(int, sys.stdin.readline().split()))
a = inp[0]
b = inp[1]
if b != 0:
	if b - a == 1:
		b = b * 10
		a = b - 1
		print(a, b)
	elif a == b:
		a = a * 10
		res = a + 1
		print(a, res)
	else:
		a = a * 10 + 9
		res = a + 1
		fdb = res // 100 % 10
		if b == fdb:
			print(a, res)
		else:
			print('-1')
else:
	b = a + 1
	print(a, b)


(da, db) = map(int, input().split())
if da - db == 8:
	print(da, db * 10)
elif db - da > 1:
	print(-1)
elif db - da == 1:
	print(da, db)
elif da == db:
	print(da * 10 + 1, db * 10 + 2)
else:
	print(-1)


(a, b) = map(int, input().split())
if b == a:
	print(str(a) + '11', str(b) + '12')
elif b - a == 1:
	print(str(a) + '99', str(b) + '00')
elif a == 9 and b == 1:
	print(99, 100)
else:
	print(-1)


(a, b) = map(int, input().split())
if b == 1 and a == 9:
	print('{0}99 {1}000'.format(a, b))
elif a > b:
	print('-1')
elif b - a != 1 and b != a:
	print('-1')
elif a != b:
	print('{0}99 {1}00'.format(a, b))
else:
	print('{0}01 {1}02'.format(a, b))


(a, b) = list(map(int, input().split()))
if a == 9 and b == 1:
	print(9, 10)
elif a - b == -1:
	print(str(a) + '9', str(b) + '0')
elif a - b == 0:
	print(str(a) + '00', str(b) + '01')
else:
	print(-1)


(da, db) = map(int, input().split())
if da == 9 and db == 1:
	print(9, 10)
elif db - da > 1 or db < da:
	print(-1)
elif db == da:
	a = str(da) + '01'
	b = str(db) + '02'
	print(a, b)
else:
	a = str(da) + '99'
	b = str(db) + '00'
	print(a, b)


(d1, d2) = map(int, input().split())
if d1 == d2:
	print(str(d1) + '4', str(d2) + '5')
elif d2 - d1 == 1:
	print(str(d1) + '99', str(d2) + '00')
elif d1 == 9 and d2 == 1:
	print('99 100')
else:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 0:
	print(a * 100 + 12, end=' ')
	print(a * 100 + 13, end=' ')
elif b - a == 1:
	print(a, end=' ')
	print(b, end=' ')
elif a == 9 and b == 1:
	print(9, end=' ')
	print(10)
else:
	print(-1)


(a, b) = input().split()
if int(a) + 1 == int(b):
	print(f'{a}9 {b}0')
elif int(a) == int(b):
	print(f'{a}1 {b}2')
elif a == '9' and b == '1':
	print('99 100')
else:
	print('-1')


(da, db) = input().split()
for a in range(1, 1000):
	b = a + 1
	if str(a)[0] == da and str(b)[0] == db:
		print(a, b)
		exit(0)
print(-1)


(x, y) = map(int, input().split())
if y - x not in [0, 1, -8]:
	print(-1)
elif x == y:
	print(x * 10 + 1, x * 10 + 2)
else:
	print(x * 10 + 9, x * 10 + 10)


i = input()
a = int(i[0])
b = int(i[2])
(c, d) = (0, 0)
if b - a == 1:
	c = a * 10 + 9
	d = b * 10
	e = str(c) + ' ' + str(d)
elif b == a:
	c = a * 10
	d = a * 10 + 1
	e = str(c) + ' ' + str(d)
elif a == 9 and b == 1:
	c = 99
	d = 100
	e = str(c) + ' ' + str(d)
else:
	e = -1
print(e)


(da, db) = map(int, input().split())
if da - db == 0:
	a = int(str(da) + '0')
	b = int(str(da) + '1')
	print(a, b)
elif db - da == 1:
	a = int(str(da) + '9')
	b = int(str(db) + '0')
	print(a, b)
elif da == 9 and db == 1:
	a = int(str(da) + '9')
	b = int(str(db) + '00')
	print(a, b)
else:
	print(-1)


(a, b) = map(int, input().split())
print(*([str(a) + '9', str(b) + '0'] if b - a == 1 else [str(a) + '2', str(b) + '3'] if b - a == 0 else [99, 100] if a == 9 and b == 1 else [-1]))


import sys
import collections
import math
input = sys.stdin.readline

def printnl(val):
	sys.stdout.write(str(val) + '\n')
(da, db) = map(int, input().split())
if db - da == 1:
	print(da, db)
elif db - da == 0:
	print(f'{da}1 {db}2')
elif da == 9 and db == 1:
	print(9, 10)
else:
	print(-1)


(da, db) = input().split()
(da, db) = (int(da), int(db))
if da == db:
	s1 = da * 10 + 1
	s2 = db * 10 + 2
	print(s1, s2)
elif da + 1 == db:
	s1 = da * 10 + 9
	s2 = db * 10
	print(s1, s2)
elif da == 9 and db == 1:
	s1 = 9
	s2 = 10
	print(s1, s2)
else:
	s1 = -1
	print(s1)


(a, b) = map(int, input().split())
t = 0
o = 101
oo = 101
if a == 0:
	o = 1
if b == 0:
	oo = 1
if t == 0:
	for i in range(-1, o):
		if t == 1:
			break
		for j in range(-1, oo):
			if i == -1:
				i = ''
			if j == -1:
				j = ''
			if int(str(a) + str(i)) + 1 == int(str(b) + str(j)):
				print(int(str(a) + str(i)), int(str(b) + str(j)))
				t = 1
				break
if t == 0:
	print(-1)


import sys
inp = input().split()
da = int(inp[0])
db = int(inp[1])
if da == 9 and db == 1:
	print(f'99 100')
	sys.exit(0)
if abs(db - da) > 1:
	print(-1)
	sys.exit(0)
if db < da:
	print(-1)
	sys.exit(0)
if db - da == 0:
	print(f'{da}0 {db}1')
else:
	print(f'{da}9 {db}0')


(da, db) = [int(_) for _ in input().split()]
if da == db:
	print(10 * da, 10 * db + 1)
elif da == 9 and db == 1:
	print(9, 10)
elif db - da == 1:
	print(10 * da + 9, 10 * db)
else:
	print(-1)


(a, b) = [int(x) for x in input().split()]
if b * 10 - a == 1:
	print(a, b * 10)
elif b - a < 2 and b - a > 0:
	print(b * 100 - 1, b * 100)
elif a == b:
	print(a * 100, a * 100 + 1)
elif b - a >= 2 or a > b:
	print('-1')


from math import *
(n, m) = map(int, input().split())
if n == m:
	n = n * 10
	m = m * 10 + 1
	print(n, m)
elif n + 1 == m:
	print(n, m)
elif n == 9 and m == 1:
	print(99, 100)
else:
	print(-1)


inp = str(input())
da = int(inp[0])
db = int(inp[2])
if db - da == 1:
	da = str(da) + str(9)
	db = str(db) + str(0)
	print(str(da) + ' ' + str(db))
elif db == da:
	da = str(da) + str(0)
	db = str(db) + str(1)
	print(str(da) + ' ' + str(db))
elif da == 9 and db == 1:
	db = 10
	print(str(da) + ' ' + str(db))
else:
	print('-1')


import sys
(a, b) = map(int, input().split())
for i in range(1, 100000):
	if str(i)[0] == str(a) and str(i + 1)[0] == str(b):
		print(i, i + 1)
		sys.exit(0)
print(-1)


(d_a, d_b) = map(int, input().split())
if d_a == d_b:
	print(d_a * 10, d_b * 10 + 1)
elif d_a == d_b - 1:
	print(d_a * 10 + 9, d_b * 10)
elif d_a == 9 and d_b == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if a == 9 and b == 1:
	print(9, 10)
elif a - b == 0:
	print(str(a) + str(1), str(b) + str(2))
elif b - a == 1:
	print(str(a) + '99', str(b) + '00')
else:
	print(-1)


(a, b) = map(int, input().split())
flag = 0
if a + 1 == b:
	print(a, b)
	flag = 1
if a == b:
	print(a * 100 + 2 * 10 + 3, b * 100 + 2 * 10 + 4)
	flag = 1
if a == 9 and b == 1:
	print(9, 10)
	flag = 1
if flag == 0:
	print(-1)


(da, db) = map(int, input().split())
d = db - da
if da == 9 and db == 1:
	print(9, 10)
elif d == 0:
	da = int(str(da) + '1')
	db = int(str(db) + '2')
	print(da, db)
elif d == 1:
	print(da, db)
else:
	print(-1)


def f(da, db):
	while True:
		if db - da == 1:
			print(da, db)
			return
		elif db - da == 0:
			print(da * 10, db * 10 + 1)
			return
		elif db == 1 and da == 9:
			print('99 100')
			return
		else:
			print(-1)
			return
(da, db) = map(int, input().split())
f(da, db)


(a, b) = list(map(int, input().split(' ')))
c = b - a
if c < 2 and c >= 0:
	b *= 10
	if c == 0:
		b += 1
	print(b - 1, b)
elif a == 9 and b == 1:
	b *= 10
	print(b - 1, b)
else:
	print(-1)


(da, db) = map(int, input().split())
if da == 9 and db == 1:
	print('999 1000')
elif da == db:
	print(str(da) + '15' + ' ' + str(db) + '16')
elif da + 1 == db:
	print(str(da) + '99' + ' ' + str(db) + '00')
else:
	print(-1)


(m, n) = map(int, input().split())
if n - m == 1:
	ms = str(m)
	ns = str(n)
	ma = int(ms + '99')
	na = int(ns + '00')
	print(ma, na)
elif m == 9 and n == 1:
	print(9, 10)
elif n - m == 0:
	ms = str(m)
	ns = str(n)
	ma = int(ms + '00')
	na = int(ns + '01')
	print(ma, na)
else:
	print(-1)


(a, b) = list(map(int, input().split()))
if a == b:
	print(a * 10, a * 10 + 1)
elif abs(a - b) == 1 and a < b:
	print(min(a, b), max(a, b))
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(da, db) = map(int, input().split())
if da == db:
	print(str(da) + '12', str(db) + '13')
elif da == 9 and db == 1:
	print(9, 10)
elif da + 1 == db:
	print(str(da) + '9', str(db) + '0')
else:
	print(-1)


import math
(a, b) = map(int, input().split())
if a == 9:
	if b == 1:
		print(a, a + 1)
	elif b == 9:
		print(90, 91)
	else:
		print(-1)
elif b >= a and b - a <= 1:
	if b > a:
		print(a, a + 1)
	else:
		print(a * 10, a * 10 + 1)
else:
	print(-1)


(a, b) = map(int, input().split())
c = b - a
if c == 1:
	print(a * 10 + 9, b * 10)
elif c == 0:
	print(a * 10 + 1, b * 10 + 2)
elif c == -8:
	print(a, b * 10)
else:
	print(-1)


ia = [int(x) for x in input().split()]
if ia[0] == ia[1]:
	a = ia[0] * 10
	b = ia[1] * 10 + 1
	print(a, b)
elif ia[0] == 9 and ia[1] == 1:
	print(9, 10)
elif abs(ia[0] - ia[1]) > 1 or ia[0] > ia[1]:
	print(-1)
else:
	a = ia[0] * 10 + 9
	b = ia[1] * 10
	print(a, b)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(99, 100)
elif a == b:
	s = str(a)
	s += '1'
	aa = int(s)
	print(aa, aa + 1)
elif b - a == 1:
	s = str(a)
	s += '9'
	aa = int(s)
	print(aa, aa + 1)
else:
	print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
if b - a == 0:
	print(a * 10 + 2, b * 10 + 3)
elif b - a == 1:
	print(a * 10 + 9, b * 10)
elif a == 9 and b == 1:
	print(a * 10 + 9, b * 100)
else:
	print(-1)


def forgetting_things(a, b):
	if a == b:
		return [a * 10, a * 10 + 1]
	if a + 1 == b:
		return [a * 10 + 9, b * 10]
	if a == 9 and b == 1:
		return [9, 10]
	return [-1]
[a, b] = map(int, input().split())
result = forgetting_things(a, b)
print(*result)


def solve(a, b):
	if a == b:
		a = a * 10
		b = a + 1
		print(a, b)
	else:
		a = int(str(a) + '9')
		if str(a + 1)[0] == str(b):
			b = a + 1
			print(a, b)
		else:
			print(-1)
(a, b) = map(int, input().split())
solve(a, b)


S = input()
a = int(S[0])
b = int(S[2])
if b - a == 0:
	print(a * 10, b * 10 + 1)
elif b - a == 1:
	print(a, b)
elif a == 9 and b == 1:
	print(a, b * 10)
else:
	print(-1)


(x, y) = map(int, input().split())
if x == y:
	print(str(x) + '1', str(y) + '2')
elif int(str(x) + '9') + 1 == int(str(y) + '0'):
	print(str(x) + '9', str(y) + '0')
elif int(str(x) + '9') + 1 == int(str(y) + '00'):
	print(str(x) + '9', str(y) + '00')
else:
	print(-1)


d = '123456789'
(a, b) = input().split()
if a == b:
	print(a + '0', b + '1')
elif d[(d.index(a) + 1) % 9] == b:
	if a == '9':
		print('99', '100')
	else:
		print(a + '9', b + '0')
else:
	print(-1)


(a1, b1) = map(int, input().split())
a = 0
b = 0
if int(a1) == 9 and int(b1) == 1:
	print(a1, 10)
elif b1 - a1 >= 2:
	print('-1')
elif b1 - a1 == 1:
	a = int(str(a1) + '99')
	b = a + 1
	print(a, b)
elif b1 - a1 == 0:
	a = int(str(a1) + '1' + '2')
	b = a + 1
	print(a, b)
else:
	print('-1')


(c, d) = input().split()
c = int(c)
d = int(d)
if c == 9 and d == 1:
	print('99', '100')
elif d - c == 1:
	print(str(c) + '99', str(d) + '00')
elif d == c:
	print(str(c) + '11', str(d) + '12')
else:
	print('-1')


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
(da, db) = map(int, input().split())
flag = False
for i in range(10):
	for j in range(10):
		if da * 10 + i + 1 == db * 10 + j:
			print(da * 10 + i, db * 10 + j)
			flag = True
			break
		if da + 1 == db * 10 + j:
			print(da, db * 10 + j)
			flag = True
			break
		if da * 10 + i + 1 == db:
			print(da * 10 + i, db)
			flag = True
			break
		if da + 1 == db:
			print(da, db)
			flag = True
			break
	if flag:
		break
if not flag:
	print(-1)


temp = input().split()
(a, b) = (int(temp[0]), int(temp[1]))
if a > b:
	if a == 9 and b == 1:
		print(99, 100)
		exit(0)
	print('-1')
	exit(0)
if a == b:
	if a == 9:
		print(90, 91)
	else:
		print(str(a) + '0', str(b) + '1')
elif b - a >= 2:
	print('-1')
	exit(0)
else:
	print(str(a), str(b))


(Da, Db) = map(int, input().split())
if Da == Db:
	print(Da, 4, sep='', end=' ')
	print(Db, 5, sep='')
elif Da == Db - 1:
	print(Da, 9, sep='', end=' ')
	print(Db, 0, sep='')
elif Da == 9 and Db == 1:
	print(99, 100)
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if a == 9 and b == 1:
	print(f'9 10')
elif abs(b - a) > 1 or a - b == 1:
	print(-1)
elif b - a == 1:
	print(f'{a}99 {b}00')
else:
	print(f'{a}00 {b}01')


def solve(a, b):
	if a == 9 and b == 1:
		return (9, 10)
	elif a > b:
		return [-1]
	elif a == b:
		return (b * 10, b * 10 + 1)
	elif abs(a - b) > 1:
		return [-1]
	else:
		return (b * 10 - 1, b * 10)

def main():
	n = list(map(int, input().split(' ')))
	print(*solve(n[0], n[1]))
main()


(a_, b_) = map(int, input().split(' '))
d = a_ - b_
if d == 8:
	print(9, 10)
elif d == -1:
	print(b_ * 100 - 1, b_ * 100)
elif d == 0:
	print(b_ * 100, b_ * 100 + 1)
else:
	print(-1)


c = input().split()
if c[0] == c[1]:
	print(c[0] + '10', c[1] + '11')
elif c[0] == '9' and c[1] == '1':
	print('99 100')
elif int(c[1]) - int(c[0]) == 1:
	print(c[0] + '99', c[1] + '00')
else:
	print(-1)


(da, db) = map(int, input().split())
(x, y) = (0, 1)
while y < 1000000:
	if str(x)[0] == str(da) and str(y)[0] == str(db):
		break
	x += 1
	y += 1
if y == 1000000:
	print(-1)
else:
	print(x, y)


def f(da, db):
	if db - da == 0:
		a = da * 10
		b = da * 10 + 1
	elif db - da == 1:
		a = da * 10 + 9
		b = db * 10
	elif da == 9 and db == 1:
		a = da
		b = db * 10
	else:
		return -1
	return (a, b)
(da, db) = map(int, input().split())
ans = f(da, db)
if ans == -1:
	print(-1)
else:
	(a, b) = ans
	print(a, b)


(a, b) = map(int, input().split())
print('9 10' if a == 9 and b == 1 else f'{a} {b}' if b - a == 1 else f'{a}0 {a}1' if a == b else -1)


(n, m) = map(int, input().split())
if n + 1 == m:
	print(n, m, sep=' ')
elif n == m:
	print(str(n) + str(1), str(m) + str(2), sep=' ')
elif n == 9 and m == 1:
	print(99, 100, sep=' ')
else:
	print(-1)


(da, db) = map(int, input().split())
if db == da or da + 1 == db or (da == 9 and db == 1):
	if da + 1 == db:
		a = da * 10 + 9
		b = db * 10
		print(a, b)
	if da == db:
		a = da * 10 + 1
		b = db * 10 + 2
		print(a, b)
	if da == 9 and db == 1:
		print('9', '10')
else:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 1:
	print('{}9 {}0'.format(a, b))
elif b == a:
	print('{}12 {}13'.format(a, b))
elif a == 9 and b == 1:
	print('{}9 {}00'.format(a, b))
else:
	print(-1)


import itertools

def main():
	(a, b) = [int(v) for v in input().split()]
	for i in range(0, 1000):
		if str(i)[0] == str(a) and str(i + 1)[0] == str(b):
			print(i, i + 1)
			return
	print(-1)
main()


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
(a, b) = getVars()
if b == a:
	print(a * 10, b * 10 + 1)
elif b == a + 1:
	print(a, b)
elif b == 1 and a == 9:
	print(9, 10)
else:
	print(-1)


(d, b) = map(int, input().split())
if b - d == 0:
	print(str(d) + '0', str(b) + '1')
elif b - d == 1:
	print(str(d) + '9', str(b) + '0')
elif d == 9 and b == 1:
	print('99', '100')
else:
	print(-1)


a = input()
b = a.split(' ')
if int(b[0]) == int(b[1]):
	print(b[0] + '0 ' + b[1] + '1')
elif int(b[1]) - int(b[0]) == 1:
	print(b[0] + '99 ' + b[1] + '00')
elif int(b[0]) == 9 and int(b[1]) == 1:
	print(b[0] + ' ' + b[1] + '0')
else:
	print('-1')


(a, b) = list(map(int, input().split()))
if 1 < abs(b - a) < 8:
	print(-1)
elif a == b:
	print(int(str(a) + '12'), int(str(a) + '12') + 1)
elif abs(a - b) == 1:
	if a > b:
		print(-1)
	else:
		print(int(str(a) + '99'), str(b) + '00')
elif abs(a - b) == 8 and a == 9:
	print(99999, 100000)
else:
	print(-1)


(a, b) = map(int, input().split())
d = abs(a - b)
if d > 1 or a > b:
	if b * 10 - a == 1:
		print(a, b * 10)
	else:
		print('-1')
elif d == 1:
	print(b * 100 - 1, b * 100)
else:
	print(b * 110 - 1, b * 110)


(da, db) = map(int, input().split(' '))
if da == 9 and db == 1:
	print(str(9) + ' ' + str(10))
elif db - da == 1:
	x = str(da) + str(9)
	y = str(db) + str(0)
	print(str(x) + ' ' + str(y))
elif db - da == 0:
	x = str(da) + str(3)
	y = str(db) + str(4)
	print(str(x) + ' ' + str(y))
else:
	print(-1)


(da, db) = map(int, input().split())
if db == da:
	print(str(da) + '6', str(db) + '7')
elif db == da + 1:
	print(str(da) + '9', str(db) + '0')
elif db == 1 and da == 9:
	print('9', '10')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	a1 = a * 100 + 11
	b1 = b * 100 + 12
	print(a1, b1)
elif b - a == 1:
	a1 = a * 100 + 99
	b1 = b * 100 + 0
	print(a1, b1)
elif a == 9 and b == 1:
	a1 = a * 100 + 99
	b1 = b * 1000
	print(a1, b1)
else:
	print(-1)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
if b == a + 1 or (a == 9 and b == 1) or b == a:
	for i in range(0, 101):
		if str(i)[0] == str(a) and str(i + 1)[0] == str(b):
			print(i, i + 1)
			break
else:
	print(-1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		(a, b) = LI()
		if a == b:
			r = [a * 10, a * 10 + 1]
		elif a == b - 1:
			r = [a, b]
		elif a == 9 and b == 1:
			r = [9, 10]
		else:
			r = [-1]
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


s = input()
a1 = s[0]
a2 = s[2]
if int(a1) - int(a2) == -1:
	print(a1 + '9' + ' ' + a2 + '0')
elif int(a1) == int(a2):
	print(a1 + '0' + ' ' + a2 + '1')
elif a1 == '9' and a2 == '1':
	print('9 10')
else:
	print('-1')


(a, b) = map(int, input().split())
if (b - a) % 10 == 0:
	print(f'{a}0 {b}1')
elif b - a == 1:
	print(f'{a}9 {b}0')
elif b - a == -8:
	print(f'{a}9 {b}00')
else:
	print(-1)


(n1, n2) = list(map(int, input().split()))
if n2 - n1 == 1:
	base = n2 * 10 ** 2
	print(base - 1, base)
elif n2 - n1 == 0:
	base = n2 * 10 ** 2
	print(base, base + 1)
elif n1 == 9 and n2 == 1:
	print(999, 1000)
elif n2 - n1 > 1:
	print(-1)
elif n2 < n1:
	print(-1)


a = {(0, 1): 0, (9, 1): 99, (1, 1): 112, (2, 2): 212, (3, 3): 312, (4, 4): 412, (5, 5): 512, (6, 6): 612, (7, 7): 712, (8, 8): 812, (9, 9): 912, (1, 2): 199, (2, 3): 299, (3, 4): 399, (4, 5): 499, (5, 6): 599, (6, 7): 699, (7, 8): 799, (8, 9): 899}
(b, c) = map(int, input().split())
if not (b, c) in a:
	print(-1)
else:
	print(a[b, c], a[b, c] + 1)


w = input()
l = w.split(' ')
if int(l[0]) + 1 == int(l[1]):
	l[0] += '9'
	l[1] += '0'
	print(l[0], l[1])
elif l[0] == l[1]:
	l[0] += '1'
	l[1] += '2'
	print(l[0], l[1])
elif l[0] == '9' and l[1] == '1':
	l[0] += '9'
	l[1] += '00'
	print(l[0], l[1])
else:
	print(-1)


import sys
DEBUG = 0
(FSTREAM_IN, FSTREAM_OUT) = (DEBUG, DEBUG)
(FILENAME_IN, FILENAME_OUT) = ('in.txt', 'out.txt')

def main():
	(a, b) = map(int, input().split())
	if b - a == 1:
		print('{}9 {}0'.format(a, b))
	elif b - a == 0:
		print('{}0 {}1'.format(a, b))
	elif (a, b) == (9, 1):
		print(9, 10)
	else:
		print(-1)
if DEBUG:
	(FILENAME_IN, FILENAME_OUT) = ('debug.in', 'debug.out')
if FSTREAM_IN:
	sys.stdin = open(FILENAME_IN, 'r')
if FSTREAM_OUT:
	sys.stdout = open(FILENAME_OUT, 'w')
main()


(a, b) = input().split()
(a, b) = (int(a), int(b))
if b - a == 1:
	print('%d %d' % (a * 10 + 9, b * 10))
elif a == 9 and b == 1:
	print('%d %d' % (a * 10 + 9, b * 100))
elif a == b:
	print('%d %d' % (a * 10 + 1, b * 10 + 2))
else:
	print(-1)


a = input().split(' ')
g = int(a[0])
f = int(a[1])
c = 0
if f + 1 < g:
	if g == 9 and f == 1:
		c = c + 0
	else:
		c = c + 1
if g + 1 < f:
	if g == 9 and f == 1:
		c = c + 0
	else:
		c = c + 1
if g == 9 and f == 1:
	print(9, 10)
if c == 1:
	print(-1)
if g == f:
	print(g * 100 + 10, g * 100 + 11)
if g + 1 == f:
	print(g * 100 + 99, f * 100)
if f + 1 == g:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(str(a) + '1', str(b) + '2')
elif a + 1 == b:
	print(str(a) + '9', str(b) + '0')
elif str(a + 1)[0] == str(b):
	print(a, a + 1)
else:
	print(-1)


(da, db) = map(int, input().split())
Ok = False
for i in range(da * 10, db * 1000):
	ch = i
	while ch != 0:
		ch //= 10
		ka = ch % 10
		if ch // 10 == 0:
			break
	ch = i + 1
	while ch != 0:
		ch //= 10
		kb = ch % 10
		if ch // 10 == 0:
			break
	if ka == da and kb == db:
		print(i, i + 1)
		Ok = True
		break
if not Ok:
	print(-1)


def main():
	(da, db) = map(int, input().split())
	if da == db:
		print(10 * da, 10 * da + 1)
		return
	if da == 9 and db == 1:
		print(9, 10)
		return
	if da + 1 == db:
		print(10 * da + 9, 10 * db)
		return
	print(-1)
main()


(a, b) = map(int, input().split())
if b == a:
	print(a, '00 ', b, '01', sep='')
elif b - a == 1:
	print(a, '99 ', b, '00', sep='')
elif a == 9 and b == 1:
	print(999, 1000)
else:
	print(-1)


(z, x) = map(int, input().split())
if z == 9 and x == 1:
	print(9, 10)
elif z > x or x - z > 1:
	print(-1)
elif x > z:
	print(z * 10 + 9, x * 10)
else:
	print(z * 10 + 1, x * 10 + 2)


daNdb = input().split(' ')
daNdb[0] = int(daNdb[0])
daNdb[1] = int(daNdb[1])
a = 0
b = 0
Eror = False
if daNdb[1] - daNdb[0] == 1:
	a = daNdb[0]
	b = daNdb[1]
if daNdb[0] == 9 and daNdb[1] == 1:
	a = daNdb[0] * 10 + daNdb[0]
	b = daNdb[1] * 100
if daNdb[0] == daNdb[1]:
	a = daNdb[0] * 10 + 1
	b = daNdb[1] * 10 + 2
if a == 0 and b == 0:
	Eror = True
	print(-1)
if Eror == False:
	print(str(a) + ' ' + str(b))


(Da, Db) = map(int, input().split())
if Db - Da == 1:
	print(Da, Db)
elif Da == Db:
	print(Da * 10, Db * 10 + 1)
elif Da - Db == 8:
	print(Da, Db * 10)
else:
	print(-1)


(d1, d2) = map(int, input().split())
if d2 - d1 == 1:
	print(d1, d2)
elif d1 == d2:
	print(d1 * 10 + 4, d2 * 10 + 5)
elif d1 == 9 and d2 == 1:
	print(d1, d2 * 10)
else:
	print(-1)


(m, n) = map(int, input().split())
if n == m + 1:
	print(str(m) + '9', str(n) + '0')
elif m == n:
	print(str(m) + '1', str(n) + '2')
elif m == 9 and n == 1:
	print(str(m) + '9', str(n) + '00')
else:
	print(-1)


(a, b) = map(int, input().split())
if a - b == 0:
	print(str(a) + '17 ' + str(a) + '18')
elif b - a == 1:
	print(str(a) + '99 ' + str(b) + '00')
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


import array, bisect, collections, copy, fractions, functools, heapq, itertools, math, random, re, string, sys, time, os, timeit
sys.setrecursionlimit(10000000)
inf = float('inf')

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 int_inp():
	return int(sys.stdin.readline())

def float_inp():
	return float(sys.stdin.readline())

def inp():
	return sys.stdin.readline().strip()

def pf(s):
	return print(s, flush=True)

def main():
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
	(a, b) = li()
	if a + 1 == b:
		print(a, b)
	elif a == b:
		print(a * 10, a * 10 + 1)
	elif a == 9 and b == 1:
		print(99, 100)
	else:
		print(-1)
main()


line = input()
(a, b) = map(int, line.split(' '))
q = -1
c = 0
if b - a == 0:
	a = int(str(a) + '44')
	b = int(str(b) + '45')
	print(a, b)
elif b - a == 1:
	a = int(str(a) + '99')
	b = int(str(b) + '00')
	print(a, b)
elif a == 9 and b == 1:
	a = int(str(a) + '99')
	b = int(str(b) + '000')
	print(a, b)
else:
	print(q)


(da, db) = map(int, input().split())
if da == 9 and db == 1:
	a = 99
	b = 100
	print(a, b)
elif da == db:
	a = da * 10
	b = db * 10 + 1
	print(a, b)
elif da > db:
	print(-1)
elif db == da + 1:
	a = da * 10 + 9
	b = db * 10
	print(a, b)
elif db > da + 1:
	print(-1)


(d1, d2) = [int(i) for i in input().split()]
if d1 > d2:
	if d1 == 9 and d2 == 1:
		print(9, 10)
	else:
		print(-1)
elif d1 == d2:
	print(d1 * 10, d2 * 10 + 1)
elif d2 - d1 == 1:
	print(d1, d2)
else:
	print(-1)


(da, db) = map(int, input().split())
a = ''
b = ''
a += str(da)
b += str(db)
c = '1'
d = '2'
c1 = '9'
d1 = '0'
if da == 9 and db == 1:
	print(99, 100)
elif da > db or db - da > 1:
	print(-1)
	raise SystemExit
elif da == db:
	a += c
	b += d
	print(int(a), int(b))
elif db - da == 1:
	a += c1
	b += d1
	print(int(a), int(b))


def gp(d1, d2):
	if d1 == d2:
		return (d1 * 10, d2 * 10 + 1)
	elif d2 - d1 == 1:
		return (d1 * 10 + 9, d2 * 10)
	elif d2 == 1 and d1 == 9:
		return (9, 10)
	return [-1]
print(*gp(*[int(i) for i in input().split()]))


(da, db) = map(int, input().split())
if db - da == 1:
	print(str(da) + ' ' + str(db))
elif db - da == 0:
	print(str(da * 10 + 1) + ' ' + str(db * 10 + 2))
elif db * 10 - da == 1:
	print(str(da) + ' ' + str(db * 10))
else:
	print(-1)


(a, b) = input().split(' ')
(a, b) = (int(a), int(b))
answ = ''
if (a == 9) & (b == 1):
	answ = '99 100'
if answ == '':
	if b - a > 1 or a > b:
		answ = '-1'
	elif a == b:
		answ = str(a) + '1 ' + str(b) + '2'
	else:
		answ = str(a) + '9 ' + str(b) + '0'
print(answ)


(a, b) = map(int, input().strip().split(' '))
if a + 1 == b:
	print(a, b)
elif a == b:
	print(str(a) + '1', str(b) + '2')
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(p, q) = map(int, input().split())
if p == q:
	print(p * 10, p * 10 + 1)
elif q - p == 1 and q > p:
	print(q * 10 - 1, q * 10)
elif q * 10 == p + 1:
	print(p, q * 10)
else:
	print(-1)


inp = input().split(' ')
(a, b) = (inp[0], inp[1])
count = 0
answ = -1
while True:
	num = a + str(count)
	num2 = str(int(num) + 1)
	if num2[0] == b:
		answ = num + ' ' + num2
		break
	count += 1
	if int(num) > 1000000:
		answ = -1
		break
print(answ)


def f(l):
	(a, b) = l
	if a != b and a != b - 1 and (a != 9 or b != 1):
		return [-1]
	return [b * 10, b * 10 + 1] if a == b else [b * 10 - 1, b * 10]
l = list(map(int, input().split()))
print(*f(l))


(a, b) = map(int, input().split())
if abs(b - a) == 1 and a < b:
	print(a, b)
elif abs(b - a) == 0:
	print(a * 10 + 4, b * 10 + 5)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
sum1 = a * 10 + 1
protom = sum1 // 10
dara = a * 10 + 9
sum2 = dara + 1
ditiyo = sum2 // 10
if ditiyo >= 10:
	ditiyo = ditiyo // 10
if protom == b:
	print(a * 10, sum1)
elif ditiyo == b:
	print(dara, sum2)
else:
	print('-1')


n = list(map(int, input().split()))
if n[0] == n[1]:
	print(str(n[0]) + '1', str(n[1]) + '2')
elif n[1] - n[0] == 1:
	print(str(n[0]) + '9', str(n[1]) + '0')
elif n[1] == 1 and n[0] == 9:
	print(n[0], 10)
else:
	print(-1)


s = list(map(int, input().split()))
d1 = s[0]
d2 = s[1]
diff = (d1 - d2) * (d1 - d2)
if d2 - d1 >= 2:
	print(-1)
elif d1 > d2:
	if d1 == 9 and d2 == 1:
		print(9, 10)
	else:
		print(-1)
elif d2 - d1 == 1:
	print(10 * d1 + 9, 10 * d2)
else:
	print(10 * d1, 10 * d2 + 1)


(a, b) = map(int, input().split())

def main(a, b):
	if b - a == 0:
		print(a * 100, a * 100 + 1)
	elif b - a == 1:
		print(b * 100 - 1, b * 100)
	elif b == 1 and a == 9:
		print(999, 1000)
	else:
		print(-1)
main(a, b)


(x, y) = map(int, input().split())
if x > y:
	if x == 9 and y == 1:
		print(9, 10)
	else:
		print(-1)
elif x == y:
	print(f'{x}0 {y}1')
elif y - x != 1:
	print(-1)
else:
	print(f'{x}9 {y}0')


s = input().split()
(a, b) = (int(s[0]), int(s[1]))
if a == b:
	print('{}1 {}2'.format(a, b))
elif b - a == 1:
	print('{}9 {}0'.format(a, b))
elif a - b == 8:
	print('{} {}0'.format(a, b))
else:
	print('-1')


n = input().split()
a = int(n[0])
b = int(n[1])
diff = a - b
if a == 9 and b == 1:
	print(9, 10)
elif diff == 0:
	ans = str(a) + str(0) + ' ' + str(b) + str('1')
	print(ans)
elif diff == -1:
	ans = str(a) + str(9) + ' ' + str(b) + str('0')
	print(ans)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print('99 100')
elif a == b:
	print(a * 10 + 2, b * 10 + 3)
elif b - a == 1:
	print(a * 10 + 9, b * 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print('99 100')
	quit()
if abs(a - b) > 1 or b < a:
	print(-1)
elif a == b:
	print(a * 10, b * 10 + 1)
elif a + 1 == b:
	print(a * 10 + 9, b * 10)


(da, db) = [int(x) for x in input().split()]
if da == db:
	s1 = str(da) + '0'
	s2 = str(da) + '1'
	print(f'{s1} {s2}')
elif da == db - 1:
	print(f'{da} {db}')
elif da == 9 and db == 1:
	print(f'{da} 10')
else:
	print(f'-1')


(a, b) = map(int, input().split())
if b - a == 0:
	z = int(str(a) + '1')
	print(z, z + 1)
elif b - a == 1:
	x = int(str(a) + '9')
	c = int(str(b) + '0')
	print(x, c)
elif b == 1 and a == 9:
	print(9, 10)
else:
	print(-1)


(a_l, b_l) = [int(x) for x in input().split()]
if a_l == 9 and b_l == 1:
	print(9, 10)
	exit()
if a_l + 1 == b_l and a_l != 0 and (b_l != 0):
	print(a_l, b_l)
elif 0 <= b_l - a_l < 2 and a_l != 0 and (b_l != 0):
	if b_l - a_l == 0:
		print(a_l * 10, b_l * 10 + 1)
	elif a_l - a_l == 1:
		print(a_l * 10 + 9, b_l * 10)
else:
	print(-1)


stro = input()
da = 0
db = 0
for char in stro:
	if char != ' ':
		if da == 0:
			da = int(char)
		else:
			db = int(char)
if db - da == 0:
	print(da * 100 + 1, db * 100 + 2)
elif db - da == 1:
	print(da * 100 + 99, db * 100)
elif da == 9 and db == 1:
	print(99, 100)
else:
	print(-1)


a = input().split()
(s, b) = (int(a[0]), int(a[1]))
if s == 9 and b == 1:
	print(9, 10)
elif b < s:
	print(-1)
elif s + 1 < b:
	print(-1)
elif s + 1 == b:
	print(s * 10 + 9, b * 10)
elif s == b:
	print(s * 10, b * 10 + 1)


mass = list(input().split())
a = int(mass[0])
b = int(mass[1])
if a == 9 and b == 1:
	print('99 100')
elif a == b:
	print(str(a * 100) + ' ' + str(b * 100 + 1))
elif a + 1 == b:
	print(str(a * 100 + 99) + ' ' + str(b * 100))
else:
	print(-1)


(x, y) = map(int, input().split())
if x == y:
	print(str(x) + '1' + ' ' + str(y) + '2')
elif y == x + 1:
	print(str(x) + '9' + ' ' + str(y) + '0')
elif x == 9 and y == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = input().split()
c = int(b) - int(a)
if c == 0:
	print(a + '00 ' + b + '01')
elif int(b) == 1 and int(a) == 9:
	print('9 10')
elif c == 1:
	print(a + '99 ' + b + '00')
else:
	print(-1)


def main():
	(a, b) = [int(e) for e in input().split()]
	if a == 9 and b == 1:
		print(a, b * 10)
	elif a > b:
		print(-1)
	elif b - a > 1:
		print(-1)
	elif b - a == 1:
		print(a * 10 + 9, b * 10)
	elif b - a == 0:
		print(a * 10, b * 10 + 1)
main()


(da, db) = input().split()
flag = False
for i in range(1, 200):
	(sa, sb) = (str(i)[0], str(i + 1)[0])
	if sa == da and sb == db:
		flag = True
		print(i, i + 1)
		break
if not flag:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 1:
	print(a, '99 ', b, '00', sep='')
elif a == b:
	print(a * 101, b * 101 + 1)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


(x, y) = map(int, input().split())
if x * 100 == y * 100:
	print(x * 100, y * 100 + 1)
elif y * 100 - x * 100 == 100:
	print(y * 100 - 1, y * 100)
elif y * 1000 - x * 100 == 100:
	print(y * 1000 - 1, y * 1000)
else:
	print(-1)


(fa, fb) = map(int, input().split())
if fa == fb:
	print(fa, '1 ', fb, '2', sep='')
elif fa == 9 and fb == 1:
	print(99, 100)
elif fb == fa + 1:
	print(fa, fb)
else:
	print(-1)


lst = list(map(int, input().split()))
(a, b) = (lst[0], lst[1])
s = ' '
if a == b:
	a *= 100
	b = a + 1
	print(s.join([str(a), str(b)]))
elif b == a + 1:
	b *= 100
	a = b - 1
	print(s.join([str(a), str(b)]))
elif a == 9 and b == 1:
	print('9 10')
else:
	print('-1')


(da, db) = map(int, input().split())
if db - da == 1:
	print(f'{da}99 {db}00')
elif db - da == 0:
	print(f'{da}00 {db}01')
elif da == 9 and db == 1:
	print(9, 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(str(a) + '13', str(b) + '14')
elif a == b - 1:
	print(str(a) + '99', str(b) + '00')
elif a == 9 and b == 1:
	print(a, a + 1)
else:
	print('-1')


(a, b) = map(int, input().split())
if b == 1 and a == 9:
	print(99, 100)
elif b - a <= 1 and b - a >= 0:
	bvalue = b * 100
	avalue = bvalue - 1
	while avalue // 100 != a:
		avalue += 1
		bvalue += 1
	print(avalue, bvalue)
else:
	print(-1)


import sys as _sys

def main():
	(d_a, d_b) = _read_ints()
	if d_a == d_b:
		a = d_a * 10
	elif d_b == d_a + 1:
		a = d_a * 10 + 9
	elif d_b == 1 and d_a == 9:
		a = 9
	else:
		a = None
	if a is not None:
		b = a + 1
		print(a, b)
	else:
		print(-1)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split())
main()


(da, db) = list(input().split())
if 0 <= int(db) - int(da) <= 1:
	if da == db:
		print(da + '0' + '0', db + '0' + '1')
		exit(0)
	else:
		print(da + '9' + '9', db + '0' + '0')
		exit(0)
if int(da) + 1 == int(db + '0'):
	print(da, db + '0')
else:
	print(-1)


s = input().split()
da = int(s[0])
db = int(s[1])
if da == db:
	print(da * 100 + 2, da * 100 + 3)
	exit()
if da == db - 1:
	print(da * 100 + 99, db * 100)
	exit()
if da == 9 and db == 1:
	print(999, 1000)
	exit()
print(-1)


(a, b) = input().split()
a = int(a)
b = int(b)
if b - a == 1:
	print(str(a) + '99' + ' ' + (str(b) + '00'))
elif a == 9 and b == 1:
	print('9 10')
elif a == b:
	print(str(a) + '22', str(a) + '23')
else:
	print(-1)


(da, db) = input().split()
nda = int(da)
ndb = int(db)
if ndb - nda == 1:
	a = int(da + '9')
	b = int(db + '0')
	print(a, b)
elif ndb == nda:
	a = int(da + '0')
	b = int(db + '1')
	print(a, b)
elif nda == 9 and ndb == 1:
	a = int(da + '9')
	b = int(db + '00')
	print(a, b)
else:
	print(-1)


(n, m) = map(int, input().split())
if n == m:
	print(str(n) + '1', str(m) + '2')
elif n + 1 == m:
	print(n, m)
elif n == 9 and m == 1:
	print(9, 10)
else:
	print(-1)


(x, y) = map(int, input().split())
if x == y:
	print(str(x) + '0 ' + str(y) + '1')
elif y == x + 1:
	print(str(x) + '9 ' + str(y) + '0')
elif x == 9 and y == 1:
	print('99 100')
else:
	print(-1)


(a, b) = [int(s) for s in input().split()]
if a == b:
	print(a * 10, a * 10 + 1)
elif a + 1 == b:
	print(a, b)
elif (a + 1) // 10 == b:
	print(a, b * 10)
else:
	print(-1)


(a, b) = map(int, input().split())
if a == b:
	print(str(a) + '78', str(b) + '79')
elif a + 1 == b:
	print(str(a) + '99', str(b) + '00')
elif a == 9 and b == 1:
	print(str(99), str(100))
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10, sep=' ')
elif a > b:
	print(-1)
elif abs(a - b) >= 2:
	print(-1)
elif b - a == 1:
	print(str(min(a, b)) + str(9), str(max(a, b)) + str(0), sep=' ')
else:
	print(str(a) + str(1), str(b) + str(2), sep=' ')


(da, db) = [int(i) for i in input().split()]
if da == db:
	print(str(da) + '0', str(db) + '1')
elif da == 9 and db == 1:
	print(99, 100)
elif da + 1 == db:
	print(str(da) + '9', str(db) + '0')
else:
	print(-1)


s = input()
(q1, q2) = s.split()
q1 = int(q1)
q2 = int(q2)
a = 0
b = 0
if q1 == 0 or q2 == 0:
	print(-1)
elif q1 == q2 - 1:
	a = q1
	b = q2
	print(a, ' ', b)
elif q1 == q2:
	a = q1 * 10 + 1
	b = q2 * 10 + 2
	print(a, ' ', b)
elif q1 == 9 and q2 == 1:
	a = 9
	b = 10
	print(a, ' ', b)
else:
	print(-1)


b = list(map(int, input().split()))
f = abs(b[0] - b[1])
g = b[0] + b[1]
d = str(max(b))
l = str(min(b))
if f == 1 and b[0] < b[1]:
	print(str(b[0]) + '9', str(b[1]) + '0')
elif f == 0:
	print(str(b[0]) + '1', str(b[1]) + '2')
elif int(d[-1]) - int(l) == 8 and b[0] > b[1]:
	print(max(b), str(min(b)) + '0' * len(d))
else:
	print(-1)


digits_map = map(int, input().split())
digits = list(digits_map)
if digits[0] == digits[1] - 1:
	print('%s %s' % (digits[0], digits[1]))
elif digits[0] == digits[1]:
	print('%s0 %s1' % (digits[0], digits[1]))
elif digits[0] == 9 and digits[1] == 1:
	print('%s %s' % (9, 10))
else:
	print(-1)


(a, b) = [int(m) for m in input().split()]
if a == b:
	print(str(a) + '1', str(b) + '2')
elif a + 1 == b:
	print(a, b)
elif a == 9 and b == 1:
	print(9, 10)
else:
	print(-1)


str = input()
str = str.split(' ')
(da, db) = (int(str[0]), int(str[1]))
if (da, db) == (9, 1):
	print(9, 10)
elif da == db:
	print(da * 10, da * 10 + 1)
elif db - da == 1:
	print(db * 10 - 1, db * 10)
else:
	print(-1)


import math
maxi = [int(x) for x in input().split()]
if maxi[0] - maxi[1] != -1 and maxi[0] != maxi[1] and (maxi[0] - maxi[1] != 8):
	print('-1')
elif maxi[0] == maxi[1]:
	print(str(maxi[0]) + '1' + ' ' + str(maxi[1]) + '2')
elif maxi[0] - maxi[1] == 8:
	print(str(maxi[0]) + ' ' + str(maxi[1]) + '0')
elif maxi[0] != 9:
	print(str(maxi[0]) + '9' + ' ' + str(maxi[1]) + '0')
else:
	print(-1)


(a, b) = map(int, input().split())
if a == 9 and b == 1:
	print(9, 10)
	exit()
if abs(a - b) > 1:
	print(-1)
	exit()
if a - b == 0:
	print(a, '00', ' ', a, '01', sep='')
	exit()
if a - b == 1:
	print(-1)
	exit()
print(a, '99', ' ', b, '00', sep='')


nums = list(map(int, input().split()))
if nums[0] == nums[1]:
	print(nums[0] * 100, nums[0] * 100 + 1)
elif nums[0] + 1 == nums[1]:
	print(nums[0] * 100 + 99, nums[1] * 100)
elif nums[0] == 9 and nums[1] == 1:
	print(nums[0] * 10 + 9, nums[1] * 100)
else:
	print(-1)


(a, b) = map(int, input().split())
if b - a == 1:
	print('{}99 {}00'.format(a, b))
elif b == 1 and a == 9:
	print('9 10')
elif a == b:
	print('{}0 {}1'.format(a, b))
else:
	print(-1)


(c, d) = map(int, input().split())
if c == d:
	print(c * 100 + 12, d * 100 + 13)
elif d - c == 1:
	print(c, d)
elif c - d == 8:
	print(c, d * 10)
else:
	print(-1)


a = input()
b = int(a[2])
a = int(a[0])
if b == 0:
	print(-1)
elif a == b:
	print(str(a) + '1', str(b) + '2')
elif a == b - 1:
	print(str(a) + '9', str(b) + '0')
elif a == 9 and b == 1:
	print(99, 100)
else:
	print(-1)


(m, n) = map(int, input().split())
if n == m:
	print(m * 100, m * 100 + 1)
elif n - m == 1:
	print(n * 100 - 1, n * 100)
elif m == 9 and n == 1:
	print(m, m + 1)
else:
	print('-1')


(a, b) = map(int, input().split())
if a + 1 == b:
	print(a, 9, ' ', b, 0, sep='')
elif a == b:
	print(a, 0, 1, ' ', b, 0, 2, sep='')
elif a == 9 and b == 1:
	print(99, 100)
else:
	print(-1)


a = [int(i) for i in input().split()]
if a[1] == a[0] + 1:
	print(int(str(a[0]) + '9'), a[1] * 10)
elif a[0] == a[1]:
	n = int(str(a[0]) + '1')
	print(n, n + 1)
elif a[0] == 9 and a[1] == 1:
	print(9, 10)
else:
	print(-1)


(a1, b1) = map(int, input().split())
if a1 == 9 and b1 == 1:
	print(999, 1000)
elif a1 - b1 > 1:
	print(-1)
elif b1 - a1 > 1:
	print(-1)
elif a1 == b1:
	print(a1 * 100 + 12, b1 * 100 + 13)
elif a1 < b1:
	print(a1 * 100 + 99, b1 * 100)
elif a1 > b1:
	print(-1)


a = list(map(int, input().split(' ')))
nb1 = a[0]
nb2 = a[1]
if nb1 != nb2 and nb1 + 1 != nb2:
	if nb1 + 1 == nb2:
		print(nb1, nb2 * 10)
	elif nb1 == 9 and nb2 == 1:
		print('9 ', '10')
	else:
		print('-1')
elif nb1 < nb2:
	print(nb1 * 100 + 99, ' ', nb2 * 100)
elif nb1 == nb2:
	print(nb1 * 100 + 12, ' ', nb2 * 100 + 13)


(x, y) = input().split()
if x == y:
	print(x + '0', y + '1')
elif int(x) + 1 == int(y):
	print(x + '9', y + '0')
elif x + y == '91':
	print(9, 10)
else:
	print(-1)


(a, b) = [int(i) for i in input().split()]
if a == b:
	print(a * 100 + 1, a * 100 + 2)
elif a == b - 1:
	print(a * 100 + 99, b * 100)
elif a == 9 and b == 1:
	print(99, 100)
else:
	print(-1)