You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.


-----Input-----

The single line of the input contains a pair of integers m, s (1 ≤ m ≤ 100, 0 ≤ s ≤ 900) — the length and the sum of the digits of the required numbers.


-----Output-----

In the output print the pair of the required non-negative integer numbers — first the minimum possible number, then — the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes).


-----Examples-----
Input
2 15

Output
69 96

Input
3 0

Output
-1 -1

Difficulty: MEDIUM
Tags: Dynamic programming

Implementation

Greedy algorithms
Skill types: Dynamic programming

Greedy algorithms

Starter code:

Solutions:
from collections import defaultdict
(n, k) = map(int, input().split())
if k > 9 * n:
	print('-1 -1')
elif k == 0:
	if n == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	s = [0] * (n - 1)
	s = [1] + s
	curr = n - 1
	for _ in range(k - 1):
		s[curr] += 1
		if s[curr] == 9:
			curr -= 1
	print(*s, sep='', end=' ')
	s = [0] * n
	curr = 0
	for _ in range(k):
		s[curr] += 1
		if s[curr] == 9:
			curr += 1
	print(*s, sep='', end=' ')


(m, s) = map(int, input().split())
if s == 0:
	print('0 0' if m == 1 else '-1 -1')
	exit()
a = '9' * (s // 9)
if s % 9 > 0:
	a += f'{s % 9}'
if len(a) > m:
	print('-1 -1\n')
	exit()
max_ans = a
while len(a) < m:
	a = a[:-1] + f'{int(a[-1]) - 1}'
	while len(a) < m - 1:
		a += '0'
	a += '1'
min_ans = a[::-1]
while len(max_ans) < m:
	max_ans += '0'
print(f'{min_ans} {max_ans}')


(m, s) = map(int, input().split())
if s == 0 and m != 1:
	print(-1, -1)
elif s > m * 9:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif s < 10:
	print(1 * 10 ** (m - 1) + (s - 1), s * 10 ** (m - 1))
else:
	(number, number2) = (0, 0)
	a = (s - 1) // 9
	b = s // 9
	for i in range(a):
		number = number + 9 * 10 ** i
	if m - a > 1:
		number += 1 * 10 ** (m - 1) + (s - a * 9 - 1) * 10 ** a
	else:
		number += (s - a * 9) * 10 ** (m - 1)
	for i in range(1, b + 1):
		number2 += 9 * 10 ** (m - i)
	number2 += s % 9 * 10 ** max(0, m - b - 1)
	print(number, number2)


def fail():
	print(-1, -1)
	exit()
read = lambda : map(int, input().split())
(m, s) = read()
cnt = s // 9
x = s % 9
if cnt + (x > 0) > m:
	fail()
if s == 0 and m > 1:
	fail()
Max = '9' * cnt
if x:
	Max += str(x)
Max += '0' * (m - len(Max))
Min = list(Max[::-1])
if Min[0] == '0' and s:
	Min[0] = '1'
	for i in range(1, m):
		if Min[i] != '0':
			Min[i] = str(int(Min[i]) - 1)
			break
Min = ''.join(Min)
print(Min, Max)


b = list(map(int, input().split(' ')))
le = b[0]
su = b[1]
sol = list()
if le == 1 and su == 0:
	print('0 0')
elif 9 * le >= su and su > 0:
	for a in range(le):
		if su - 9 > 0:
			sol.append('9')
			su -= 9
		else:
			sol.append('{}'.format(su))
			su -= su
	su = b[1]
	sol2 = list()
	for a in range(le):
		sol2.append('{}'.format(su - 9 * (le - a - 1)) if 9 * (le - a - 1) < su else '0')
		if a == 0 and sol2[a] == '0':
			sol2[a] = '1'
		su -= int(sol2[a])
	print(''.join(sol2), ''.join(sol))
else:
	print('-1 -1')


(m, s) = [int(i) for i in input().split()]
if s == 0 and m != 1 or 9 * m < s:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	mx = ''
	ms = s
	while ms != 0:
		if ms > 9:
			mx += '9'
			ms -= 9
		else:
			mx += str(ms)
			ms = 0
	mx += '0' * (m - len(mx))
	mn = ''
	while s != 1:
		if s > 9:
			mn += '9'
			s -= 9
		else:
			mn += str(s - 1)
			s = 1
	mn += '0' * (m - len(mn))
	mn = (mn[:-1] + str(int(mn[-1]) + 1))[::-1]
	print(mn, mx)


(m, s) = list(map(int, input().split()))
smin = s
lstmax = [0 for i in range(m)]
lstmin = [0 for i in range(m)]
for i in range(m):
	if s == 0:
		lstmax[i] = 0
	elif s >= 9:
		lstmax[i] = 9
		s -= 9
	else:
		lstmax[i] = s
		s = 0
if m == 1 and smin == 0:
	print(0, 0)
elif s == 0 and smin != 0:
	lstmin = lstmax[::-1]
	if lstmin[0] == 0:
		lstmin[0] = 1
		j = 1
		while lstmin[j] == 0:
			j += 1
		lstmin[j] -= 1
	for i in range(len(lstmin)):
		print(lstmin[i], end='')
	print(' ', end='')
	for i in range(len(lstmax)):
		print(lstmax[i], end='')
else:
	print(-1, -1)


def get_smallest(m, s):
	n = []
	for i in range(m):
		if 9 < s:
			n.append(9)
			s -= 9
		else:
			n.append(s - 1)
			s -= s - 1
	n[-1] += 1
	return ''.join((str(i) for i in n[::-1]))

def get_biggest(m, s):
	n = []
	for i in range(m):
		n.append(min(9, s))
		s -= n[-1]
	return ''.join((str(i) for i in n))
(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and 1 < m):
	print('-1 -1')
else:
	print(get_smallest(m, s) + ' ' + get_biggest(m, s))


def main():
	(m, s) = map(int, input().split())
	s1 = s
	if s == 0 and m == 1:
		print(0, 0)
	elif s < 1 or s > 9 * m:
		print('-1 -1')
	else:
		probmax = [0] * m
		for i in range(m - 1):
			if s1 > 9:
				probmax[i] = 9
				s1 -= 9
		probmax[-1] = s - sum(probmax)
		probmax.sort(reverse=True)
		probmin = [0] * m
		if s < 9 * (m - 1) + 2:
			probmin[0] = 1
			for i in range(m - 1):
				if s <= 9 * (m - i - 2):
					probmin[i + 1] = 0
				elif s <= 9 * (m - i - 1):
					probmin[i + 1] = s - 1 - 9 * (m - i - 2)
				else:
					probmin[i + 1] = 9
		else:
			probmin[0] = s - 9 * (m - 1)
			for i in range(m - 1):
				probmin[i + 1] = 9
		print(''.join([str(number) for number in probmin]), ''.join([str(number) for number in probmax]))
main()


(l, s) = map(int, input().split())
if s > l * 9 or (s == 0 and l != 1):
	print(-1, -1)
elif s == 0 and l == 1:
	print(0, 0)
else:
	maximo = []
	while sum(maximo) + 9 < s:
		maximo += [9]
	maximo += [s - sum(maximo)]
	for _ in range(l - len(maximo)):
		maximo += [0]
	minimo = maximo[::-1]
	if 0 in minimo:
		minimo[0] = 1
		for i in range(1, len(minimo)):
			if minimo[i] != 0:
				minimo[i] -= 1
				break
	print(''.join(map(str, minimo)), ''.join(map(str, maximo)))


(m, s) = map(int, input().split())

def small(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	a = [0 for i in range(m + 1)]
	s = s - 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			a[i] = 9
			s = s - 9
		else:
			a[i] = s
			s = 0
	a[0] = s + 1
	return a

def large(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	a = [0 for i in range(m + 1)]
	for i in range(0, m):
		if s >= 9:
			a[i] = 9
			s = s - 9
		else:
			a[i] = s
			s = 0
	return a
z1 = small(m, s)
z2 = large(m, s)
if type(z1) == list or type(z2) == list:
	for i in range(len(z1) - 1):
		print(z1[i], end='')
	print(end=' ')
	for i in range(len(z2) - 1):
		print(z2[i], end='')
else:
	print(z1, z2)


from math import floor
(tam, soma) = [int(i) for i in input().split()]

def canRepresent(tam, soma):
	return 9 * tam >= soma if tam > 0 and soma > 0 else soma == 0
minimun = []
current = soma
if soma >= 1 and canRepresent(tam, soma):
	for i in range(tam):
		digit = 0
		for j in range(0, 10):
			if i == 0 and j == 0:
				continue
			if canRepresent(tam - i - 1, current - j):
				digit = j
				break
		current -= digit
		print(digit, end='')
	print(' ', end='')
	current = soma
	for i in range(tam):
		digit = 0
		for j in range(9, -1, -1):
			if canRepresent(tam - i - 1, current - j):
				digit = j
				break
		current -= digit
		print(digit, end='')
	print()
elif soma == 0 and tam == 1:
	print('0 0')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
s1 = s
if m == 1:
	if s > 9:
		print(-1, -1)
	else:
		print(s, s)
elif s > m * 9 or s < 1:
	print(-1, -1)
else:
	s1 -= 1
	popa = ['0'] * m
	popa[0] = '1'
	for i in range(m):
		if s1 < 9:
			popa[m - 1 - i] = str(int(popa[m - 1 - i]) + s1)
			s1 = 0
		else:
			s1 -= 9
			popa[m - 1 - i] = '9'
	n1 = ''.join(popa)
	popa = ['0'] * m
	s1 = s
	for i in range(m):
		if s1 < 9:
			popa[i] = str(int(popa[i]) + s1)
			s1 = 0
		else:
			s1 -= 9
			popa[i] = '9'
	n2 = ''.join(popa)
	print(n1, n2)


import sys
import math
from sys import stdin, stdout

def sieve(N):
	primeNumbers = [True] * (N + 1)
	primeNumbers[0] = False
	primeNumbers[1] = False
	i = 2
	while i * i <= N:
		j = i
		if primeNumbers[j]:
			while j * i <= N:
				primeNumbers[j * i] = False
				j += 1
		i += 1
	return primeNumbers

def getPrime(N):
	primes = sieve(N)
	result = []
	for i in range(len(primes)):
		if primes[i]:
			result.append(i)
	return result

def factor(N):
	factors = []
	i = 1
	while i * i <= N:
		if N % i == 0:
			factors.append(i)
			if i != N // i:
				factors.append(N // i)
		i += 1
	return sorted(factors)

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

def extendedGcd(a, b):
	if a < b:
		return extendedGcd(b, a)
	if b == 0:
		return [a, 1, 0]
	res = extendedGcd(b, a % b)
	x = res[2]
	y = res[1] - math.floor(a / b) * res[2]
	res[1] = x
	res[2] = y
	return res

def iterativeModularFunc(a, b, c):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % c
		a = a * a % c
		b = b // 2
	return res

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(input())

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

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

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

def Solution(m, s):
	if m > 1 and s == 0:
		print(-1, -1)
		return
	if m == 1 and s < 10:
		print(s, s)
		return
	res = ''
	digit = 9 if s > 9 else s
	for i in range(m):
		res += str(min(s, digit))
		s -= digit
		if s < 10:
			digit = s
	if s == 0:
		arr = list(reversed([c for c in res]))
		if arr[0] == '0':
			arr[0] = '1'
			for i in range(1, len(arr)):
				if arr[i] != '0':
					arr[i] = str(int(arr[i]) - 1)
					break
		print(''.join(arr), res)
	else:
		print(-1, -1)

def main():
	(m, s) = get_ints_in_variables()
	Solution(m, s)
main()


a = input()
m = int(a.split()[0])
s = int(a.split()[1])
if s == 0 and m > 1 or 9 * m < s:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	list1 = []
	temp1 = s
	while temp1 > 9:
		temp1 -= 9
		list1.append('9')
	list1.append(str(temp1))
	while len(list1) < m:
		list1.append('0')
	b = ''.join(list1)
	list2 = []
	temp2 = s
	while temp2 > 9:
		temp2 -= 9
		list2.insert(0, '9')
	list2.insert(0, str(temp2))
	while len(list2) < m:
		list2.insert(0, '0')
	if '0' not in list2:
		a = ''.join(list2)
	else:
		t = list2.count('0')
		temp3 = int(list2[t]) - 1
		list2[t] = str(temp3)
		list2[0] = '1'
		a = ''.join(list2)
	print(a, b)


(m, s) = [int(x) for x in input().split()]
mindsum = 1
maxdsum = 9 * m
if m == 1 and s == 0:
	print(0, 0)
elif s < mindsum or s > maxdsum:
	print(-1, -1)
else:
	mncount = s // 9
	mrest = s % 9
	if mncount == m:
		mnum = '9' * m
	elif mncount == m - 1:
		if mrest == 0:
			mnum = '1' + '8' + '9' * (mncount - 1)
		else:
			mnum = str(mrest) + '9' * mncount
	elif mrest == 0:
		zerocount = m - 2 - mncount + 1
		mnum = '1' + '0' * zerocount + '8' + '9' * (mncount - 1)
	elif mrest == 1:
		zerocount = m - 1 - mncount
		mnum = '1' + '0' * zerocount + '9' * mncount
	else:
		zerocount = m - 2 - mncount
		mnum = '1' + '0' * zerocount + str(mrest - 1) + '9' * mncount
	maxnum = ''
	t = s
	while t >= 9:
		maxnum += '9'
		t -= 9
	if mncount != m:
		maxnum += str(t)
		while len(maxnum) != m:
			maxnum += '0'
	print(mnum, maxnum)


def isPossible(s, m):
	return s >= 0 and s <= 9 * m

def findMinimun(m, s):
	num = 0
	for index in range(m, 0, -1):
		flag = True
		for digit in range(10):
			if index == m and digit == 0 and (m > 1):
				continue
			if isPossible(s - digit, index - 1):
				flag = False
				num = num * 10 + digit
				s -= digit
				break
		if flag:
			return -1
	return num

def findMaximum(m, s):
	num = 0
	for index in range(m, 0, -1):
		flag = True
		for digit in range(9, -1, -1):
			if index == m and digit == 0 and (m > 1):
				continue
			if isPossible(s - digit, index - 1):
				flag = False
				num = num * 10 + digit
				s -= digit
				break
		if flag:
			return -1
	return num
(m, s) = tuple(map(int, input().split()))
print(findMinimun(m, s), findMaximum(m, s))


(m, s) = [int(i) for i in input().split()]
if s == 0 and m == 1:
	print('0 0')
	exit()
if s == 0 or s > 9 * m:
	print('-1 -1')
	exit()
max_ = ''
min_ = ''
a = s
for i in range(m):
	if a >= 9:
		max_ += str(9)
	elif a < 0:
		max_ += str(0)
	else:
		max_ += str(a)
	if a > 9:
		min_ = str(9) + min_
	elif i != m - 1:
		if a > 1:
			min_ = str(a - 1) + min_
		else:
			min_ = str(0) + min_
	elif i == m - 1 and a >= 1:
		min_ = str(a) + min_
	else:
		min_ = str(1) + min_
	a -= 9
print(min_, max_)


a = [int(x) for x in input().split()]
safer = a[1]
mini = 0
maxi = 0
last_not_nime = 0
for x in range(a[0]):
	if a[1] > 9:
		maxi += 10 ** (a[0] - x - 1) * 9
		a[1] -= 9
	else:
		if a[1] != 0:
			last_not_nime = a[0] - x
		maxi += 10 ** (a[0] - x - 1) * a[1]
		a[1] = 0
if maxi == 0 and a[0] != 1 or a[1] != 0:
	print('-1 -1')
else:
	if maxi <= 10 or safer == 1:
		mini = maxi
	elif maxi % 10 == 0:
		mini = maxi + 1 - 10 ** (last_not_nime - 1)
		mini = str(mini)
		mini = mini[::-1]
	else:
		mini = maxi
		mini = str(mini)
		mini = mini[::-1]
	print(mini, maxi)


def minmax(m, n):
	max = ''
	while m:
		while n:
			if n < 10:
				max += str(n)
				n = 0
			else:
				max += '9'
				n -= 9
			m -= 1
		if m:
			max += '0'
			m -= 1
	return max
x = [int(i) for i in list(input().split())]
if x[0] == 1 and x[1] == 0:
	print(0, 0)
elif x[1] > 9 * x[0] or x[1] == 0:
	print(-1, -1)
else:
	j = minmax(x[0], x[1])
	h = j[::-1]
	if h[0] == '0':
		i = 1
		while h[i] == '0':
			i += 1
		t = int(h[i]) - 1
		h = '1' + h[1:i] + str(t) + h[i + 1:]
	print(h + ' ' + j)


__author__ = 'Rakshak.R.Hegde'
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s / m > 9 or s == 0:
	print('-1 -1')
else:
	num = [9] * m
	psum = 9 * m
	minDiff = min(8, psum - s)
	num[0] -= minDiff
	psum -= minDiff
	for i in range(1, m):
		minDiff = min(9, psum - s)
		num[i] -= minDiff
		psum -= minDiff
		if psum == s:
			break
	n1 = ''
	for i in num:
		n1 += str(i)
	num = [9] * m
	psum = 9 * m
	for i in range(-1, -m - 1, -1):
		minDiff = min(9, psum - s)
		num[i] -= minDiff
		psum -= minDiff
		if psum == s:
			break
	n2 = ''
	for i in num:
		n2 += str(i)
	print(n1 + ' ' + n2)


(m, s) = map(int, input().split())
op1 = []
op2 = []

def ismax(m, s):
	if s == 0 or s > 9 * m:
		return '-1'
	else:
		for i in range(m):
			if s > 9:
				op2.append('9')
				s -= 9
			elif 1 <= s <= 9:
				op2.append(str(s))
				s = 0
			else:
				op2.append('0')
		return int(''.join(op2))

def ismin(m, s):
	if s == 0 or s > 9 * m:
		return '-1'
	elif m > int((s - 1) / 9) + 1:
		s = s - 1
		for i in range(m - 1):
			if s > 9:
				op1.append('9')
				s -= 9
			elif 1 <= s <= 9:
				op1.append(str(s))
				s = 0
			else:
				op1.append('0')
		op1.reverse()
		newop1 = ['1'] + op1
		return int(''.join(newop1))
	elif s % 9 == 0:
		return int(10 ** m - 1)
	else:
		return int(10 ** m - 1 - (9 - s % 9) * 10 ** (m - 1))
if m == 1 and s == 0:
	print('0 0')
else:
	print('{0} {1}'.format(ismin(m, s), ismax(m, s)))


from copy import *
(m, s) = map(int, input().split())

def can(length, total):
	return length * 9 >= total >= 0
loans = ''
s1 = copy(s)
for i in range(m):
	for d in range(10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, s1 - d):
			loans += chr(ord('0') + d)
			s1 -= d
			break
hians = ''
s2 = copy(s)
for i in range(m):
	for d in range(9, -1, -1):
		if can(m - i - 1, s2 - d):
			hians += chr(ord('0') + d)
			s2 -= d
			break
if s == 0 and m == 1:
	print(0, 0)
elif s == 0:
	print(-1, -1)
elif not can(m, s):
	print('-1 -1')
else:
	print(loans, hians)


(m, s) = map(int, input().split())
maxstring = []
if s > m * 9 or (s == 0 and m != 1):
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	while s > 9:
		maxstring.append(9)
		s = s - 9
	maxstring.append(s)
	maximum = maxstring + (m - len(maxstring)) * [0]
	minimum = maximum[len(maximum)::-1]
	if minimum[0] == 0:
		minimum[minimum.count(0)] = minimum[minimum.count(0)] - 1
		minimum[0] = 1
	minn = ''.join((str(i) for i in minimum))
	maxx = ''.join((str(i) for i in maximum))
	print(minn, maxx)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
	exit()
if not 1 <= s <= 9 * m:
	print(-1, -1)
	exit()
s_copy = s
ans1 = ''
for i in range(m):
	left = m - i - 1
	max_rem = s - left * 9
	if max_rem <= 0:
		if i == 0:
			ans1 += '1'
			s -= 1
		else:
			ans1 += '0'
	elif max_rem <= 9:
		ans1 += str(s - left * 9)
		s -= s - left * 9
ans2 = ''
for i in range(m):
	if s_copy >= 9:
		ans2 += '9'
		s_copy -= 9
	elif s_copy > 0:
		ans2 += str(s_copy)
		s_copy = 0
	else:
		ans2 += '0'
print(ans1, ans2)


x = input()
y = x.split()
n = int(y[0])
summ = int(y[1])
maxlist = list()
if summ > n * 9:
	print('-1 -1')
elif n > 1 and summ == 0:
	print('-1 -1')
elif n == 1 and summ == 0:
	print('0 0')
else:
	for i in range(9):
		nn = 9 - i
		while summ >= int(nn):
			summ -= int(nn)
			maxlist.append(str(nn))
	leng = len(maxlist)
	rest = int(n - leng)
	if rest == 0:
		maxm = int(''.join(maxlist))
		maxlist.reverse()
		mini = int(''.join(maxlist))
		print('%d %d' % (mini, maxm))
	else:
		numb = ''.join(maxlist)
		numbs = str(int(numb) - 1)
		maxm = int(numb + str(0) * rest)
		sb = list(numbs)
		sb.reverse()
		sbb = ''.join(sb)
		mini = int(str(1) + str(0) * (rest - 1) + sbb)
		print('%d %d' % (mini, maxm))


(m, s) = map(int, input().split())
sr = ''
if s == 0 and m > 1:
	print('-1 -1')
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
while s >= 9:
	s -= 9
	sr += '9'
if s == 8:
	s -= 8
	sr += '8'
if s == 7:
	s -= 7
	sr += '7'
if s == 6:
	s -= 6
	sr += '6'
if s == 5:
	s -= 5
	sr += '5'
if s == 4:
	s -= 4
	sr += '4'
if s == 3:
	s -= 3
	sr += '3'
if s == 2:
	s -= 2
	sr += '2'
if s == 1:
	s -= 1
	sr += '1'
k = len(sr)
if k > m:
	print('-1 -1')
	exit()
elif k == m:
	print(sr[::-1], sr)
	exit()
zeroes = 0
while zeroes < len(sr) and sr[zeroes] != '0':
	zeroes += 1
temp = sr[zeroes - 1::-1]
digit = int(temp[0]) - 1
print('1' + '0' * (m - len(temp) - 1) + str(digit) + temp[1:], end=' ')
sr += '0' * (m - k)
print(sr)


import sys
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	sys.exit()
tas = s
a = [0] * m
a[0] = 1
tas -= 1
index = m - 1
while tas > 0:
	if index == -1:
		break
	a[index] += 1
	if a[index] == 9:
		index -= 1
	tas -= 1
res = [-1, -1]
if tas == 0:
	res[0] = 0
	for i in a:
		res[0] = res[0] * 10 + i
tbs = s
b = [0] * m
b[0] = 1
tbs -= 1
index = 0
while tbs > 0:
	if index == m:
		break
	b[index] += 1
	if b[index] == 9:
		index += 1
	tbs -= 1
if tbs == 0:
	res[1] = 0
	for i in b:
		res[1] = res[1] * 10 + i
print(res[0], res[1])


(m, s) = map(int, input().split())
minans = []
maxans = []
m1 = 0
m2 = 0
if s > 9 * m:
	minans.append(0)
	maxans.append(0)
	(m1, m2) = (-1, -1)
elif s == 0:
	if m == 1:
		(m1, m2) = (0, 0)
	else:
		(m1, m2) = (-1, -1)
else:
	i = 1
	num = 1
	while num <= 9:
		if num + (m - i) * 9 >= s - sum(minans):
			minans.append(num)
			m1 += num * pow(10, m - i)
			break
		num += 1
	if m > 1:
		i = 2
		while i <= m:
			num = 0
			while num <= 9:
				if num + (m - i) * 9 >= s - sum(minans):
					minans.append(num)
					m1 += num * pow(10, m - i)
					break
				num += 1
			i += 1
	j = 1
	while j <= m:
		num = 9
		while num >= 0:
			if num > s - sum(maxans):
				pass
			else:
				maxans.append(num)
				m2 += num * pow(10, m - j)
				break
			num -= 1
		j += 1
print(m1, m2)


import math
(m, s) = input().split()
m = int(m)
s = int(s)
if s < 1 and m > 1 or s > 9 * m:
	print(-1, -1)
	exit()
k = s
for i in range(m - 1, -1, -1):
	j = max(0, k - 9 * i)
	if j == 0 and i == m - 1 and k:
		j = 1
	print(j, end='')
	k -= j
print(' ', end='')
k = s
for i in range(m - 1, -1, -1):
	j = min(9, k)
	print(j, end='')
	k -= j
print(' ', end='')


from collections import defaultdict
import math
import sys

def solve():
	(m, s) = [int(i) for i in input().split(' ')]
	if s == 0 and m > 1:
		print(-1, -1)
	elif s == 0 and m == 1:
		print(0, 0)
	else:
		if s > 9 * m:
			print(-1, -1)
			return
		largest = 0
		invariant = s
		length = m
		while invariant > 0:
			for i in range(9, -1, -1):
				if invariant - i >= 0:
					largest = largest * 10 + i
					length -= 1
					invariant -= i
					break
		largest = largest * 10 ** length
		smallest = 0
		length = m
		invariant = s
		while invariant > 0:
			if invariant == s:
				lo = 1
			else:
				lo = 0
			if invariant != s and invariant < 9 * (length - 1):
				smallest *= 10
				length -= 1
			else:
				for i in range(lo, 10):
					if invariant - i <= 9 * (length - 1):
						smallest = smallest * 10 + i
						length -= 1
						invariant -= i
						break
		smallest = smallest * 10 ** length
		print(smallest, largest)
solve()


R = lambda : map(int, input().split())
(l, s) = R()
ss = (str(s % 9) if s % 9 else '') + '9' * (s // 9)
if not ss:
	print('-1 -1' if l > 1 else '0 0')
	exit(0)
if len(ss) > l:
	print('-1 -1')
else:
	if len(ss) < l:
		if ss[0] > '1':
			smi = '1' + '0' * (l - len(ss) - 1) + str(int(ss[0]) - 1) + ss[1:]
		else:
			smi = ss[0] + '0' * (l - len(ss)) + ss[1:]
		smx = ss[::-1] + '0' * (l - len(ss))
	else:
		smi = ss
		smx = ss[::-1]
	print(smi, smx, sep=' ')


(n, m) = map(int, input().split())
mx = ''
mn = [0] * 109
o = 0

def f(x, sz):
	for i in range(sz):
		x += '0'
	return x
if m == 0 and n == 1:
	print('0 0')
	exit()
if m == 0 or m > n * 9:
	print('-1 -1')
	exit()
k = m
for i in range(9, 0, -1):
	while k - i >= 0:
		k -= i
		mx += chr(i + 48)
sz = szmn = n - 1
k = m
for i in range(1, 10):
	if sz == 0:
		break
	while k - i >= 0 and o == 0:
		if sz == 0:
			break
		j = (k - i) // sz + ((k - i) % sz != 0)
		if j <= 9:
			mn[0] = i
			k -= i
			sz -= 1
			o = 1
		else:
			break
for i in range(9, 0, -1):
	while k - i >= 0:
		k -= i
		mn[szmn] = i
		szmn -= 1
mx = f(mx, n - len(mx))
for i in range(n):
	print(mn[i], end='', sep='')
print(' ' + mx)


(m, s) = map(int, input().split())
lis = []
lis1 = []
b = s - 1
if s == 0 and m > 1 or s > m * 9:
	print('-1 -1')
	exit()
for i in range(m):
	if s > 9:
		s -= 9
		lis.append(9)
	else:
		lis.append(s)
		s -= s
for i in range(m - 1):
	if b > 9:
		lis1.append(9)
		b -= 9
	else:
		lis1.append(b)
		b = 0
if b != 0:
	lis1.append(b + 1)
else:
	lis1.append(1)
print(*lis1[::-1], sep='', end=' ')
print(*lis, sep='')


a = [int(i) for i in input().split()]
m = a[0]
s = a[1]
h = [0] * m
x = 0
for d in range(m):
	for i in range(1, 10):
		if x < s:
			h[d] = h[d] + 1
			x = x + 1
x = 0
q = [0] * m
q[0] = 1
x = 1
for d in range(m - 1, -1, -1):
	for i in range(1, 10):
		if x < s:
			q[d] = q[d] + 1
			x = x + 1
if s > m * 9:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif s == 0 or m == 0:
	print('-1 -1')
else:
	num1 = ''.join([str(f) for f in h])
	num2 = ''.join([str(f) for f in q])
	print(num2 + ' ' + num1)


(m, s) = map(int, input().split())
i = 0
strok = ''
s1 = s
while m != i and s > 9:
	i += 1
	s -= 9
else:
	if s1 == 0 and m > 1 or m * 9 < s1:
		print('-1 -1')
	else:
		strok += i * '9'
		m -= i + 1
		if m != 0:
			k = 1
			raz = 1
		else:
			k = ''
			raz = 0
		strok = '0' * m + str(s - raz) + strok
		if k == 1:
			strok = '1' + strok[1:]
		strok2 = ''
		strok2 += i * '9' + str(s) + '0' * m
		if strok2[0] != '0':
			print(strok, strok2, sep=' ')
		else:
			print(strok, strok, sep=' ')


st = input().split()
m = int(st[0])
s = int(st[1])
if m == 1 and s == 0:
	print(0, 0)
elif s > 9 * m or s < 1:
	print(-1, -1)
else:
	n9 = s // 9
	s1 = ''
	for x in range(n9):
		s1 = s1 + '9'
	if len(s1) < m:
		mo = s % 9
		s1 = s1 + str(mo)
		while len(s1) < m:
			s1 = s1 + '0'
	if s > 9 * (m - 1):
		mo = s % 9
		if mo == 0:
			s2 = ''
		else:
			s2 = str(mo)
		while len(s2) < m:
			s2 = s2 + '9'
	else:
		mo = (s - 1) % 9
		s2 = ''
		n9 = (s - 1) // 9
		for x in range(n9):
			s2 = s2 + '9'
		if mo != 0:
			s2 = str(mo) + s2
		while len(s2) < m - 1:
			s2 = '0' + s2
		s2 = '1' + s2
	ans = s2 + ' ' + s1
	print(ans)


def functoin():
	a = [0] * 105
	(m, s) = map(int, input().split())
	if not s:
		if m == 1:
			print('0 0')
		else:
			print('-1 -1')
		return
	for x in range(1, 10):
		tmp = s - x
		for j in range(m - 1, 0, -1):
			if tmp >= 9:
				a[j] = 9
				tmp -= 9
			else:
				a[j] = tmp
				tmp = 0
		if tmp == 0:
			a[0] = x
			break
	if not a[0]:
		print('-1 -1')
		return
	for x in range(m):
		print(a[x], end='')
	print(' ')
	for x in range(m):
		if s >= 9:
			print(9, end='')
			s -= 9
		else:
			print(s, end='')
			s = 0
functoin()


(m, s) = [int(x) for x in input().split()]
if m == 1 and s == 0:
	print('0 0')
elif s <= m * 9 and s != 0:
	n = [0] * m
	n[0] = 1
	p = -1
	for i in range(1, s):
		n[p] += 1
		if n[p] == 9:
			p -= 1
	print(*n, sep='', end=' ')
	n = [0] * m
	n[0] = 1
	p = 0
	for i in range(1, s):
		n[p] += 1
		if n[p] == 9:
			p += 1
	print(*n, sep='')
else:
	print('-1 -1')


(d, s) = map(int, input().split())
small = [0] * d
large = [0] * d
small[0] = 1
smallCurrSum = 1
large[0] = min(9, s)
largeCurrSum = large[0]
smallLeft = s - smallCurrSum
largeLeft = s - largeCurrSum
for x in range(d - 1, 0, -1):
	small[x] = min(9, smallLeft)
	smallLeft -= small[x]
for x in range(1, d):
	large[x] = min(9, largeLeft)
	largeLeft -= large[x]
if smallLeft > 0:
	small[0] = min(8, smallLeft) + 1
	smallLeft -= small[0]
if s == 0:
	small[0] = 0
if s == 0 and d > 1 or smallLeft > 0 or largeLeft > 0:
	print(-1, -1)
else:
	print(''.join(list(map(str, small))), ''.join(list(map(str, large))))


(m, s) = map(int, input().split(' '))
s0 = s
list1 = []
list2 = []
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif s > 9 * m:
	print('-1 -1')
elif m == 1:
	print(s, s, sep=' ')
else:
	for i in range(m):
		if s >= 9:
			list1.append('9')
			s -= 9
		else:
			list1.append(str(s))
			s = 0
	for i in range(m):
		if i != m - 1:
			if s0 >= 10:
				list2.append('9')
				s0 -= 9
			else:
				list2.append(str(s0 - 1))
				s0 = 1
		else:
			list2.append(str(s0))
	list2.reverse()
	print(''.join(list2), ''.join(list1), sep=' ')


__author__ = 'Walnut'
import math
(n, m) = input().split()
n = int(n)
m = int(m)
if m == 0 and n > 1 or m > n * 9:
	print('-1 -1')
elif n == 1:
	print('{0:d} {0:d}'.format(m))
else:
	a = []
	b = []
	tm = m
	tn = n
	if m < (n - 1) * 9 + 1:
		a.append(str(1))
		m = m - 1
		n = n - 1
	for i in range(n):
		if m > (n - 1) * 9:
			t = m - (n - 1) * 9
			a.append(str(t))
			m = m - t
			n = n - 1
		else:
			a.append(str(0))
			n = n - 1
	m = tm
	n = tn
	for i in range(n):
		if m >= 9:
			b.append(str(9))
			m = m - 9
		else:
			b.append(str(m))
			m = 0
	print(''.join(a), ''.join(b))


def get_largest(special, length_digits):
	actual_digits = len(special)
	return special + [0] * (length_digits - actual_digits)

def get_smallest(special, length_digits):
	reversed_special = special[::-1]
	actual_digits = len(reversed_special)
	if length_digits == actual_digits:
		return reversed_special
	reversed_special[0] -= 1
	return [1] + [0] * (length_digits - actual_digits - 1) + reversed_special

def get_special(length_digits, sum_digits):
	digits_needed = sum_digits // 9
	last_digit = sum_digits % 9
	if last_digit > 0:
		digits_needed += 1
	else:
		last_digit = 9
	if length_digits < digits_needed:
		return -1
	special = [9] * (digits_needed - 1) + [last_digit]
	return special

def solve(length_digits, sum_digits):
	if sum_digits == 0 and length_digits == 1:
		return ('0', '0')
	if sum_digits <= 0 and length_digits > 1:
		return ('-1', '-1')
	special = get_special(length_digits, sum_digits)
	if special == -1:
		return ('-1', '-1')
	smallest = get_smallest(special, length_digits)
	largest = get_largest(special, length_digits)
	s1 = [str(i) for i in smallest]
	res1 = int(''.join(s1))
	s2 = [str(i) for i in largest]
	res2 = int(''.join(s2))
	return (res1, res2)
(m, s) = [int(x) for x in input().split()]
solution = solve(m, s)
print(solution[0], solution[1])


from sys import path, stdin, stdout
import array
from functools import lru_cache
input_ = stdin.readline
(size, num) = list(map(int, input_().split()))

def can(num, size):
	if num >= 0 and num <= size * 9:
		return True
	return False
if can(num, size):
	if num < 10 and size == 1:
		print(num, num)
	else:
		s = num
		k = ''
		for i in range(0, size):
			for j in range(0, 10):
				if (i > 0 or j > 0 or (size == 1 and j == 0)) and can(s - j, size - i - 1):
					s -= j
					k += str(j)
					break
		a = k
		k = ''
		for i in range(0, size):
			for j in range(9, -1, -1):
				if (i > 0 or j > 0 or (size == 1 and j == 0)) and can(num - j, size - i - 1):
					num -= j
					k += str(j)
					break
		if (len(a) and len(k)) < size:
			print(-1, -1)
		else:
			print(a, k)
else:
	print(-1, -1)


def solve(var_length, var_sum):
	smallest = ''
	largest = ''
	small_sum = var_sum - 1
	for i in range(var_length - 1):
		if small_sum > 9:
			smallest += '9'
			small_sum -= 9
		else:
			smallest += str(small_sum)
			small_sum = 0
	smallest += str(small_sum + 1)
	for j in range(var_length):
		if var_sum > 9:
			largest += '9'
			var_sum -= 9
		else:
			largest += str(var_sum)
			var_sum = 0
	return [smallest[::-1], largest]
[length, sum_digit] = [int(x) for x in input().split()]
if 0 < sum_digit <= length * 9:
	answer = solve(length, sum_digit)
	print(answer[0], answer[1])
elif length == 1 and sum_digit == 0:
	print(0, 0)
else:
	print(-1, -1)


import sys
(n, s) = map(int, input().split())
if s == 0 or 9 * n < s:
	if s == 0 and n == 1:
		print(0, 0)
	else:
		print(-1, -1)
	sys.exit()
mi = 10 ** (n - 1)
x = s - 1
for i in range(n):
	if x > 9:
		mi += 10 ** i * 9
		x -= 9
	else:
		mi += 10 ** i * x
		break
ma = 0
x = s
for i in range(n)[::-1]:
	if x > 9:
		ma += 10 ** i * 9
		x -= 9
	else:
		ma += 10 ** i * x
		break
print(mi, ma)


(m, s) = [int(__) for __ in input().strip().split()]
(big, small) = ('', '')
if s == 0:
	if m > 1:
		big = '-1'
	else:
		big = '0'
else:
	sc = s * 1
	if s > 9 * m:
		big = '-1'
	else:
		while sc > 0:
			if sc >= 9:
				big += '9'
				sc -= 9
			else:
				big += str(sc)
				sc = 0
	if len(big) != m and big != '-1':
		big += '0' * (m - len(big))
if s == 0:
	if m > 1:
		small = '-1'
	else:
		small = '0'
elif s > 9 * m:
	small = '-1'
else:
	sl = [1]
	s -= 1
	for i in range(m - 1):
		sl.append(0)
	for i in range(m - 1, -1, -1):
		if s <= 0:
			break
		elif s >= 9:
			sl[i] = 9
			s -= 9
		else:
			sl[i] += s
			s = 0
	small = ''.join([str(x) for x in sl])
print(small, big)


def outmax(x):
	if x <= 9:
		return x
	else:
		return 9

def outmaxnum(m, s):
	if s == 0 or s > 9 * m:
		return None
	else:
		maxnum = []
		while True:
			maxnum.append(str(outmax(s)))
			s -= outmax(s)
			if len(maxnum) == m:
				break
			else:
				pass
		return ''.join(maxnum)
(m, s) = map(int, input().split())
if s == 0 and m != 1 or s > 9 * m:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	output_max = int(outmaxnum(m, s))
	if outmaxnum(m - 1, s - 1) != None:
		a = outmaxnum(m - 1, s - 1)
		output_min = '1' + outmaxnum(m - 1, s - 1)[::-1]
	else:
		output_min = outmaxnum(m, s)[::-1]
		if output_min[0] == '0':
			output_min = outmaxnum(m, s)[0] + outmaxnum(m, s)[1:][::-1]
	print(output_min, output_max)


(m, s) = [int(i) for i in input().split()]
(s_1, m_1) = (s, m)
min_list = []
max_list = []
min_str = ''
max_str = ''
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > m * 9:
	print(-1, -1)
else:
	while s > 9:
		max_list.append(9)
		s -= 9
		m -= 1
	if s > 0:
		max_list.append(s)
		m -= 1
		for i in range(m):
			max_list.append(0)
	else:
		for i in range(m):
			max_list.append(0)
	if s_1 < (m_1 - 1) * 9 + 2:
		min_list.append(1)
		m_1 -= 1
		s_1 -= 1
	while True:
		if m_1 * 9 == s_1:
			while s_1 > 0:
				min_list.append(9)
				m_1 -= 1
				s_1 -= 9
			break
		elif m_1 * 9 < s_1 + 9:
			min_list.append(s_1 - (m_1 - 1) * 9)
			m_1 -= 1
			s_1 -= s_1 - m_1 * 9
			while s_1 > 0:
				min_list.append(9)
				m_1 -= 1
				s_1 -= 9
			break
		else:
			min_list.append(0)
			m_1 -= 1
	min_str = int(''.join((str(i) for i in min_list)))
	print(min_str)
	max_str = int(''.join((str(i) for i in max_list)))
	print(max_str)


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	final_max = ''
	temp = s
	for j in range(m):
		for k in range(9, -1, -1):
			if temp - k >= 0:
				temp -= k
				final_max += str(k)
				break
	final_min = ''
	for j in range(m):
		if j == 0:
			for k in range(1, 10):
				if 9 * (m - j - 1) >= s - k:
					s -= k
					final_min += str(k)
					break
		else:
			for k in range(0, 10):
				if 9 * (m - j - 1) >= s - k:
					s -= k
					final_min += str(k)
					break
	print(final_min, final_max)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	mi = [0] * m
	mi[0] = 1
	s -= 1
	c = s // 9
	c1 = s % 9
	ma = [0] * m
	for i in range(c):
		mi[m - 1 - i] = 9
	mi[m - 1 - c] += c1
	s += 1
	q = s // 9
	q1 = s % 9
	for i in range(q):
		ma[i] = 9
	if q1 > 0:
		ma[q] += q1
	aa = 0
	bb = 0
	for i in range(m):
		aa += mi[i] * 10 ** (m - i - 1)
		bb += ma[i] * 10 ** (m - i - 1)
	print(aa, bb)


ar = []
for x in input().split(' '):
	ar.append(int(x))
ar2 = ar.copy()
res = []
if ar[1] == 0 and ar[0] == 1:
	print(0, 0)
elif 9 * ar[0] < ar[1] or ar[1] == 0:
	print(-1, -1)
else:
	for k in range(ar[0]):
		ch = 0
		for i in reversed(range(0, 10)):
			if k == ar[0] - 1:
				res.append(ar[1])
				ch = 1
				break
			if ar[1] - i <= 9 * (ar[0] - k - 1) and ar[1] - i >= 0:
				if len(res) == 0 and i == 0:
					break
				res.append(i)
				ar[1] = ar[1] - i
				ch = 1
				break
			else:
				continue
	if len(res) != 0:
		first = ''.join([str(a) for a in res])
		res = [0] * ar2[0]
		res[0] = 1
		curr = ar2[1] - 1
		for k in range(ar2[0]):
			if k == ar2[0] - 1:
				res[0] = res[0] + curr
				break
			if curr <= 9:
				res[ar2[0] - k - 1] = curr
				break
			else:
				res[ar2[0] - k - 1] = 9
				curr = curr - 9
		print(''.join([str(a) for a in res]), first)


(m, s) = map(int, input().split())
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
	exit()
mi = 0
ma = 0
t = s
s -= 1
for i in range(m):
	if i < m - 1:
		a = min(9, s)
		s -= a
		mi += a * 10 ** i
	else:
		mi += (s + 1) * 10 ** (m - 1)
for i in range(m):
	b = min(9, t)
	ma += b * 10 ** (m - i - 1)
	t -= b
print(mi, ma)


def small(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	res = [0 for i in range(m)]
	s -= 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			res[i] = 9
			s -= 9
		else:
			res[i] = s
			s = 0
	res[0] = s + 1
	s = ''
	for i in res:
		s += str(i)
	return s

def large(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	res = [0] * m
	for i in range(0, m):
		if s >= 9:
			res[i] = 9
			s = s - 9
		else:
			res[i] = s
			s = 0
	s = ''
	for i in res:
		s += str(i)
	return s
(a, b) = map(int, input().split())
print(small(a, b), large(a, b))


[m, s] = [int(_) for _ in input().split()]
if m == 1:
	if s == 0:
		ans = ['0', '0']
	elif s > 9:
		ans = ['-1', '-1']
	else:
		ans = [str(s), str(s)]
elif s > m * 9 or s == 0:
	ans = ['-1', '-1']
else:
	lis = []
	lis.extend([9] * (s // 9))
	if s % 9 != 0:
		lis.append(s % 9)
	zeros = [0] * (m - len(lis))
	maxnum = ''.join([str(_) for _ in lis + zeros])
	if s <= (m - 1) * 9 + 1:
		lis = [1]
		s -= 1
	else:
		lis = []
	if s % 9 > 0:
		lis.append(s % 9)
	lis.extend([9] * (s // 9))
	zeros = [0] * (m - len(lis))
	minnum = ''.join([str(_) for _ in lis[:1] + zeros + lis[1:]])
	ans = [minnum, maxnum]
print(' '.join(ans))


__author__ = 'Utena'
(l, v0) = list(map(int, input().split()))
if v0 > l * 9:
	print('-1 -1')
elif v0 == 0:
	if l == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	a = ''
	v = v0
	for i in range(l):
		if i < l - 1:
			x = min(9, v - 1)
			a = '%d' % x + a
			v -= x
		else:
			a = '%d' % v + a
	b = ''
	v = v0
	for i in range(l):
		b += '%d' % min(9, v)
		v -= min(9, v)
	print(a + ' ' + b)


line = input()
m = int(line.split()[0])
s = int(line.split()[1])
l = []
p = []
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
elif m == 1:
	print(s, s)
else:
	if s < 10:
		x = s * 10 ** (m - 1)
		y = 10 ** (m - 1) + s - 1
		print(y, x)
	if s >= 10:
		if s > 9 * (m - 1):
			p.append(s - 9 * (m - 1))
			for i in range(m - 1):
				l.append(9)
				p.append(9)
			l.append(s - 9 * (m - 1))
		else:
			yu1 = s // 9
			yu2 = s % 9
			if yu2 != 0:
				p.append(1)
				for i in range(yu1):
					l.append(9)
				l.append(yu2)
				for i in range(m - yu1 - 1):
					l.append(0)
				for i in range(m - yu1 - 2):
					p.append(0)
				p.append(yu2 - 1)
				for i in range(yu1):
					p.append(9)
			if yu2 == 0:
				p.append(1)
				for i in range(yu1):
					l.append(9)
				for i in range(m - yu1):
					l.append(0)
				for i in range(m - yu1 - 1):
					p.append(0)
				p.append(8)
				for i in range(yu1 - 1):
					p.append(9)
		q = [str(k) for k in p]
		qq = [str(i) for i in l]
		print(''.join(q), ''.join(qq))


(n, sumi) = [i for i in list(map(int, input().split()))]
sdf = [9 for i in range(n)]
if sumi == 0 and n != 1:
	print(str(-1) + ' ' + str(-1))
elif sumi == 0 and n == 1:
	print(str(0) + ' ' + str(0))
elif sumi > n * 9:
	print(str(-1) + ' ' + str(-1))
else:
	i = 0
	curr = 9 * n
	while sumi < curr:
		if i == 0:
			sdf[i] -= min(curr - sumi, 8)
			curr -= min(curr - sumi, 8)
		else:
			sdf[i] -= min(curr - sumi, 9)
			curr -= min(curr - sumi, 9)
		i += 1
	for i in range(n):
		print(sdf[i], end='')
	print(end=' ')
	i = n - 1
	curr = 9 * n
	sdf = [9 for i in range(n)]
	while sumi < curr:
		if i == 0:
			sdf[i] -= min(curr - sumi, 8)
			curr -= min(curr - sumi, 8)
		else:
			sdf[i] -= min(curr - sumi, 9)
			curr -= min(curr - sumi, 9)
		i -= 1
	for i in range(n):
		print(sdf[i], end='')
	print()


rin = lambda : map(int, input().split())
(m, s) = rin()
(a, b) = (m * [0], m * [0])
a[0] = b[0] = 1
if m > 1 and s == 0:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	temp = s - 1
	pos = m - 1
	while temp > 0 and pos >= 0:
		a[pos] += 9 if temp > 9 else temp
		temp -= a[pos]
		pos -= 1
	pos = 0
	while s > 0 and pos < m:
		b[pos] = 9 if s > 9 else s
		s -= b[pos]
		pos += 1
	if temp > 0 or a[0] > 9 or a[0] < 1:
		print(-1, end='')
	else:
		for i in a:
			print(i, end='')
	print(' ', end='')
	if s > 0 or b[-1] > 9 or b[0] < 1:
		print(-1, end='')
	else:
		for i in b:
			print(i, end='')
	print()


def min_and_max(m, s):
	if s == 0:
		if m == 1:
			return (0, 0)
		return (-1, -1)
	max_num = 0
	s_max = s
	for i in range(m):
		if s_max >= 9:
			max_num = max_num * 10 + 9
			s_max -= 9
		else:
			max_num = max_num * 10 + s_max
			s_max = 0
	if s_max != 0:
		return (-1, -1)

	def reverse(n):
		ans = 0
		while n > 0:
			ans = ans * 10 + n % 10
			n = n // 10
		return ans
	if max_num % 10 != 0:
		min_num = reverse(max_num)
	else:
		order = 10
		while max_num % (order * 10) == 0:
			order *= 10
		if order < max_num:
			min_num = reverse(max_num - order + 1)
		else:
			min_num = max_num
	return (min_num, max_num)
(m, s) = map(int, input().strip().split())
print(*min_and_max(m, s))


(n, Sum) = list(map(int, input().split()))
if n == 1 and Sum == 0:
	print(0, 0)
elif Sum == 0 or Sum > 9 * n:
	print(-1, -1)
else:
	l = [0] * n
	r = [0] * n
	(b, p) = ('', '')
	s = Sum
	for i in range(n):
		if s >= 9:
			r[i] = 9
			s -= 9
		else:
			r[i] = s
			s = 0
		l[n - i - 1] = r[i]
	if l[0] != 0:
		for i in range(n):
			b = b + str(l[i])
			p = p + str(r[i])
		print(b, p)
	else:
		for i in range(n):
			if l[i] != 0:
				break
		l[0] = '1'
		l[i] = l[i] - 1
		for i in range(n):
			b = b + str(l[i])
			p = p + str(r[i])
		print(b, p)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
(m, s) = get_ints()
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
elif m == 1:
	print(str(s) + ' ' + str(s))
elif s == 1:
	print(str(1) + '0' * (m - 1) + ' ' + str(1) + '0' * (m - 1))
elif s == 9 * m:
	print('9' * m + ' ' + '9' * m)
else:
	largest = ''
	largest_s = s
	while largest_s > 9:
		largest += str(9)
		largest_s -= 9
	largest += str(largest_s)
	largest = largest + '0' * (m - len(largest))
	smallest = ''
	smallest_s = s
	if s <= 9 * (m - 1):
		smallest = '1'
		smallest_s -= 1
	smallest += '0' * (m - int(smallest_s / 9) - 2)
	smallest += str(smallest_s % 9)
	smallest += '9' * int(smallest_s / 9)
	print(smallest + ' ' + largest)


line = input().split()
m = int(line[0])
s = int(line[1])
minans = ''
maxans = ''
x = 0
y = 0
if m == 1 and s == 0:
	print('0 0')
elif s > 9 * m or s == 0:
	print('-1 -1')
else:
	a1 = max([s - 9 * (m - 1), 1])
	minans = minans + str(a1)
	x = x + a1
	for i in range(m - 1):
		a = max([s - x - 9 * (m - (i + 2)), 0])
		minans = minans + str(a)
		x = x + a
if s <= 9 * m and s != 0:
	a1 = min([s, 9])
	maxans = maxans + str(a1)
	y = y + a1
	for i in range(m - 1):
		a = min([s - y, 9])
		maxans = maxans + str(a)
		y = y + a
print(minans, maxans)


(n, s) = map(int, input().split())
if n == 1 and s <= 9:
	print(s, s)
elif s == 0 or s / n > 9:
	print(-1, -1)
else:
	a = ['0'] * n
	a[0] = '1'
	p = (s - 1) // 9
	r = (s - 1) % 9
	if p == 0:
		a[len(a) - 1] = str(r)
	else:
		for i in range(len(a) - 1, len(a) - 1 - p, -1):
			a[i] = '9'
		a[i - 1] = str(int(a[i - 1]) + r)
	aa = ''.join(a)
	b = ['0'] * n
	pp = s // 9
	rr = s % 9
	if pp == 0:
		b[0] = str(rr)
	else:
		for j in range(0, pp, 1):
			b[j] = '9'
		if rr > 0:
			b[j + 1] = str(rr)
	bb = ''.join(b)
	print(int(aa), int(bb))


(m, s) = map(int, input().split())
nine = int(s / 9)
shengyu = s - nine * 9
Max = ''
Min = ''
if s > 9 * m:
	Max = -1
	Min = -1
	print(Min, Max)
elif s == 9 * m:
	while m > 0:
		Max = Max + str(9)
		Min = Min + str(9)
		m = m - 1
	print(Min, Max)
elif s == 0 and m == 1:
	Max = 0
	Min = 0
	print(Min, Max)
elif s == 0 and m > 1:
	Max = -1
	Min = -1
	print(Min, Max)
elif m == 1:
	Min = s
	Max = s
	print(Min, Max)
elif m == 2 and nine == 0:
	Min = str(1) + str(shengyu - 1)
	Max = str(shengyu) + str(0)
	print(Min, Max)
elif m == 2 and nine != 0:
	Min = str(s - 9) + str(9)
	Max = str(9) + str(s - 9)
	print(Min, Max)
elif m > 2:
	weizhui = ''
	while nine > 0:
		weizhui = weizhui + str(9)
		nine = nine - 1
	qianzhui = weizhui
	if shengyu > 0:
		weizhui = str(shengyu - 1) + str(weizhui)
		weishu = len(weizhui)
		if weishu == m:
			Min = str(shengyu) + str(qianzhui)
			Max = str(qianzhui) + str(shengyu)
		else:
			a = m - len(str(qianzhui) + str(shengyu))
			zzero = ''
			while a > 0:
				zzero = zzero + str(0)
				a = a - 1
			if weishu < m - 1:
				Min = str(10 ** (m - weishu - 1)) + str(weizhui)
				Max = str(qianzhui) + str(shengyu) + str(zzero)
			elif weishu == m - 1:
				Min = str(10 ** (m - weishu - 1)) + str(weizhui)
				Max = str(qianzhui) + str(shengyu) + str(0)
			else:
				Min = weizhui
				Max = str(qianzhui) + str(shengyu)
	else:
		zero = m - len(weizhui)
		x = zero
		houchuo = ''
		chuochuo = ''
		while zero > 0:
			houchuo = str(houchuo) + str(0)
			zero = zero - 1
		while x > 1:
			chuochuo = str(chuochuo) + str(0)
			x = x - 1
		if s == 9:
			zhongjian = ''
			while m - 2 > 0:
				zhongjian = zhongjian + str(0)
				m = m - 1
			Min = str(1) + str(zhongjian) + str(8)
			Max = weizhui + houchuo
		else:
			Max = weizhui + houchuo
			hou = ''
			b = len(weizhui) - 1
			while b > 0:
				hou = hou + str(9)
				b = b - 1
			Min = str(1) + str(chuochuo) + str(8) + str(hou)
	print(Min, Max)


(m, s) = map(int, input().split())
if s > m * 9 or (s == 0 and m > 1):
	max = str(-1)
	min = str(-1)
else:
	a = 0
	while s > 9 * (a + 1):
		a += 1
	max = '9' * a + str(s - 9 * a) + '0' * (m - a - 1)
	if '0' in max:
		if '1' in max:
			min = '1' + '0' * (m - a - 1) + '9' * a
		else:
			min = '1' + '0' * (m - a - 2) + str(s - 9 * a - 1) + '9' * a
	else:
		min = str(s - 9 * a) + '9' * (m - 1)
	if '-' in min:
		min = 0
print(min, max)


A = list(map(int, input().split()))
(n, m) = A
if n == 1 and m == 0:
	print('0 0')
elif not 1 <= m <= 9 * n:
	print('-1 -1')
else:
	largest = ''
	SUM = 0
	for x in range(n):
		if SUM + 9 > m:
			largest += str((m - SUM) % 9)
			SUM += (m - SUM) % 9
		else:
			largest += '9'
			SUM += 9
	smallest1 = [1] + [0] * (n - 1)
	for x in range(n - 1, -1, -1):
		if sum(smallest1) != m:
			if m - sum(smallest1) > 9:
				smallest1[x] = 9
			else:
				smallest1[x] = m - sum(smallest1)
		if x == 0:
			if sum(smallest1) != m:
				smallest1[x] = m - sum(smallest1[1:])
	smallest1 = ''.join(map(str, smallest1))
	print(smallest1 + ' ' + largest)


(m, n) = map(int, input().split())
min = [0] * m
max = [0] * m
(sum, sum1) = (n - 1, n)
(min[0], max[0]) = (1, 1)
for i in range(m - 1, -1, -1):
	if sum + min[i] > 9:
		sum -= 9 - min[i]
		min[i] = 9
	elif sum <= 0:
		break
	else:
		min[i] += sum
		sum = 0
		break
for i in range(m):
	if sum1 + max[i] > 9:
		sum1 -= 9
		max[i] = 9
	elif sum1 <= 0:
		break
	else:
		max[i] = 0
		max[i] = sum1
		sum1 = 0
		break
(s, s1) = ('', '')
for i in min:
	s += str(i)
for i in max:
	s1 += str(i)
if sum == 0 and sum1 == 0:
	print(s, s1)
elif n == 0 and m == 1:
	print(0, 0)
elif n == 0:
	print(-1, -1)
elif sum1 == 0:
	print(-1, s1)
elif sum == 0:
	print(s, -1)
else:
	print(-1, -1)


def solve(m, s):
	if s == 0 and m > 1:
		return (-1, -1)
	if s == 0 and m == 1:
		return (0, 0)
	k = ''
	nines = '9' * (s // 9)
	remaining = str(s % 9)
	add = remaining if remaining != '0' else ''
	k = nines + add + '0' * (m - len(nines) - len(add))
	if len(str(int(k))) != m:
		return (-1, -1)
	l = list(map(int, k[::-1]))
	if l[0] == 0:
		l[0] = 1
		for (i, v) in enumerate(l[1:], 1):
			if v > 0:
				l[i] -= 1
				break
	l = ''.join(map(str, l))
	return (l, k)

def main():
	(m, s) = list(map(int, input().split()))
	print(*solve(m, s))
main()


(m, s) = map(int, input().split())
c9 = 0
td = 0
flag = 0
if m == 1 and s == 0:
	print(s, end=' ')
	print(s)
elif s > m * 9 or s < 1:
	print('-1 -1')
elif m == 1:
	print(s, end=' ')
	print(s)
else:
	while s >= 9:
		s -= 9
		c9 += 1
	if c9 == m and s == 0:
		print('9' * m, end=' ')
		print('9' * m)
		flag = 1
	elif s != 0:
		td += 1
	else:
		c9 -= 1
		s = 9
	if flag == 0:
		td += c9
		minx = ''
		maxx = ''
		minx = '9' * c9
		if td == m:
			minx = str(s) + minx
		else:
			minx = str(s - 1) + minx
			s0 = '0' * (m - c9 - 2)
			minx = s0 + minx
			minx = '1' + minx
		maxx = '9' * c9
		s0 = '0' * (m - c9 - 1)
		maxx = maxx + str(s) + s0
		print(minx, end=' ')
		print(maxx)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, s) = zz()

def big(n, s):
	arr = [9] * n
	ans = [-1]
	for i in range(1, n + 1):
		arr[-i] = 0
		if sum(arr) > s:
			continue
		c = 1
		for j in range(0, 10):
			arr[-i] = j
			if sum(arr) == s:
				return arr
				c = 0
	return [-1]

def small(n, s):
	arr = [1] + [0] * (n - 1)
	ans = [-1]
	for i in range(1, n + 1):
		arr[-i] = 9
		if sum(arr) < s:
			continue
		c = 1
		for j in range(9, -1, -1):
			arr[-i] = j
			if sum(arr) == s:
				return arr
				c = 0
	return [-1]
if s == 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit()
print(''.join((str(i) for i in small(n, s))), ''.join((str(i) for i in big(n, s))))


import math
line = input().split()
m = int(line[0])
s = int(line[1])
if s == 0:
	if m == 1:
		print(0, 0, sep=' ')
	else:
		print(-1, -1, sep=' ')
elif s > 9 * m:
	print(-1, -1, sep=' ')
else:
	n = s // 9
	Nmin = 0
	Nmax = int(s % 9 * 10 ** (m - n - 1))
	for i in range(n):
		Nmax += 9 * 10 ** (m - 1 - i)
	for i in range(math.ceil(s / 9) - 1):
		Nmin += 9 * 10 ** i
	if math.ceil(s / 9) <= m - 1:
		Nmin += 1 * 10 ** (m - 1) + (s - 9 * (math.ceil(s / 9) - 1) - 1) * 10 ** (math.ceil(s / 9) - 1)
	else:
		Nmin += (s - 9 * (math.ceil(s / 9) - 1)) * 10 ** (math.ceil(s / 9) - 1)
	print(Nmin, Nmax, sep=' ')


(m, s) = map(int, input().split())
(msmallest, slargest) = (m, s)
if s / m > 9 or (m > 1 and s == 0):
	print('-1 -1')
else:
	if s > 9:
		totaln = s // 9
		s -= 9 * totaln
		msmallest -= totaln
	else:
		totaln = 0
	smallest = ''
	for i in range(msmallest):
		if i == 0 and msmallest > 1:
			smallest += '1'
			s -= 1
		elif i > 0 and i != msmallest - 1:
			smallest += '0'
		else:
			smallest += str(s)
	smallest += '9' * totaln
	if '-1' in smallest:
		smallest = smallest.replace('-19', '08')
	largest = ''
	for i in range(m):
		if slargest >= 9:
			largest += str(9)
			slargest -= 9
		else:
			largest += str(slargest)
			slargest -= slargest
	print(f'{smallest} {largest}')


(n, s) = map(int, input().split())
if s > 9 * n:
	print(-1, -1)
elif s == 0 and n > 1:
	print(-1, -1)
elif n == 1 and s == 0:
	print(0, 0)
else:
	p = s // 9
	q = s - 9 * p
	b = ''
	if q > 0:
		b = b + '9' * p + str(q) + '0' * (n - p - 1)
	else:
		b = b + '9' * p + '0' * (n - p)
	d = list(b[::-1])
	if d[0] == '0':
		d[0] = '1'
		j = 1
		while j < n:
			if d[j] != '0':
				d[j] = str(int(d[j]) - 1)
				break
			j = j + 1
	print(''.join(d), b)


def generate1(long, sum1):
	if 9 * long >= sum1 and sum1 >= 1 or (long == 1 and sum1 == 0):
		if long == 1 and sum1 >= 1 and (sum1 <= 9):
			return sum1
		elif sum1 > 9:
			sum1 -= 9
			long -= 1
			return generate1(long, sum1) + 9 * pow(10, long)
		elif sum1 <= 9:
			long -= 1
			return sum1 * pow(10, long)
	else:
		return -1

def generate2(long, sum1):
	if 9 * long >= sum1 and sum1 >= 1 or (long == 1 and sum1 == 0):
		if sum1 > 9:
			sum1 -= 9
			long -= 1
			return generate2(long, sum1) * 10 + 9
		if sum1 <= 9:
			return sum1 - 1 + 1 * pow(10, long - 1)
	else:
		return -1
x = [int(i) for i in input().split()]
print('%d %d' % (generate2(x[0], x[1]), generate1(x[0], x[1])))


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def bo(i):
	return ord(i) - ord('a')
from copy import *
from bisect import *
from itertools import permutations
(n, s) = mi()
p = ''
p2 = ''
dp = [[-1 for i in range(901)] for j in range(101)]

def rec2(i, su):
	global p2
	if i == n:
		dp[i][su] = s == su
		return s == su
	if dp[i][su] != -1:
		return dp[i][su]
	for j in range(0, 10):
		if i == 0 and j == 0:
			continue
		if rec2(i + 1, su + j):
			p2 += str(j)
			dp[i][su] = True
			return True
		else:
			dp[i][su] = False
	return False
dp2 = [[-1 for i in range(901)] for j in range(101)]

def rec(i, su):
	global p
	if i == n:
		dp2[i][su] = su == s
		return su == s
	if dp2[i][su] != -1:
		return dp2[i][su]
	for j in range(9, -1, -1):
		if i == 0 and j == 0:
			break
		if rec(i + 1, su + j):
			p += str(j)
			dp2[i][su] = True
			return True
		else:
			dp2[i][su] = False
	return False
if s == 0 and n == 1:
	print(0, 0)
	exit(0)
rec(0, 0)
rec2(0, 0)
if len(p) == 0:
	p = '1-'
if len(p2) == 0:
	p2 = '1-'
print(p2[::-1], p[::-1])


(m, s) = str(input()).split()
m = int(m)
s = int(s)
if m > 1 and s == 0 or s > 9 * m:
	print('-1 -1')
elif m == 1:
	print(str(s) + ' ' + str(s))
else:
	num_9 = s // 9
	miss = s - 9 * num_9
	if miss > 0:
		count = m - num_9 - 1
		if num_9 > 0:
			max_v = '9' * num_9 + str(miss) + '0' * count
		else:
			max_v = str(miss) + '0' * count
		if count > 0:
			min_v = '1' + '0' * (count - 1) + str(miss - 1) + '9' * num_9
		else:
			min_v = str(miss) + '9' * num_9
	else:
		count = m - num_9
		max_v = '9' * num_9 + '0' * count
		if count > 0:
			min_v = '1' + '0' * (count - 1) + '8' + '9' * (num_9 - 1)
		else:
			min_v = max_v
	print(str(min_v) + ' ' + str(max_v))


x = input().split()
a = int(x[0])
b = int(x[1])
if b == 0 or 9 * a < b:
	if a == 1 and b == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	s = int(b / 9)
	y = b % 9
	maax = ''
	maax = maax + s * '9'
	if y > 0:
		maax = maax + str(y)
	k = a - len(maax)
	maax = maax + k * '0'
	miin = int(maax) + 1 - 10 ** k
	miin = str(miin)
	miin = (len(maax) - len(miin)) * str(0) + miin
	miiin = ''
	n = len(miin)
	while n > 0:
		miiin = miiin + miin[n - 1]
		n = n - 1
	print(miiin, maax)


def main(m, s):
	a = b = []
	if s == 0:
		if m == 1:
			a = b = ['0']
		else:
			a = b = ['-1']
		return (a, b)
	if s > 9 * m:
		a = b = ['-1']
		return (a, b)
	s_a = s_b = s
	s_b -= 1
	for i in range(m - 1):
		if s_b >= 9:
			a = a + ['9']
			b = ['9'] + b
			s_a -= 9
			s_b -= 9
		else:
			a = a + [str(s_a)]
			b = [str(s_b)] + b
			s_a = s_b = 0
	a = a + [str(s_a)]
	b = [str(s_b + 1)] + b
	return (a, b)
y = input().split(' ')
s = int(y[1])
m = int(y[0])
t = main(m, s)
print(''.join(t[1]), ''.join(t[0]))


def answer(m, s):
	if s == 0:
		if m == 1:
			return [0, 0]
		else:
			return [-1, -1]
	max_s = 9 * m
	if s > max_s:
		return [-1, -1]
	if s == max_s:
		return [int('9' * m), int('9' * m)]
	n9 = s // 9
	rest = s % 9
	if rest == 0:
		n9 -= 1
		rest = 9
	st = '9' * n9
	if len(st) == m - 1:
		st = str(rest) + st
	elif rest == 1:
		st = '1' + (m - len(st) - 1) * '0' + st
	else:
		st = '1' + (m - len(st) - 2) * '0' + str(rest - 1) + st
	n9 = s // 9
	rest = s % 9
	maxi = '9' * n9
	if rest > 0:
		maxi = maxi + str(rest) + '0' * (m - n9 - 1)
	else:
		maxi = maxi + '0' * (m - n9)
	return [int(st), int(maxi)]
(m, s) = map(int, input().split())
print(*answer(m, s))


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 = 10 ** 9 + 7
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 [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)

def main():
	(n, s) = LI()
	if n == 1 and s == 0:
		return '0 0'
	if s < 1 or n * 9 < s:
		return '-1 -1'
	if s == 1:
		return '1' + '0' * (n - 1) + ' ' + ('1' + '0' * (n - 1))
	a = []
	t = s
	for i in range(n - 1):
		a.append(min(9, t - 1))
		t -= a[-1]
	a.append(t)
	b = ''.join(map(str, a[::-1]))
	a = []
	t = s
	for i in range(n):
		a.append(min(9, t))
		t -= a[-1]
	c = ''.join(map(str, a))
	return '{} {}'.format(b, c)
print(main())


(m, s) = map(int, input().split())
minimum = m * [0]
maximum = m * [0]
minimum[0] = 1
for num in range(1, s):
	for value in range(1, m + 1):
		if minimum[-value] != 9:
			minimum[-value] += 1
			break
for num in range(s):
	for value in range(0, m):
		if maximum[value] != 9:
			maximum[value] += 1
			break
if (m, s) == (1, 0):
	print(0, 0)
	exit(0)
if sum(minimum) == s and sum(maximum) == s:
	for num in minimum:
		print(num, end='')
	print(' ', end='')
	for num in maximum:
		print(num, end='')
else:
	print('-1 -1')


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print(0, 0)
elif 9 * n < s or s == 0:
	print(-1, -1)
else:
	r1 = 10 ** (n - 1)
	for i in range(s - 1):
		r1 += 10 ** (i // 9)
	r2 = 0
	for i in range(s):
		r2 += 10 ** (n - 1 - i // 9)
	print(r1, r2)


lnums = input()
nums = []
nums = lnums.split()
ln = int(nums[0])
sum = int(nums[1])
flag = True
if sum > 9 * ln:
	flag = False
elif sum == 0:
	if ln == 1:
		min = sum
		max = sum
	else:
		flag = False
elif sum < 10:
	if ln == 1:
		min = sum
		max = sum
	else:
		max = int(str(sum) + (ln - 1) * '0')
		min = int('1' + (ln - 2) * '0' + str(sum - 1))
else:
	a = sum // 9
	b = sum % 9
	max = int(a * '9' + str(b) + (ln - a - 1) * '0')
	if b != 0:
		max = int(a * '9' + str(b) + (ln - a - 1) * '0')
		if ln == a + 1:
			min = int(str(b) + a * '9')
		else:
			min = int('1' + (ln - a - 2) * '0' + str(b - 1) + a * '9')
	else:
		max = int(a * '9' + (ln - a) * '0')
		if ln == a + 1:
			min = int('90' + (a - 1) * '9')
		elif ln == a:
			min = int(a * '9')
		else:
			min = int('1' + (ln - a - 1) * '0' + '8' + (a - 1) * '9')
if flag == False:
	print(-1, -1)
else:
	print(min, max)


(m, s) = [int(i) for i in input().split()]
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or 9 * m < s:
	print('-1 -1')
else:
	x = s // 9
	y = s % 9
	if y == 0:
		y = 9
		x -= 1
	big = '9' * x + str(y) + '0' * (m - x - 1)
	if x + 1 == m:
		small = str(y) + '9' * x
	else:
		small = '1' + '0' * (m - x - 2) + str(y - 1) + '9' * x
	print(small, big)


(a, b) = list(map(int, input().split()))
bb = b
if a == 1 and b == 0:
	print('0 0')
elif b == 0 or a == 0 or b > a * 9:
	print('-1 -1')
else:
	ma = ''
	for i in range(a):
		if b > 9:
			ma = ma + str(9)
			b = b - 9
		else:
			ma = ma + str(b)
			b = 0
	b = bb
	mi = ''
	for i in range(a):
		remaining = a - i - 1
		if i == 0:
			if b <= 9 * remaining:
				mi = mi + str(1)
				b = b - 1
			else:
				toAdd = b - 9 * remaining
				mi = mi + str(toAdd)
				b = b - toAdd
		elif b <= 9 * remaining:
			mi = mi + str(0)
		else:
			toAdd = b - 9 * remaining
			mi = mi + str(toAdd)
			b = b - toAdd
	print(int(mi), int(ma))


(m, s) = [int(x) for x in input().split()]
a = s
b = s
if s < 0 or s > 9 * m:
	li = [str(-1), str(-1)]
	print(' '.join(li))
elif s == 0 and m > 1:
	li = [str(-1), str(-1)]
	print(' '.join(li))
elif m == 1:
	li = [str(s), str(s)]
	print(' '.join(li))
else:
	lstmin = [0] * m
	lstmax = [0] * m
	for i in range(m - 1, 0, -1):
		if a - 1 > 9:
			lstmin[i] = 9
			a -= 9
		else:
			lstmin[i] = a - 1
			a = 1
			break
	lstmin[0] = max(1, a)
	for i in range(len(lstmin)):
		lstmin[i] = str(lstmin[i])
	min = ''.join(lstmin)
	for i in range(m):
		if b - 9 >= 0:
			lstmax[i] = 9
			b -= 9
		else:
			lstmax[i] = b
			break
	for i in range(len(lstmax)):
		lstmax[i] = str(lstmax[i])
	max = ''.join(lstmax)
	li = [min, max]
	print(' '.join(li))


(m, s) = map(int, input().split())
ans_min = 0
ans_max = 0
if s == 0 and m == 1:
	print('0 0')
elif s > 9 * m or s == 0:
	print('-1 -1')
else:
	ans = 0
	ans = 10 ** (m - 1)
	for i in range(s - 1):
		ans += 10 ** (i // 9)
	ans_min = ans
	ans = 0
	for i in range(s):
		ans += 10 ** (m - 1 - i // 9)
	ans_max = ans
	print(ans_min, ans_max)


def calcSum(nums):
	s = 0
	for i in nums:
		s += i
	return s

def findMin(nums, m, s):
	nums[0] = 1
	for i in range(1, m):
		nums[i] = 0
	sum = calcSum(nums)
	i = 0
	diff = s - sum
	while True:
		if diff > 9:
			nums[-i - 1] = 9
			i += 1
			if i >= m:
				break
			diff -= 9
		else:
			nums[-i - 1] += diff
			if nums[-i - 1] > 9:
				nums[-i - 1] = 9
			break
		if diff <= 0:
			break
	out = '-1'
	if calcSum(nums) != s:
		return out
	out = ''
	for i in nums:
		out += str(i)
	return out

def findMax(nums, m, s):
	for i in range(0, m):
		nums[i] = 9
	sum = calcSum(nums)
	i = 0
	diff = sum - s
	while True:
		if diff <= 0:
			break
		if diff > 9:
			nums[-i - 1] = 0
			i += 1
			if i >= m:
				break
		else:
			nums[-i - 1] -= diff
			if nums[-i - 1] < 0:
				nums[-i - 1] = 0
			break
		diff -= 9
	if calcSum(nums) != s:
		return '-1'
	out = ''
	for i in nums:
		out += str(i)
	return out
(m, s) = input('').split()
(m, s) = (int(m), int(s))
if m == 1 and s == 0:
	print('0 0')
elif m == 0 or s == 0:
	print('-1 -1')
else:
	nums = [0 for i in range(m)]
	out = findMin(nums, m, s) + ' '
	out += findMax(nums, m, s)
	print(out)


def solver(m, s):
	if m == 1 and s == 0:
		return (0, 0)
	if m == 0:
		return (-1, -1)
	if m > 1 and s == 0:
		return (-1, -1)
	if s > m * 9:
		return (-1, -1)
	res = ''
	for i in range(m):
		if s == 0:
			res += '0'
		else:
			x = min(9, s)
			res += str(x)
			s -= x
	mn = res[::-1]
	minno = ''
	if mn[0] == '0':
		i = 0
		while mn[i] == '0':
			if i == 0:
				minno += '1'
			else:
				minno += mn[i]
			i += 1
		minno += str(int(mn[i]) - 1)
		if i == len(mn) - 1:
			return (int(minno), int(res))
		else:
			minno += mn[i + 1:]
			return (int(minno), int(res))
	return (int(mn), int(res))
(m, s) = map(int, input().split())
(a, b) = solver(m, s)
print(a, b)


data = input().split()
(m, s) = (int(data[0]), int(data[1]))
if m == 1 and 0 <= s <= 9:
	print(s, s)
elif m >= 2 and 1 <= s <= m * 9:
	num1 = ''
	s1 = s
	for i in range(1, 10):
		if 0 <= s1 - i <= (m - 1) * 9:
			num1 += str(i)
			s1 -= i
			break
	for j in range(2, m):
		for k in range(10):
			if 0 <= s1 - k <= (m - j) * 9:
				num1 += str(k)
				s1 -= k
				break
	num1 += str(s1)
	num2 = ''
	s2 = s
	for i in range(9, 0, -1):
		if 0 <= s2 - i <= (m - 1) * 9:
			num2 += str(i)
			s2 -= i
			break
	for j in range(2, m):
		for k in range(9, -1, -1):
			if 0 <= s2 - k <= (m - j) * 9:
				num2 += str(k)
				s2 -= k
				break
	num2 += str(s2)
	print(num1, num2)
else:
	print(-1, -1)


(m, s) = [int(x) for x in input().split()]

def mini(m, s):
	num = ['0' for i in range(m)]
	m -= 1
	while s > 9:
		num[m] = '9'
		s -= 9
		m -= 1
	if s > 0:
		if m != 0:
			num[m] = str(s - 1)
			num[0] = '1'
		else:
			num[m] = str(s)
	return ''.join(num)

def maxi(m, s):
	limit = s // 9 if s // 9 < m else m
	if limit == 0:
		num = str(s) + '0' * (m - 1)
		return num
	else:
		num = '9' * limit
		s -= limit * 9
		if s > 0:
			num += str(s)
		num += '0' * (m - len(num))
		return num
if s > 9 * m or (s == 0 and m != 1):
	print(-1, -1)
else:
	print(mini(m, s), maxi(m, s))


def F1(m, z):
	s1 = ''
	m1 = 0
	z1 = 0
	o = 0
	while True:
		if o == 1:
			break
		if m1 == m:
			if z1 < z:
				return '-1'
				break
			else:
				s1 = s1[::-1]
				return s1
				break
		elif z1 + 9 < z:
			z1 += 9
			s1 += '9'
			m1 += 1
		else:
			m1 += 1
			if m1 == m:
				s1 += str(z - z1)
				z1 = z
				s1 = s1[::-1]
				return s1
				break
			else:
				s1 += str(z - z1 - 1)
				z1 = z - 1
				while m1 < m - 1:
					m1 += 1
					s1 += '0'
				s1 += '1'
				s1 = s1[::-1]
				return s1
				break

def F2(m, z):
	s1 = ''
	m1 = 0
	z1 = 0
	o = 0
	while True:
		if o == 1:
			break
		if m1 == m:
			if z1 < z:
				return '-1'
				break
			else:
				return s1
				break
		elif z1 + 9 < z:
			z1 += 9
			s1 += '9'
			m1 += 1
		else:
			m1 += 1
			if m1 == m:
				s1 += str(z - z1)
				z1 = z
				return s1
				break
			else:
				s1 += str(z - z1)
				z1 = z
				while m1 < m:
					m1 += 1
					s1 += '0'
				return s1
				break
s1 = ''
s2 = ''
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif m != 1 and s == 0:
	print(-1, -1)
else:
	print(F1(m, s), F2(m, s))


(n, m) = map(int, input().split())
mm = m
if m == 0 and n > 1:
	print('-1 -1')
elif m == 0 and n == 1:
	print(0, 0)
elif m > 9 * n:
	print('-1 -1')
else:
	l = [0] * n
	maxi = ''
	mini = ''
	for i in range(n):
		l[i] = min(9, m)
		m = m - l[i]
		maxi += str(l[i])
	if min(l) != 0:
		l.reverse()
		for i in range(n):
			mini += str(l[i])
	else:
		l = [0] * (n - 1)
		mm = mm - 1
		mini = '1'
		for i in range(n - 1):
			l[i] = min(9, mm)
			mm = mm - l[i]
		l.reverse()
		for i in range(n - 1):
			mini += str(l[i])
	print(mini, maxi)


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s < 1 or 9 * m < s:
	print(-1, -1)
else:
	tot = s
	mini = ''
	maxi = ''
	add = 0
	for i in range(m):
		if s > 9:
			mini += '9'
			s -= 9
		else:
			mini += str(s - 1)
			s = 1
			add = 1
	mini = mini[::-1]
	mini = str(int(mini[0]) + add) + mini[1:]
	s = tot
	for i in range(m - 1, -1, -1):
		x = min(9, s)
		maxi += str(x)
		s -= x
	print(mini, maxi)


import sys
inp = sys.stdin.readline()[:-1].split(' ')
m = int(inp[0])
s = int(inp[1])
copyM = m
copyS = s
ans = ''
mx = ''
mn = ''
if s > 0 and m * 9 >= s:
	for i in range(m, 0, -1):
		if s <= 0:
			digit = 0
		else:
			digit = 9
			if digit > s:
				digit = s
			s = s - digit
		m = m - 1
		mx = mx + str(digit)
	m = copyM
	s = copyS
	for i in range(m, 0, -1):
		digit = 9
		if s == 1:
			if i != 1:
				digit = 0
			else:
				digit = 1
		elif s < 10:
			digit = s - 1
			if i == 1:
				digit = digit + 1
		s = s - digit
		mn = mn + str(digit)
	mn = mn[::-1]
	ans = mn + ' ' + mx
else:
	ans = '-1 -1'
	if m == 1 and s == 0:
		ans = '0 0'
print(ans)


(m, s) = [int(i) for i in input().split()]
if s > 9 * m or (s == 0 and m > 1):
	max = min = -1
else:
	s_max = s_min = s
	max_lst = []
	min_lst = []
	while s_max >= 9:
		max_lst.append('9')
		s_max -= 9
	if s_max > 0:
		max_lst.append(str(s_max))
	max_lst.extend((m - len(max_lst)) * ['0'])
	while s_min >= 10:
		min_lst.append('9')
		s_min -= 9
	t = m - len(min_lst)
	if t == 1:
		min_lst.append(str(s_min))
	elif t == 0:
		pass
	else:
		min_lst.extend([str(s_min - 1)] + ['0'] * (t - 2) + ['1'])
	min_lst.reverse()
	max = ''.join(max_lst)
	min = ''.join(min_lst)
print(min, max)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def can(m, s):
	return 0 <= s <= 9 * m
(m, s) = invr()
minn = ''
sum = s
for i in range(m):
	min_failed = True
	for d in range(10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, sum - d):
			minn += chr(ord('0') + d)
			sum -= d
			min_failed = False
			break
	if min_failed:
		minn = '-1'
		break
maxn = ''
sum = s
for i in range(m):
	max_failed = True
	for d in range(9, -1, -1):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, sum - d):
			maxn += chr(ord('0') + d)
			sum -= d
			max_failed = False
			break
	if max_failed:
		maxn = '-1'
		break
print('{} {}'.format(minn, maxn))


(n, s) = map(int, input().split())
a = [9] * n
b = [1] + [0] * (n - 1)
x = 9 * n - s
y = 1
if x >= 0 and s > 0:
	for i in range(len(a) - 1, -1, -1):
		if x >= 9:
			a[i] = 0
			x = x - 9
		else:
			a[i] = 9 - x
			break
	for j in range(len(b) - 1, -1, -1):
		if s - 9 > y:
			b[j] = 9
			y = y + 9
		else:
			b[j] = b[j] + s - y
			break
elif n == 1 and s == 0:
	print('0 0')
	exit(0)
else:
	print('-1 -1')
	exit(0)
resa = ''
resb = ''
for k in range(n):
	resa = resa + str(a[k])
	resb = resb + str(b[k])
print(resb + ' ' + resa)


def find(step):
	if m == 1 and s == 0:
		return 0
	ss = s
	res = ''
	for i in range(m):
		j = 1 if i == 0 else 0
		ok = False
		c = list(range(j, 10)) if step == -1 else reversed(list(range(j, 10)))
		for v in c:
			if 0 <= ss - v <= (m - i - 1) * 9:
				ok = True
				ss -= v
				res += str(v)
				break
		if not ok:
			return -1
	return res
(m, s) = list(map(int, input().split()))
print(find(-1), find(1))


(m, s) = [int(i) for i in input().split()]
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s > m * 9:
	print('-1 -1')
else:
	o = []
	p = []
	a = s // 9
	b = s % 9
	if b > 0:
		for i in range(a):
			o.append(str(9))
		o.append(str(b))
		for i in range(m - a - 1):
			o.append(str(0))
		max = ''.join(o)
		if m - a == 1:
			p.append(str(b))
			for i in range(a):
				p.append(str(9))
		else:
			p.append(str(1))
			p.append(str(b - 1))
			for i in range(a):
				p.append(str(9))
			for i in range(m - a - 2):
				p.insert(1, str(0))
		min = ''.join(p)
	elif s == m * 9:
		for i in range(a):
			o.append(str(9))
		max = ''.join(o)
		min = ''.join(o)
	else:
		for i in range(a):
			o.append(str(9))
		for i in range(m - a):
			o.append(str(0))
		max = ''.join(o)
		p.append(str(1))
		p.append(str(8))
		for i in range(a - 1):
			p.append(str(9))
		for i in range(m - a - 1):
			p.insert(1, str(0))
		min = ''.join(p)
	print(min, max)


(m, s) = map(int, input().split())
res = ''
if m == 1 and s == 0:
	print(0, 0)
elif m * 9 < s or s < 1:
	print(-1, -1)
elif m > 1:
	if s <= 10:
		res = '1' + '0' * (m - 2) + str(s - 1)
	elif 0 <= s - (m - 1) * 9 <= 9:
		res = str(s - (m - 1) * 9) + '9' * (m - 1)
	else:
		res = '1' + (m - 2 - (s - 1) // 9) * '0' + str(s - 1 - int((s - 1) // 9) * 9) + (s - 1) // 9 * '9'
	print(res, end=' ')
	if s <= 9:
		print(str(s) + (m - 1) * '0')
	elif s % 9 == 0:
		print('9' * (s // 9) + '0' * (m - s // 9))
	else:
		print('9' * (s // 9) + str(s % 9) + '0' * (m - 1 - s // 9))
else:
	print(s, s)


inp = list(map(int, input().split()))
big = inp[0]
tot = inp[1]
maxi = []
mini = []
for i in range(big):
	maxi.append(0)
	mini.append(0)
maxi[0] = 1
mini[0] = 1
sumax = 1
lasti = 0
sumin = 1
if 9 * big < tot or (tot < 1 and big > 1):
	print('-1 -1')
elif big == 1 and tot == 0:
	print('0 0')
else:
	while sumax < tot:
		if maxi[lasti] < 9:
			maxi[lasti] += 1
			sumax += 1
		else:
			lasti += 1
			maxi[lasti] += 1
			sumax += 1
	lasti = big - 1
	while sumin < tot:
		if mini[lasti] < 9:
			mini[lasti] += 1
			sumin += 1
		else:
			lasti -= 1
			mini[lasti] += 1
			sumin += 1
	for i in range(big):
		print(mini[i], end='')
	print('', end=' ')
	for i in range(len(maxi)):
		print(maxi[i], end='')


(m, n) = [int(x) for x in input().split(' ')]
if n < 1 and m == 1:
	print(0, 0)
elif n > 9 * m or n < 1:
	print(-1, -1)
else:
	n2 = n
	biggest = ''
	while n > 0:
		biggest += str(min(9, n))
		n -= 9
	biggest += '0' * (m - len(biggest))
	smallest = ''
	while n2 > 0:
		smallest = str(min(9, n2)) + smallest
		n2 -= min(9, n2)
	if len(smallest) < m:
		if len(smallest) > 1:
			smallest = '1' + '0' * (m - len(smallest) - 1) + str(int(smallest[0]) - 1) + smallest[1:]
		else:
			smallest = '1' + '0' * (m - 2) + str(int(smallest[0]) - 1)
	print(smallest, biggest)


[a, b] = map(int, input().split())
if a == 1 and b == 0:
	print(0, 0)
elif b > 9 * a or b == 0:
	print(-1, -1)
else:
	c = (b - 1) // 9
	if c == a - 1:
		d = b - 9 * c
		print(str(d) + c * '9', c * '9' + str(d))
	elif c == 0:
		d = b - 1
		print('1' + (a - 2) * '0' + str(d), str(d + 1) + (a - 1) * '0')
	else:
		d = b - 1 - 9 * c
		print('1' + (a - c - 2) * '0' + str(d) + c * '9', c * '9' + str(d + 1) + (a - c - 1) * '0')


def main():
	(m, s) = map(int, input().split())
	if m == 1 and s == 0:
		print(0, 0)
	elif s > 9 * m or s == 0:
		print(-1, -1)
	else:
		x = 10 ** (m - 1)
		y = 0
		for i in range(s - 1):
			x = x + 10 ** (i // 9)
		for i in range(s):
			y = y + 10 ** (m - 1 - i // 9)
		print(x, y)
main()


(m, s) = map(int, input().split())
max_ = 9 * m
if s == 0 and m > 1 or s > max_:
	print(-1, -1)
else:
	m2 = m
	s2 = s
	digits = [1] + [0] * (m - 1)
	if s == 0:
		digits[0] = 0
	else:
		s -= 1
	m -= 1
	while s > 0:
		if m == 0:
			s += 1
		digits[m] = min(9, s)
		s -= digits[m]
		m -= 1
	digits2 = [0] * m2
	i = 0
	while s2 > 0:
		digits2[i] = min(9, s2)
		s2 -= digits2[i]
		i += 1
	print(''.join(map(str, digits)), ''.join(map(str, digits2)))


(m, n) = [int(x) for x in input().strip().split()]
if n == 0 and m > 1:
	res = '-1 -1'
	print(res)
elif n == 0 and m == 1:
	res = '0 0'
	print(res)
else:
	result = [None for i in range(m)]
	s_result = [None for i in range(m)]
	p = n
	for i in range(m):
		if n >= 9:
			result[i] = 9
			n -= 9
		else:
			result[i] = n
			n -= n
	if n != 0:
		res = '-1 -1'
		print(res)
	else:
		smallest = sorted(result)
		for x in smallest:
			if x > 0:
				nz = x
				break
		ind = smallest.index(nz)
		new_smallest = [None for i in range(m)]
		if ind > 0:
			new_smallest[0] = 1
			for i in range(1, m):
				new_smallest[i] = smallest[i]
			new_smallest[ind] -= 1
		else:
			new_smallest = [x for x in smallest]
		s_a = ''.join((str(x) for x in new_smallest))
		l_a = ''.join((str(x) for x in result))
		print(s_a, l_a)


def inp():
	return map(int, input().split())
(m, s) = inp()
(ma, mi, smax, smin) = (list(str(10 ** (m - 1))), list(str(10 ** (m - 1))), s, s - 1)
for i in range(len(ma)):
	if smax >= 9:
		ma[i] = str(int(ma[i]) + (9 - int(ma[i])))
	else:
		ma[i] = str(int(ma[i]) + (smax - int(ma[i])))
	smax -= int(ma[i])
for i in range(len(mi) - 1, -1, -1):
	if smin == 0:
		break
	if smin >= 9:
		mi[i] = str(int(mi[i]) + (9 - int(mi[i])))
	else:
		mi[i] = str(int(mi[i]) + smin)
	smin -= int(mi[i])
if smin > 0 or smax > 0 or (s == 0 and m > 1):
	exit(print(-1, -1))
print(''.join(mi), ''.join(ma))


(n, m) = map(int, input().split())
s = s1 = ''
c = m - 1
d = n - 1
while d > 0:
	if c >= 9:
		s = '9' + s
		d -= 1
		c -= 9
	else:
		s = str(c) + s
		d -= 1
		c -= c
if c == 0:
	s = '1' + s
else:
	s = str(c + 1) + s
c = m
d = n
while n > 0:
	if c >= 9:
		s1 += '9'
		c -= 9
		n -= 1
	else:
		s1 += str(c)
		c -= c
		n -= 1
if d * 9 < m or (d != 1 and m == 0):
	print('-1', '-1')
else:
	print(s, s1)


mp = map(int, input().split(' '))
(s, m) = list(mp)
ans = [0 for i in range(s)]
if s * 9 < m or (m < 1 and s > 1):
	print('-1 -1')
else:
	big = 0
	n = m
	for i in range(s - 1, -1, -1):
		if m > 9:
			ans[i] = 9
		else:
			ans[i] = m
		m -= ans[i]
	big = ''.join(map(str, ans[::-1]))
	ans = [0 for i in range(s)]
	ans[0] = 1
	n -= 1
	for i in range(s - 1, -1, -1):
		if n > 9:
			ans[i] = 9
		else:
			ans[i] += n
		n -= ans[i]
	sml = ''.join(map(str, ans))
	print(sml, big)


[m, s] = list(map(int, input().split()))
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	ma = ''
	for i in range(s // 9):
		ma = ma + '9'
	if s % 9 != 0:
		ma = ma + str(s % 9)
	for i in range(m - len(ma)):
		ma += '0'
	mi = ''
	for i in range((s - 1) // 9):
		mi = '9' + mi
	if (s - 1) % 9 != 0:
		mi = str((s - 1) % 9) + mi
	for i in range(m - len(mi)):
		mi = '0' + mi
	mi = str(int(mi[0]) + 1) + mi[1:]
	print(mi, ma)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict, Counter
from os import path
import bisect as bi
import heapq
mod = 10 ** 9 + 7

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def inp():
		return int(input())

	def minp():
		return map(int, input().split())
else:

	def inp():
		return int(stdin.readline())

	def minp():
		return map(int, stdin.readline().split())

def small(n, s):
	a = [0] * n
	if n * 9 < s:
		return -1
	if s == 0 and n > 1:
		return -1
	if s == 0:
		return 0
	s -= 1
	i = n - 1
	while i > 0:
		if s >= 9:
			a[i] = 9
			s -= 9
		else:
			a[i] = s
			s = 0
		i -= 1
	a[0] = s + 1
	a = [str(x) for x in a]
	return ''.join(a)

def large(n, s):
	a = [0] * n
	if n * 9 < s:
		return -1
	if s == 0 and n > 1:
		return -1
	if s == 0:
		return 0
	i = 0
	while s > 0 and i < n:
		if s > 9:
			a[i] = 9
			s -= 9
			i += 1
		else:
			a[i] = s
			s = 0
	if s:
		return -1
	a = [str(x) for x in a]
	return ''.join(a)

def main():
	(m, s) = minp()
	print(small(m, s), large(m, s))
main()


(M, N) = map(int, input().split())
if M == 1 and N == 0:
	print('0 0')
elif 9 * M < N or N == 0:
	print('-1 -1')
else:
	A = 10 ** (M - 1)
	for j in range(N - 1):
		A += 10 ** (j // 9)
	B = 0
	for u in range(N):
		B += 10 ** (M - 1 - u // 9)
	print(A, B)


a = [int(x) for x in input().split(' ')]
x = a[0]
y = a[1]
if y > 9 * x:
	print('-1 -1')
elif y == 0:
	if x == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	larg = []
	for i in range(x):
		if 9 <= y:
			larg.append(9)
			y -= 9
		else:
			larg.append(y)
			y -= y
	largnum = ''.join((str(i) for i in larg))
	smal = list(reversed(larg))
	if smal[0] != 0:
		smalnum = ''.join((str(i) for i in smal))
	else:
		for i in range(x):
			if smal[i] != 0:
				smal[i] -= 1
				smal[0] = 1
				smalnum = ''.join((str(i) for i in smal))
				break
	print(smalnum, largnum)


(m, s) = map(int, input().split())
maxi = ''
mini = ''
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	for i in range(m):
		k = min(9, s)
		maxi += str(k)
		s -= k
	if s > 0:
		print('-1 -1')
	else:
		mini = maxi[::-1]
		while mini[0] == '0':
			mini = list(maxi[::-1])
			mini = mini[1:]
			for i in range(len(mini)):
				if int(mini[i]) > 0:
					u = int(mini[i]) - 1
					mini[i] = u
					break
			d = str(1) + ''.join(map(str, mini))
			mini = d
		print(mini, end=' ')
		print(maxi)


(dlug, suma) = map(int, input().split())
(wynik_min, wynik_max) = (['1'] + ['0'] * (dlug - 1), '')
if wynik_min == ['1']:
	wynik_min = ['0']
if dlug == 0 or (suma == 0 and dlug > 1):
	print(-1, -1)
elif suma > dlug * 9:
	print(-1, -1)
else:
	x = 0
	kop_suma = suma
	while True:
		if x == dlug:
			break
		x += 1
		if suma >= 9:
			wynik_max += '9'
			suma -= 9
		else:
			wynik_max += str(suma % 9)
			suma -= suma % 9
	suma = kop_suma - 1
	for x in range(dlug - 1, -1, -1):
		if x == 0:
			suma += 1
		if suma == 0:
			break
		if suma >= 9:
			wynik_min[x] = '9'
			suma -= 9
		else:
			wynik_min[x] = str(suma % 9)
			suma -= suma % 9
	print(''.join(wynik_min), wynik_max)


(a, b) = map(int, input().split())
yu = zheng = min_ = max_ = 0
if b > a * 9:
	print(-1, -1)
elif b == a * 9:
	min_ = max_ = int(10 ** a - 1)
	print(min_, max_)
elif a == 1 and b == 0:
	print(0, 0)
elif b == 0:
	print(-1, -1)
elif b >= 10:
	yu = int(b % 9)
	zheng = int(b / 9)
	max_ = int(10 ** a - 10 ** (a - zheng) + yu * 10 ** (a - zheng - 1))
	if yu != 0:
		min_ = int(10 ** zheng - 1 + 10 ** (a - 1) + (b - 1 - zheng * 9) * 10 ** zheng)
		print(min_, max_)
	else:
		min_ = int(10 ** (zheng - 1) - 1 + 10 ** (a - 1) + (b - 1 - (zheng - 1) * 9) * 10 ** (zheng - 1))
		print(min_, max_)
elif b > 1 and a >= 2:
	max_ = int(b * 10 ** (a - 1))
	min_ = int(10 ** (a - 1) + (b - 1))
	print(min_, max_)
elif b > 1 and a == 1:
	min_ = max_ = b
	print(min_, max_)
else:
	max_ = min_ = int(10 ** (a - 1))
	print(min_, max_)


def recur(m1, s1):
	global ans
	if m1 == 1:
		ans.insert(0, s1)
		return
	elif s1 > 9:
		ans.insert(0, 9)
		recur(m1 - 1, s1 - 9)
	else:
		ans.insert(0, s1 - 1)
		recur(m1 - 1, 1)

def grecur(m1, s1):
	global gans
	if m1 == 1:
		gans.append(s1)
		return
	elif s1 > 9:
		gans.append(9)
		grecur(m1 - 1, s1 - 9)
	else:
		gans.append(s1)
		grecur(m1 - 1, 0)
(m, s) = map(int, input().split())
if s == 0 and m > 1 or s > m * 9:
	print('-1 -1')
else:
	(ans, gans) = (list(), list())
	recur(m, s)
	grecur(m, s)
	print(*ans, ' ', *gans, sep='')


def main():
	(m, s) = map(int, input().split())
	if s > 9 * m or (s < 1 and m != 1):
		print(-1, -1)
	else:
		print(int(10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** ((s - 1) // 9) - 1), 10 ** m - 10 ** (m - (s - 1) // 9 - 1) * (9 - (s - 1) % 9))
main()


(m, s) = map(int, input().split())
if s > 9 * m or (s < 1 and m != 1):
	print(-1, -1)
else:
	_min = 10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** ((s - 1) // 9) - 1
	_max = 10 ** m - 10 ** (m - (s - 1) // 9 - 1) * (9 - (s - 1) % 9)
	print(int(_min), int(_max))


(m, s) = map(int, input().split())
if s > 9 * m or (s == 0 and m != 1):
	print(-1, -1)
else:
	print(int(10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** ((s - 1) // 9) - 1), int(10 ** m - int((10 - s % 9) * 10 ** (m - s // 9 - 1))))


(a, b) = list(map(int, input().split()))
if a == 1 and b == 0:
	print('0 0')
	return
if b == 0 or b > a * 9:
	print('-1 -1')
	return
ob = b
ans = ''
for x in range(a):
	if ob > 9:
		ob -= 9
		ans += '9'
	else:
		ans += str(ob)
		ob = 0
big = ans
ans = ''
ob = b
ob -= 1
for x in range(a):
	if ob > 9:
		ob -= 9
		ans = '9' + ans
	else:
		ans = str(ob) + ans
		ob = 0
ans = chr(ord(ans[0]) + 1) + ans[1:]
print(ans, big)


def digit(m, s):
	return s >= 0 and s <= 9 * m
try:
	lowest = ''
	highest = ''
	a = input().split()
	m = int(a[0])
	s = int(a[1])
	total = s
	if not digit(m, s) or s == 0:
		if m == 1 and s == 0:
			print('0 0')
		else:
			print('-1 -1')
		x = 1 / 0
	for i in range(m):
		for j in range(10):
			if (i > 0 or j > 0 or (m == 1 and j == 0)) and digit(m - i - 1, total - j):
				lowest += str(j)
				total -= j
				break
	total = s
	for i in range(m):
		for j in range(9, 0, -1):
			if digit(m - i - 1, total - j):
				highest += str(j)
				total -= j
				break
	while True:
		if len(highest) < m:
			highest += '0'
		else:
			break
	print(lowest, highest)
except:
	a = 1 + 1


inputs = [int(i) for i in input().split()]
ll = inputs[0]
sod = inputs[1]
mn = -1
mx = -1
if ll == 1 and sod < 10:
	print('{} {}'.format(sod, sod))
elif sod == 0:
	print('-1 -1')
elif ll < sod / 9:
	print('-1 -1')
elif ll == sod / 9:
	c = '9' * ll
	print('{} {}'.format(c, c))
else:
	for smallnr in range(9):
		if (sod - smallnr) % 9 == 0:
			numbers = []
			while sod - smallnr - 9 > sum(numbers):
				numbers.append(9)
			numbers.append(sod - smallnr - sum(numbers))
			while numbers.count(0) > 0:
				numbers.remove(0)
			numbers.sort()
			mx = int(str(int(''.join([str(i) for i in numbers]) + str(smallnr))).ljust(ll, '0'))
			if len(numbers) < ll - 1:
				if smallnr != 0:
					numbers.append(smallnr - 1)
				else:
					numbers[0] -= 1
				numbers.sort()
				mn = int('1' + ''.join([str(i) for i in numbers]).rjust(ll - 1, '0'))
			else:
				mn = int(str(smallnr) + ''.join([str(i) for i in numbers]).rjust(ll - 1, '0'))
			numbers.reverse()
			break
	print('{} {}'.format(mn, mx))


(m, s) = [int(x) for x in input().split()]
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or 9 * m < s:
	print(-1, -1)
else:
	a = []
	s1 = s - 1
	for i in range(m):
		a.append(0)
	for i in range(m):
		a[i] += min(s, 9)
		s -= min(s, 9)
		if s <= 0:
			break
	a1 = ''
	for i in range(m):
		a1 += str(a[i])
		a[i] = 0
	a[m - 1] = 1
	for i in range(m):
		if i == m - 1:
			a[i] += min(s1, 8)
			s1 -= min(s1, 8)
		else:
			a[i] += min(s1, 9)
			s1 -= min(s1, 9)
		if s1 <= 0:
			break
	a.reverse()
	a2 = ''
	for i in range(m):
		a2 += str(a[i])
	print(a2, a1)


(m, s) = map(int, input().split())
if 9 * m < s or (m > 1 and s == 0):
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	if s % 9 == 0:
		big = '9' * (s // 9) + '0' * (m - s // 9)
		if s // 9 == m:
			small = '9' * m
		else:
			small = '1' + '0' * (m - 1 - s // 9) + '8' + '9' * (s // 9 - 1)
	else:
		big = '9' * (s // 9) + str(s % 9) + '0' * (m - s // 9 - 1)
		small = ''
		num_9 = s // 9
		r = s % 9 - 1
		num_0 = m - num_9 - 2
		if r == -1:
			small = '1' + '0' * (m - 1 - num_9) + '8' + '9' * (num_9 - 1)
		elif num_0 == -1:
			num_0 += 1
			r += 1
			small = str(r) + '9' * num_9
		else:
			small = '1' + '0' * num_0 + str(r) + '9' * num_9
	print(small, big)


def solve(m, s):
	(min_num, max_num) = (list(), list())
	tot = s
	for i in range(m):
		min_num.append(0)
		max_num.append(0)
	itr = 0
	while itr < m:
		max_num[itr] = min(9, tot)
		tot -= min(tot, 9)
		itr += 1
	(itr, tot) = (0, s)
	min_num[m - 1] = 1
	tot -= 1
	while tot > 0 and itr < m:
		if min_num[itr] < 9:
			min_num[itr] += 1
			tot -= 1
		else:
			itr += 1
			min_num[itr] += 1
			tot -= 1
	(new_min, new_max) = ('', '')
	for i in range(m):
		new_min += str(min_num[m - i - 1])
		new_max += str(max_num[i])
	return (new_min, new_max)
(m, s) = map(int, input().split())
if m * 9 >= s:
	if s > 0:
		(new_min, new_max) = solve(m, s)
		print(new_min, new_max)
	if s == 0:
		if m == 1:
			print(0, 0)
		else:
			print(-1, -1)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
	exit()
if m * 9 < s or s == 0:
	print(-1, -1)
	exit()
l = [9] * m
i = 0
f = 0
x = 9 * m
while i < len(l) and f == 0 and (x != s):
	if l[i] == 1 and i == 0:
		i = i + 1
	elif l[i] == 0:
		i = i + 1
	else:
		l[i] = l[i] - 1
		x = x - 1
		if x == s:
			f = 1
e = ''
p = 0
for i in l:
	u = str(i)
	e = e + u
	p = p + i
o = [0] * m
i = 0
while i < len(l) and p != 0:
	if o[i] == 9:
		i = i + 1
	else:
		o[i] = o[i] + 1
		p = p - 1
r = ''
for i in o:
	r = r + str(i)
print(e, r)


(m, s) = map(int, input().split())
if s == 0 and m != 1 or 9 * m < s:
	print(-1, -1)
else:
	l = s // 9
	k = s % 9
	ma = '9' * l
	if m - l > 0:
		ma = ma + str(k)
		ma = ma + '0' * (m - l - 1)
	mi = 10 ** ((s - 1) // 9) * ((s - 1) % 9 + 1) - 1 + 10 ** (m - 1)
	print(int(mi), ma)


def solve():
	(m, s) = map(int, input().strip().split())
	if s > 9 * m:
		print(-1, -1)
	elif m == 1 and s == 0:
		print(0, 0)
	elif s == 0:
		print(-1, -1)
	else:
		lar = [0] * m
		sm = [0] * m
		sl = s
		i = 0
		while sl != 0:
			if sl >= 9:
				lar[i] = lar[i] + 9
				sl -= 9
				i += 1
			else:
				lar[i] += sl
				sl = 0
		sm[0] = 1
		s -= 1
		i = m - 1
		while s != 0:
			if s >= 9:
				sm[i] += 9
				s -= 9
				i -= 1
			else:
				sm[i] += s
				s = 0
		sm = ''.join(map(str, sm))
		lar = ''.join(map(str, lar))
		if int(sm) >= 10 ** (m - 1) and int(lar) >= 10 ** (m - 1):
			print(sm, lar)
		else:
			print(-1, -1)
solve()


(n, m) = map(int, input().split())

def smal(n, m):
	first = m % 9
	no9 = m // 9
	if no9 < n - 1:
		if not first:
			first = 9
			no9 -= 1
		ans = '1' + '0' * (n - no9 - 2) + str(first - 1) + '9' * no9
	elif no9 == n - 1:
		if not first:
			ans = '18' + '9' * (n - 2)
		else:
			ans = str(first) + '9' * (n - 1)
	else:
		ans = '9' * no9
	return ans

def big(n, m):
	last = m % 9
	no9 = m // 9
	ans = '9' * no9 + str(last) + '0' * (n - no9 - 1)
	return ans[:n]
if m > 9 * n:
	print('-1 -1')
elif m < 1:
	if n == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	print(smal(n, m), big(n, m))


def get_min(l, s):
	if s == 0 and l > 1 or s > 9 * l:
		print('-1 -1', end='')
		return
	nb_9 = min_nb_9 = s // 9
	rest = min_rest = s % 9
	if rest == 0 and nb_9 > 0:
		min_rest = 9
		min_nb_9 -= 1
	remaining_digits = l - min_nb_9
	if remaining_digits < 0:
		print('-1 -1', end='')
		return
	if remaining_digits == 1:
		print(min_rest, '9' * min_nb_9, sep='', end=' ')
	else:
		print(1, '0' * (remaining_digits - 2), min_rest - 1, '9' * min_nb_9, sep='', end=' ')
	print('9' * nb_9, rest or '', '0' * (l - nb_9 - (1 if rest else 0)), sep='', end='')

def main():
	(m, s) = map(int, input().split())
	get_min(m, s)
main()


p = []
m = []
max1 = str()
min1 = str()
(x, y) = map(int, input().split())
for i in range(x):
	p.append(str(0))
if y == 0 and x != 1 or 9 * x < y:
	print('-1 -1')
elif x == 1 and y == 0:
	print(y, y)
elif x == 1:
	print(y, y)
else:
	if y % x == 0 and y % 9 == 0 and (y / x % 9 == 0):
		for i in range(x):
			max1 = max1 + str(9)
	else:
		a = int(y / 9)
		b = y - a * 9
		for i in range(a):
			p[i] = str(9)
		p[a] = str(b)
		for i in range(x):
			max1 = max1 + p[i]
	if y == 1:
		p[0] = str(1)
		for i in range(x):
			min1 = min1 + p[i]
	else:
		a = 9 * x - y
		if a >= 8:
			p[0] = str(1)
			b = int((a - 8) / 9)
			c = a - 8 - b * 9
			for i in range(1, b + 1):
				p[i] = str(0)
			p[b + 1] = str(9 - c)
			for i in range(b + 2, x):
				p[i] = str(9)
			for i in range(x):
				min1 = min1 + p[i]
		if a < 8:
			min1 = min1 + str(9 - a)
			for i in range(1, x):
				min1 = min1 + str(9)
print(min1, max1)


string = input()
numbers = string.split()
m = int(numbers[0])
s = int(numbers[1])
if s < 1 and m != 1 or s > m * 9:
	smallest = '-1'
	largest = '-1'
else:
	digits = []
	if m == 1:
		n = 0
		total = 0
	else:
		n = 10 ** (m - 1)
		total = 1
	for x in str(n):
		digits.append(int(x))
	x = m - 1
	while total != s:
		digits[x] += 1
		total += 1
		if digits[x] == 9:
			x -= 1
	smallest = ''
	for x in digits:
		smallest += str(x)
	digits = []
	for x in str(10 ** m - 1):
		digits.append(int(x))
	total = m * 9
	x = m - 1
	while total != s:
		digits[x] -= 1
		total -= 1
		if digits[x] == 0:
			x -= 1
	largest = ''
	for x in digits:
		largest += str(x)
print('%s %s' % (smallest, largest))


(m, s) = map(int, input().split())
if s <= 0 or s > 9 * m:
	if s == 0 and m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	min_n = ''
	arr = [0] * m
	arr[-1] = 1
	k = s - 1
	for i in range(m):
		arr[i] = min(9, k)
		k -= arr[i]
		min_n += str(arr[i])
	min_n = min_n[::-1]
	min_n = str(int(min_n[0]) + 1) + min_n[1:m + 1]
	max_n = ''
	arr = [0] * m
	k = s
	for i in range(m):
		arr[i] = min(9, k)
		k -= arr[i]
		max_n += str(arr[i])
	print(min_n, max_n)


def solve(m, s):
	if s == 0 and m > 1:
		print(*[-1, -1])
		return 0
	elif s == 0 and m == 1:
		print(*[0, 0])
		return 0
	elif 9 * m < s:
		print(*[-1, -1])
		return 0
	else:
		to = s
		max1 = []
		while sum(max1) != s:
			if to >= 9:
				max1.append(9)
				to -= 9
			elif to < 9:
				max1.append(to)
		max1 += [0] * (m - len(max1))
		if s >= 9 * (m - 1) + 1:
			min1 = max1[::-1]
			print(*min1, sep='')
			print(*max1, sep='')
		elif s < 9 * (m - 1) + 1:
			min1 = [1]
			to = s - 1
			baki = []
			while sum(baki) != s - 1:
				if to >= 9:
					baki.append(9)
					to -= 9
				else:
					baki.append(to)
			min1 = min1 + [0] * (m - 1 - len(baki)) + baki[::-1]
			print(*min1, sep='')
			print(*max1, sep='')
(m, s) = map(int, input().split())
solve(m, s)


def numbers(l, s):
	if l == 1 and s > 9 or (s == 0 and l > 1):
		return '-1 -1'
	if l == 1 and s < 10:
		return str(s) + ' ' + str(s)
	max = []
	s1 = s
	for i in range(l):
		if s1 >= 9:
			max.append(9)
			s1 -= 9
		else:
			max.append(s1)
			s1 -= s1
	if s1 != 0:
		return '-1 -1'
	min = max[::-1]
	if min[0] == 0:
		min[0] = 1
		for i in range(1, l):
			if min[i] != 0:
				min[i] = min[i] - 1
				break
	max_s = ''
	for i in max:
		max_s += str(i)
	min_s = ''
	for i in min:
		min_s += str(i)
	return min_s + ' ' + max_s
(l, s) = map(int, input().split())
print(numbers(l, s))


(length, total) = list(map(int, input().split()))
adad_min = []
adad_max = []
nine_counter = 0
ans = [-1, -1]
for i in range(length):
	adad_max.append(0)
	adad_min.append(0)
temp = total
while temp > 9:
	temp -= 9
	nine_counter += 1
reminder = temp
if nine_counter < length and total != 0:
	for i in range(nine_counter):
		adad_min[length - 1 - i] += 9
	adad_min[0] += 1
	adad_min[length - nine_counter - 1] += reminder - 1
	string = ''
	for j in range(length):
		string += str(adad_min[j])
	ans[0] = string
	for i in range(nine_counter):
		adad_max[i] += 9
	adad_max[nine_counter] += reminder
	string = ''
	for j in range(length):
		string += str(adad_max[j])
	ans[1] = string
elif reminder != 0:
	adad_min[0] += reminder
elif reminder == 0 and length == 1:
	ans = [0, 0]
print(int(ans[0]), int(ans[1]))


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

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

def P(x):
	return stdout.write(str(x))

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

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

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

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def recursion(li, i, s, sm, dp):
	if i == s - 1:
		if sm >= 0 and sm <= 9:
			li[s - 1] = sm
			return True
		else:
			return False
	for j in range(10):
		if sm >= j:
			if dp[i + 1][sm - j] == -1:
				stm = recursion(li, i + 1, s, sm - j, dp)
				dp[i + 1][sm - j] = stm
			else:
				stm = dp[i + 1][sm - j]
			if stm:
				li[i] = j
				return True
	else:
		return False

def recursion1(li, i, s, sm, dp):
	if i == s - 1:
		if sm >= 0 and sm <= 9:
			li[s - 1] = sm
			return True
		else:
			return False
	for j in range(9, -1, -1):
		if sm >= j:
			if dp[i + 1][sm - j] == -1:
				stm = recursion1(li, i + 1, s, sm - j, dp)
				dp[i + 1][sm - j] = stm
			else:
				stm = dp[i + 1][sm - j]
			if stm:
				li[i] = j
				return True
	else:
		return False

def solve():
	(s, m) = IP()
	if s == 1 and len(str(m)) == 1:
		print(m, m)
		return
	elif s == 1 and len(str(m)) != 1:
		print(-1, -1)
		return
	li = [0] * s
	dp = [[-1 for j in range(901)] for i in range(s)]
	for i in range(1, 10):
		stm = recursion(li, 1, s, m - i, dp)
		if stm:
			li[0] = i
			for ele in li:
				print(ele, end='')
			print(' ', end='')
			break
	else:
		print(-1, end=' ')
	dp = [[-1 for j in range(901)] for i in range(s)]
	li = [0] * s
	for i in range(9, 0, -1):
		stm = recursion1(li, 1, s, m - i, dp)
		if stm:
			li[0] = i
			for ele in li:
				print(ele, end='')
			break
	else:
		print(-1)
solve()


(m, s) = map(int, input().split(' '))

def greatest(m, s):
	if m == 0:
		return ''
	dig = min(s, 9)
	return str(dig) + greatest(m - 1, s - dig)

def smallest(m, s):
	dig = max(1, 9 - 9 * m + s)
	return str(dig) + greatest(m - 1, s - 1)[::-1]
if 9 * m < s:
	print('-1 -1')
	quit()
if s == 0:
	if m != 1:
		print('-1 -1')
	else:
		print('0 0')
	quit()
print(smallest(m, s), ' ', greatest(m, s))


import math
l = input().split()
m = int(l[0])
s = int(l[1])
n = math.floor(s / 9)
left = s - 9 * n
ni = math.floor((s - 1) / 9)
lefti = s - 9 * ni - 1
nmin = []
for i in range(m):
	nmin.append(0)
nmax = []
for j in range(m):
	nmax.append(0)
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif n > m:
	print('-1 -1')
elif n == m:
	if left == 0:
		for k in range(m):
			nmin[k] = 9
			nmax[k] = 9
		nminstr = ''
		for e in nmin:
			nminstr += str(e)
		nmaxstr = ''
		for q in nmax:
			nmaxstr += str(q)
		print('{} {}'.format(nminstr, nmaxstr))
	else:
		print('-1 -1')
else:
	if n == 0:
		if m == 1:
			nmin[0] = s
			nmax[0] = s
		else:
			nmin[0] = 1
			nmin[m - 1] = s - 1
			nmax[0] = s
	elif m - n == 1:
		nmin[0] = left
		for k in range(ni):
			nmin[m - k - 1] = 9
		nmax[n] = left
		for u in range(n):
			nmax[u] = 9
	else:
		nmin[0] = 1
		nmin[m - ni - 1] = lefti
		for k in range(ni):
			nmin[m - k - 1] = 9
		nmax[n] = left
		for u in range(n):
			nmax[u] = 9
	nminstr = ''
	for e in nmin:
		nminstr += str(e)
	nmaxstr = ''
	for q in nmax:
		nmaxstr += str(q)
	print('{} {}'.format(nminstr, nmaxstr))


(m, s) = [int(i) for i in input().split()]
s1 = s
s2 = s
list1 = [0] * m
if s == 0 and m != 1:
	print(-1, -1)
if s > 9 * m and m != 1:
	print(-1, -1)
if s != 0 and s <= 9 * m and (m != 1):
	for i in range(m):
		for t in range(10):
			if t <= s1:
				list1[i] = t
		s1 = s1 - list1[i]
	list1 = [str(i) for i in list1]
	maximun = ''.join(list1)
	maximun = int(maximun)
	list2 = [0] * m
	list2[0] = 1
	for i in range(m - 1, 0, -1):
		for t in range(10):
			if t <= s2 - 1:
				list2[i] = t
		s2 = s2 - list2[i]
	if s2 >= 2:
		list2[0] = s2
	list2 = [str(i) for i in list2]
	minimun = ''.join(list2)
	minimun = int(minimun)
	print(minimun, maximun)
if m == 1:
	if s > 9:
		print(-1, -1)
	else:
		print(s, s)


(m, s) = [int(x) for x in input().split()]
sup = [9] * m
inf = [1] + [0] * (m - 1)
diff_lower = s - 1
diff_upper = 9 * m - s
if 9 * m >= s and s != 0:
	for i in range(m - 1, -1, -1):
		if diff_upper // 9 > 0:
			sup[i] = 0
			diff_upper = diff_upper - 9
		else:
			sup[i] = sup[i] - diff_upper % 9
			break
	for i in range(m - 1, -1, -1):
		if diff_lower // 9 > 0:
			inf[i] = 9
			diff_lower = diff_lower - 9
		else:
			inf[i] = inf[i] + diff_lower % 9
			break
	print(*inf, sep='', end=' ')
	print(*sup, sep='')
elif m == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
mi = -1
ma = -1
a = s // 9
b = s % 9
if m == 1 and s == 0:
	mi = ma = 0
elif 1 <= s <= 9 * m:
	if a == m and b == 0:
		ma = 10 ** m - 1
	else:
		ma = 10 ** m - 10 ** (m - a) + s % 9 * 10 ** (m - a - 1)
	if b == 0:
		if a == m:
			mi = 10 ** m - 1
		else:
			mi = 10 ** (m - 1) + 9 * 10 ** (a - 1) - 1
	elif b == 1:
		mi = 10 ** (m - 1) + 10 ** a - 1
	elif m - a == 1:
		mi = (b + 1) * 10 ** (m - 1) - 1
	else:
		mi = 10 ** (m - 1) + b * 10 ** a - 1
print(int(mi), int(ma))


(m, s) = map(int, input().split())
z = s
maxn = ''
minn = ''
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print('-1 -1')
elif s > 9 * m:
	print('-1 -1')
else:
	for i in range(m):
		if s >= 9:
			maxn += str(9)
			s -= 9
		elif s == 0:
			maxn += str(0)
		else:
			maxn += str(s)
			s = 0
	s = z
	for i in range(m):
		if s >= 10:
			minn = '9' + minn
			s -= 9
		elif s == 1:
			if i == m - 1:
				minn = '1' + minn
			else:
				minn = '0' + minn
		else:
			y = s - 1
			if i == m - 1:
				minn = str(s) + minn
			else:
				minn = str(y) + minn
				s = 1
	print(minn, maxn)


ms = input().split()
m = int(ms[0])
s = int(ms[1])

def go(b, m, s):
	if s >= 10:
		b.append(9)
		go(b, m - 1, s - 9)
	elif m == 1:
		b.append(s)
	elif m > 1:
		b.append(s - 1)
		for i in range(m - 2):
			b.append(0)
		b.append(1)
a = []
b = []
if 9 * m >= s >= 1:
	for i in range(s // 9):
		a.append(9)
	if s % 9 != 0:
		a.append(s % 9)
	while len(a) < m:
		a.append(0)
	go(b, m, s)
	c = reversed(b)
	for i in c:
		print('{}'.format(i), end='')
	print(' ', end='')
	for i in a:
		print('{}'.format(i), end='')
elif m == 1 and s == 0:
	print('0 0')
else:
	print('-1 -1')


(m, og_s) = list(map(int, input().split()))
maxn = ''
if m == 1 and og_s == 0:
	print(0, 0)
	exit()
s = og_s
while s > 0:
	for i in range(9, 0, -1):
		if s - i >= 0:
			s -= i
			maxn += str(i)
			break
if maxn == '' or len(maxn) > m:
	print(-1, -1)
	exit()
num_zeroes = m - len(maxn)
minn = '1' if num_zeroes >= 1 else ''
addon = str(int(maxn) - 1)[::-1] if minn == '1' else maxn[::-1]
minn += '0' * (num_zeroes - 1) + addon
maxn += '0' * num_zeroes
print(minn, maxn)


import math
(m, s) = map(int, input().split())
origs = s
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit()
num = []
for i in range(m):
	if s:
		num.append(min(9, s))
		s -= min(9, s)
	else:
		num.append(0)
if len(num) == 0 or math.ceil(origs / 9) > m:
	print(-1, -1)
	exit()
mx = ''.join([str(i) for i in num])
if num[-1] == 0:
	for e in range(m):
		l = num[-1 - e]
		if l > 0:
			num[-1 - e] = str(int(l) - 1)
			num[-1] = 1
			break
mn = ''.join([str(i) for i in num[::-1]])
print(mn, mx)


(m, s) = map(int, input().split())
k = []
if s == 0 and m != 1:
	print(-1, end=' ')
	print(-1)
elif s == 0 and m == 1:
	print(0, end=' ')
	print(0)
elif s > 9 * m:
	print(-1, end=' ')
	print(-1)
else:
	a = s - 1
	for i in range(m):
		if a > 9:
			k.append(9)
			a = a - 9
		else:
			k.append(a)
			a = 0
	k[m - 1] = k[m - 1] + 1
	print(*k[::-1], sep='', end=' ')
	for i in range(m):
		if s > 9:
			k[i] = 9
			s = s - 9
		else:
			k[i] = s
			s = 0
	print(*k, sep='')


from sys import stdin, stdout

def main():

	def can(m, s):
		return s >= 0 and s <= 9 * m

	def f(m, s):
		_sum = s
		minn = 0
		for i in range(m):
			for d in range(0, 10):
				if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, _sum - d):
					minn += d
					minn *= 10
					_sum -= d
					break
		maxx = 0
		_sum = s
		for i in range(m):
			for d in range(9, -1, -1):
				if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, _sum - d):
					maxx += d
					maxx *= 10
					_sum -= d
					break
		if len(str(minn // 10)) != m or len(str(maxx // 10)) != m:
			return '-1 -1'
		if sum(list(map(int, list(str(minn // 10))))) != s:
			return '-1 -1'
		if sum(list(map(int, list(str(maxx // 10))))) != s:
			return '-1 -1'
		return '{} {}'.format(minn // 10, maxx // 10)
	(m, s) = map(int, stdin.readline().strip().split(' '))
	print(f(m, s))
main()


(m, s) = map(int, input().split())
if 9 * m < s:
	print('-1 -1')
elif s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	mini = [0] * m
	for i in range(s // 9):
		mini[-(i + 1)] = 9
	if s % 9 != 0:
		mini[-(s // 9) - 1] = s % 9
	maxi = sorted(mini, reverse=True)
	if mini[0] == 0:
		for i in range(1, m):
			if mini[i] != 0:
				mini[0] = 1
				mini[i] -= 1
				break
	print(''.join(map(str, mini)), end=' ')
	print(''.join(map(str, maxi)))


digit_sum = lambda number_str: sum((int(x) for x in number_str if x.isdigit()))

def main():
	(m, s) = input().split()
	try:
		m = int(m)
		s = int(s)
	except TypeError:
		print('Invalid not number input')
	if m == 1 and s == 0:
		print('0 0')
		return
	if not 1 <= s <= 9 * m:
		print(-1, -1)
		return
	smallest_number_with_m_digits = list('1' + '0' * (m - 1))
	greatest_number_with_m_digits = list('9' * m)
	starting_index = -1
	digit_sum_var = digit_sum(smallest_number_with_m_digits)
	while digit_sum_var < s:
		current_digit = smallest_number_with_m_digits[starting_index]
		smallest_number_with_m_digits[starting_index] = chr(ord(current_digit) + 1)
		digit_sum_var += 1
		if current_digit == '8':
			starting_index -= 1
	starting_index = -1
	digit_sum_var = digit_sum(greatest_number_with_m_digits)
	while digit_sum_var > s:
		current_digit = greatest_number_with_m_digits[starting_index]
		greatest_number_with_m_digits[starting_index] = chr(ord(current_digit) - 1)
		digit_sum_var -= 1
		if current_digit == '1':
			starting_index -= 1
	print(''.join(smallest_number_with_m_digits), ''.join(greatest_number_with_m_digits))
main()


(m, s) = map(int, input().split())
if m > 1 and s == 0 or (m == 1 and s > 9) or s > m * 9:
	print(-1, -1)
else:
	s1 = s
	st = ['0'] * m
	i = m - 1
	while s1 > 9:
		st[i] = '9'
		i -= 1
		s1 -= 9
	st[0] = '1'
	s1 -= 1
	st[i] = str(int(st[i]) + s1)
	ans1 = int(''.join(st))
	s2 = s
	st = ['0'] * m
	i = 0
	while s2 > 9:
		st[i] = '9'
		i += 1
		s2 -= 9
	st[i] = str(s2)
	ans2 = int(''.join(st))
	print(ans1, ans2)


def maxgen(m, s):
	ans = [0 for i in range(m)]
	for i in range(m):
		if s >= 9:
			ans[i] = 9
			s = s - 9
		else:
			ans[i] = s
			break
	return ans
(m, s) = list(map(int, input().split()))
if m == 1 and s == 0:
	print(0, 0)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	mina = [0 for i in range(m)]
	mina[0] = max(s - 9 * (m - 1), 1)
	maxa = maxgen(m, s)
	t = maxgen(m - 1, s - 1)
	t.reverse()
	for i in range(1, m):
		mina[i] = t[i - 1]
	ansa = ''.join((str(x) for x in mina))
	ansb = ''.join((str(x) for x in maxa))
	print(ansa, ansb)


L = [int(x) for x in input().split()]
if L[1] > L[0] * 9 or (L[1] == 0 and L[0] != 1):
	max = -1
else:
	a = L[1]
	b = L[0] - 1
	c = 0
	i = 0
	while b >= 0:
		if a >= 9:
			c += 9 * 10 ** b
			a -= 9
			b -= 1
		else:
			c += a * 10 ** b
			a = 0
			b -= 1
	max = c
if L[1] > L[0] * 9 or (L[1] == 0 and L[0] != 1):
	m = -1
elif L[1] == 0 and L[0] == 1:
	m = 0
elif L[1] > (L[0] - 1) * 9:
	m = str(L[1] - (L[0] - 1) * 9) + '9' * (L[0] - 1)
else:
	f = (L[1] - 1) // 9
	g = (L[1] - 1) % 9
	h = str(g) + '9' * f
	m = '1' + '0' * (L[0] - (1 + len(h))) + h
print(str(m) + ' ' + str(max))


l = list(map(int, input().split(' ')))
m = l[0]
s = l[1]
a = list()
b = list()
S = 0
n = 0
while n < m:
	if 9 + S <= s:
		a.append(9)
		S = S + 9
		n = n + 1
	elif 8 + S <= s:
		a.append(8)
		S = S + 8
		n = n + 1
	elif 7 + S <= s:
		a.append(7)
		S = S + 7
		n = n + 1
	elif 6 + S <= s:
		a.append(6)
		n = n + 1
		S = S + 6
	elif 5 + S <= s:
		a.append(5)
		n = n + 1
		S = S + 5
	elif 4 + S <= s:
		a.append(4)
		n = n + 1
		S = S + 4
	elif 3 + S <= s:
		a.append(3)
		S = S + 3
		n = n + 1
	elif 2 + S <= s:
		a.append(2)
		n = n + 1
		S = S + 2
	elif 1 + S <= s:
		a.append(1)
		n = n + 1
		S = S + 1
	elif 0 + S <= s:
		a.append(0)
		n = n + 1
		S = S + 0
n = 0
S = 0
k = 0
while n < m and m > 1:
	if 0 + S <= s and n >= 1 and (S + 0 + (m - (n + 1)) * 9 >= s):
		b.append(0)
		S = S + 0
		n = n + 1
	elif 1 + S <= s and S + 1 + (m - (n + 1)) * 9 >= s:
		b.append(1)
		S = S + 1
		n = n + 1
	elif 2 + S <= s and S + 2 + (m - (n + 1)) * 9 >= s:
		b.append(2)
		S = S + 2
		n = n + 1
	elif 3 + S <= s and S + 3 + (m - (n + 1)) * 9 >= s:
		b.append(3)
		n = n + 1
		S = S + 3
	elif 4 + S <= s and S + 4 + (m - (n + 1)) * 9 >= s:
		b.append(4)
		n = n + 1
		S = S + 4
	elif 5 + S <= s and S + 5 + (m - (n + 1)) * 9 >= s:
		b.append(5)
		n = n + 1
		S = S + 5
	elif 6 + S <= s and S + 6 + (m - (n + 1)) * 9 >= s:
		b.append(6)
		n = n + 1
		S = S + 6
	elif 7 + S <= s and S + 7 + (m - (n + 1)) * 9 >= s:
		b.append(7)
		n = n + 1
		S = S + 7
	elif 8 + S <= s and S + 8 + (m - (n + 1)) * 9 >= s:
		b.append(8)
		n = n + 1
		S = S + 8
	elif 9 + S <= s and S + 9 + (m - (n + 1)) * 9 >= s:
		b.append(9)
		n = n + 1
		S = S + 9
	k = k + 1
	if k == m:
		break
if m == 1 and s < 10:
	b.append(s)
if m > 1 and s == 0:
	print('-1 -1')
elif sum(a) == s and sum(b) == s:
	a = map(str, a)
	b = map(str, b)
	print(''.join(b), ''.join(a))
else:
	print('-1 -1')


(m, s) = [int(i) for i in input().split(' ')]
smallest = 10 ** (m - 1)
largest = 10 ** m - 1
small_sum = 1
large_sum = 9 * m
if s == 0 and m == 1:
	print(0, 0)
elif small_sum > s or large_sum < s:
	print(-1, -1)
else:
	i = 0
	while small_sum < s:
		smallest += 10 ** i * min(s - small_sum, 9)
		small_sum = sum((int(digit) for digit in str(smallest)))
		i += 1
	i = 0
	while large_sum > s:
		largest -= 10 ** i * min(large_sum - s, 9)
		large_sum = sum((int(digit) for digit in str(largest)))
		i += 1
	print(smallest, largest)


line = input()
m = int(line.split(' ')[0])
s = int(line.split(' ')[1])
max = 0
min = 0
if m > 1:
	if s != 0:
		if s < 9 * m:
			a = s // 9
			b = s % 9
			for i in range(1, a + 1):
				max = max + 9 * 10 ** i
			max = max + b
			max = max * 10 ** (m - a - 1)
			if a == m - 1:
				if b != 0:
					min = b * 10 ** (m - 1)
					for i in range(a):
						min = min + 9 * 10 ** i
				if b == 0:
					min = 18 * 10 ** (m - 2)
					min = min + 99
			if a < m - 1:
				if b != 0:
					for i in range(a):
						min = min + 9 * 10 ** i
					while b > 1:
						min = min + 10 ** a
						b = b - 1
					min = min + 10 ** (m - 1)
				if b == 0:
					for i in range(a - 1):
						min = min + 9 * 10 ** i
					min = min + 8 * 10 ** (a - 1)
					min = min + 10 ** (m - 1)
		if s == 9 * m:
			for i in range(m):
				max = max + 9 * 10 ** i
				min = max
		if s > 9 * m:
			max = -1
			min = -1
	else:
		max = -1
		min = -1
if m == 1:
	if s <= 9:
		min = s
		max = s
	else:
		min = -1
		max = -1
print(min, max)


(m, s) = map(int, input().split())
dp_max = [[0] * (s + 1) for i in range(m + 1)]
dp_min = [[-1] * (s + 1) for i in range(m + 1)]
for i in range(1, min(10, s + 1)):
	dp_min[1][i] = i
	dp_max[1][i] = i
for i in range(2, m + 1):
	for j in range(s + 1):
		for d in range(10):
			if j - d >= 0:
				dp_max[i][j] = max(dp_max[i][j], dp_max[i - 1][j - d] * 10 + d)
				if dp_min[i - 1][j - d] != -1:
					if dp_min[i][j] == -1:
						dp_min[i][j] = dp_min[i - 1][j - d] * 10 + d
					dp_min[i][j] = min(dp_min[i][j], dp_min[i - 1][j - d] * 10 + d)
dp_max[1][0] = 0
dp_min[1][0] = 0
if dp_min[m][s] == -1:
	print(-1, -1)
else:
	print(dp_min[m][s], dp_max[m][s])


import sys

def possible(m, s):
	return s <= 9 * m and s >= 0
n = list(map(int, input().split()))
(m, s) = (n[0], n[1])
min_remaining_sum = s
max_remaining_sum = s
if s == 0:
	if m == 1:
		print(0, 0)
		sys.exit()
	else:
		print(-1, -1)
		sys.exit()
if not possible(m, s):
	print(-1, -1)
	sys.exit()
min_ans = ''
max_ans = ''
for i in range(0, m):
	for d in range(0, 10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and possible(m - i - 1, min_remaining_sum - d):
			min_ans += str(d)
			min_remaining_sum -= d
			break
print(min_ans)
for i in range(0, m):
	for d in range(9, -1, -1):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and possible(m - i - 1, max_remaining_sum - d):
			max_ans += str(d)
			max_remaining_sum -= d
			break
print(max_ans)


a = input().split()
b = int(a[0])
c = int(a[1])
c1 = c
l1 = []
l2 = []
if c == 0 and b != 1:
	print('-1 -1')
elif c > b * 9:
	print('-1 -1')
else:
	d = 0
	for i in range(b):
		c -= 9
		if c >= 0:
			d += 1
		else:
			break
	if c == 0:
		for i in range(b):
			l1.append(str(9))
	else:
		e = c + 9
		f = b - d - 1
		for i in range(d):
			l1.append(str(9))
		l1.append(str(e))
		for i in range(f):
			l1.append(str(0))
	g = c1 - 1
	h = 0
	for i in range(b - 1):
		g -= 9
		if g >= 0:
			h += 1
		else:
			break
	i = c1 - 9 * h
	if h == b - 1:
		l2.append(str(i))
		for i in range(b - 1):
			l2.append(str(9))
	else:
		l2.append(str(1))
		j = b - h - 1
		for i in range(j - 1):
			l2.append(str(0))
		l2.append(str(c1 - 9 * h - 1))
		for i in range(h):
			l2.append(str(9))
	print(''.join(l2) + ' ' + ''.join(l1))


(m, s) = map(int, input().split())
copyM = m
copyS = s
ans = ''
mx = ''
mn = ''
if s > 0 and m * 9 >= s:
	for i in range(m, 0, -1):
		if s <= 0:
			digit = 0
		else:
			digit = 9
			if digit > s:
				digit = s
			s = s - digit
		m = m - 1
		mx = mx + str(digit)
	m = copyM
	s = copyS
	for i in range(m, 0, -1):
		digit = 9
		if s == 1:
			if i != 1:
				digit = 0
			else:
				digit = 1
		elif s < 10:
			digit = s - 1
			if i == 1:
				digit = digit + 1
		s = s - digit
		mn = mn + str(digit)
	mn = mn[::-1]
	ans = mn + ' ' + mx
else:
	ans = '-1 -1'
	if m == 1 and s == 0:
		ans = '0 0'
print(ans)


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
(m, s1) = [int(n1) for n1 in input().split()]
a = ['0'] * m
b = ['0'] * m
s = s1
for i in range(len(a)):
	if s >= 9:
		a[i] = '9'
		s = s - 9
	else:
		a[i] = str(s)
		s = 0
		break
s = s1
for i in range(len(a)):
	if s > 9:
		b[m - 1 - i] = '9'
		s = s - 9
	elif 1 < s <= 9:
		if m - 1 - i == 0:
			b[m - 1 - i] = str(s)
			break
		else:
			b[m - 1 - i] = str(s - 1)
			s = 1
	elif s == 1:
		b[0] = str(int(b[0]) + 1)
		break
sum1 = 0
sum2 = 0
for i in range(len(a)):
	sum1 = int(a[i]) + sum1
	sum2 = int(b[i]) + sum2
s = s1
if sum1 == sum2 == s and s != 0:
	print(''.join(b), ''.join(a))
elif m == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


def maximize(m, s):
	ans = [9] * m
	val = 9 * m
	for i in range(m - 1, -1, -1):
		if val - 9 > s:
			ans[i] = 0
			val -= 9
		else:
			ans[i] = s - (val - 9)
			break
	return ''.join([str(d) for d in ans])

def minimize(m, s):
	ans = [1] + [0] * (m - 1)
	val = 1
	for i in range(m - 1, -1, -1):
		if val + 9 < s:
			ans[i] = 9
			val += 9
		else:
			ans[i] = s - (val - ans[i])
			break
	return ''.join([str(d) for d in ans])
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif 1 <= s and s <= 9 * m:
	print(minimize(m, s), maximize(m, s))
else:
	print(-1, -1)


def fmax(m, s, number_max):
	for i in range(m):
		for y in range(9, 0, -1):
			if s // y > 0:
				s -= y
				number_max[i] = str(y)
				break
	return ''.join([str(x) for x in number_max])

def fmin(m, s, number_min):
	for i in range(m - 1, -1, -1):
		for y in range(9, 0, -1):
			if s // y > 0:
				s -= y
				number_min[i] = y
				if s == 0:
					number_min[0] += 1
					number_min[i] -= 1
					break
				break
	return ''.join([str(x) for x in number_min])

def main():
	(m, s) = map(int, input().split())
	number_max = [0] * m
	number_min = [0] * m
	if m * 9 < s or (s == 0 and m > 1):
		print('-1 -1')
	elif m == 1:
		print('{} {}'.format(s, s))
	else:
		print('{} {} '.format(fmin(m, s, number_min), fmax(m, s, number_max)))
main()


piece = input().split()
length = int(piece[0])
digit = int(piece[1])
if length > 1 and digit < 1 or digit > 9 * length:
	print(-1, -1)
	exit()
tempt = ''
(a, b) = (length, digit)
for i in range(a):
	if b >= 9:
		tempt = tempt + '9'
		b = b - 9
	else:
		tempt = tempt + str(b)
		b = 0
big = tempt
tempt = ''
(a, b) = (length, digit)
for i in range(a):
	if i == a - 1:
		tempt = str(b) + tempt
		continue
	if b >= 10:
		tempt = '9' + tempt
		b = b - 9
	else:
		tempt = str(b - 1) + tempt
		b = 1
small = tempt
print(small, big)


(m, s) = map(int, input().split())
max_ = 0
min_ = 0
if m > 1:
	if s > 9 * m or s == 0:
		print('-1 -1')
	else:
		i = 0
		while s > 9 * i:
			i += 1
		a = s - 9 * (i - 1)
		stra = str(a)
		string = '9' * (i - 1) + stra + '0' * (m - i)
		max_ = string
		if s == 1:
			min_ = max_ = '1' + '0' * (m - 1)
		else:
			j = 0
			while s > 9 * j:
				j += 1
			b = s - 1 - 9 * (j - 1)
			if m > j + 1:
				strb = str(b)
				string2 = '1' + '0' * (m - j - 1) + strb + '9' * (j - 1)
				min_ = string2
			elif m == j - 1:
				string1 = '9' * m
				min_ = string1
			elif m == j:
				strb = str(b + 1)
				string3 = strb + '9' * (j - 1)
				min_ = string3
			elif m == j + 1:
				strb = str(b)
				string4 = '1' + strb + '9' * (j - 1)
				min_ = string4
		print('%s %s' % (min_, max_))
if m == 1:
	if s > 9:
		print('-1 -1')
	else:
		max_ = s
		min_ = s
		print('%s %s' % (min_, max_))


from sys import stdin
lines = list([_f for _f in stdin.read().split('\n') if _f])

def parseline(line):
	return list(map(int, line.split()))
lines = list(map(parseline, lines))
(m, s) = lines[0]
if 9 * m < s or (m > 1 and s == 0):
	print('-1 -1')
	return
if m == 1 and s == 0:
	minimum = [0]
else:
	minimum = []
	s1 = s
	while s1 > 0:
		digit = min(9, s1)
		minimum.append(digit)
		s1 -= digit
	if len(minimum) < m:
		minimum[-1] -= 1
		minimum += [0] * (m - len(minimum) - 1)
		minimum.append(1)
minimum = ''.join(map(str, reversed(minimum)))
maximum = []
s2 = s
while s2 > 0:
	digit = min(9, s2)
	maximum.append(digit)
	s2 -= digit
maximum += [0] * (m - len(maximum))
maximum = ''.join(map(str, maximum))
print(minimum, maximum)


(a, b) = list(map(int, input().split()))
if a > 1 and b < 1 or b > 9 * a:
	print(-1, -1)
else:
	c = b
	for i in range(a - 1, -1, -1):
		x = max(0, c - 9 * i)
		if x == 0 and i == a - 1 and c:
			x = 1
		print(x, end='')
		c -= x
	print('', end=' ')
	c = b
	for i in range(a - 1, -1, -1):
		y = min(9, c)
		print(y, end='')
		c -= y


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def small(n, s):
	arr = [1] + [0] * (n - 1)
	for i in range(n - 1, -1, -1):
		arr[i] = 9
		if sum(arr) < s:
			continue
		j = i
		while sum(arr) != s:
			arr[j] -= 1
			if arr[j] == -1:
				return [-1]
		return arr
	return [-1]

def large(n, s):
	arr = [9] * n
	for i in range(n - 1, -1, -1):
		arr[i] = 0
		if sum(arr) > s:
			continue
		j = i
		while sum(arr) != s:
			arr[j] += 1
			if arr[j] == 10:
				return [-1]
		return arr
	return [-1]
(n, s) = zz()
if s == 0:
	if n == 1:
		exit(print(0, 0))
	exit(print(-1, -1))
l = large(n, s)
s = small(n, s)
print(''.join((str(i) for i in s)), ''.join((str(i) for i in l)))


(x, y) = map(int, input().split())

def big(x, y):
	if y >= 9 and y <= x * 9:
		a = [9] * (y // 9)
		c1 = y - sum(a)
		if c1 != 0:
			a.append(c1)
		if len(a) != x:
			a1 = [0] * (x - len(a))
			a = a + a1
		return ''.join((str(i) for i in a))
	elif 0 < y < 9:
		a = [y]
		if len(a) != x:
			a1 = [0] * (x - len(a))
			a = a + a1
		return ''.join((str(i) for i in a))
	elif y == 0 and x == 1:
		return '0'
	else:
		return '-1'

def small(x, y):
	if y >= 9 and y <= x * 9:
		a = [9] * (y // 9)
		c1 = y - sum(a)
		if c1 != 0:
			a.insert(0, c1)
		if len(a) != x:
			c2 = a.pop(0)
			if len(a) != 0:
				a1 = [0] * (x - (len(a) + 2))
			else:
				a1 = [0] * (x - 2)
			if c2 - 1 != 0:
				a1.append(c2 - 1)
			else:
				a1.append(0)
			a1.insert(0, 1)
			a = a1 + a
		return ''.join((str(i) for i in a))
	elif 0 < y < 9:
		if x != 1:
			a = [0] * (x - 2)
			a.insert(0, 1)
			a.append(y - 1)
			return ''.join((str(i) for i in a))
		else:
			return y
	elif y == 0 and x == 1:
		return '0'
	else:
		return '-1'
print(small(x, y), big(x, y))


(m, s) = map(int, input().split())
s1 = s
m1 = m
mini = 0
max1 = 0
while m > 0:
	num1 = -1
	num2 = -1
	for i in range(9, -1, -1):
		if s - i >= 0 and i != 0:
			num1 = i
			break
		elif s - i >= 0 and max1 > 0:
			num1 = i
			break
		elif s - i >= 0 and m1 == 1:
			num1 = i
			break
	for i in range(9, -1, -1):
		if s1 - i >= 1:
			num2 = i
			break
	if m == 1 and s1 <= 9:
		num2 = s1
	if num1 == -1:
		max1 = -1
	else:
		max1 += num1 * 10 ** (m - 1)
		s -= num1
	if num2 == -1:
		mini = -1
	else:
		mini += num2 * 10 ** (m1 - m)
		s1 -= num2
	m -= 1
if s > 0:
	max1 = -1
if s1 > 0:
	mini = -1
print(str(mini) + ' ' + str(max1))


[m, S] = input().split()
MAX = []
MIN = []
s = int(S)
if int(s) <= 0 and int(m) != 1 or int(s) > 9 * int(m):
	print('-1 -1')
elif int(s) == 0 and int(m) == 1:
	print('0 0')
else:
	for i in range(0, int(m)):
		s -= 9
		if s <= 0:
			MAX.append(int(s) + 9)
			s = 0
		else:
			MAX.append(9)
	for i in range(0, int(m)):
		MIN.append(MAX[int(m) - i - 1])
	try:
		n = int(m) - MAX.index(0) - 1
		MIN[0] += 1
		MIN[n + 1] -= 1
		for i in range(0, int(m)):
			MAX[i] = str(MAX[i])
			MIN[i] = str(MIN[i])
		print(''.join(MIN), end=' ')
		print(''.join(MAX))
	except ValueError:
		for i in range(0, int(m)):
			MAX[i] = str(MAX[i])
			MIN[i] = str(MIN[i])
		print(''.join(MIN), end=' ')
		print(''.join(MAX))


(m, n) = (int(i) for i in input().split())
if n == 0 and m != 1 or n > 9 * m:
	print(-1, -1)
else:
	maxnum = ''
	n1 = n
	for i in range(m):
		maxnum += str(min(n1, 9))
		n1 -= min(n1, 9)
	minnum = ''
	if n >= m:
		for i in range(m - 1):
			minnum += str(min(n - 1, 9))
			n -= min(n - 1, 9)
		minnum += str(n)
		print(minnum[::-1], maxnum)
	else:
		a = ''
		for i in range(m - 1):
			a += str(min(n - 1, 9))
			n -= min(n - 1, 9)
		print(str(n) + a[::-1], maxnum)


(a, b) = map(int, input().split())
if b == 0 and a != 1 or b > a * 9:
	print('-1 -1')
elif b == 0 and a == 1:
	print('0 0')
else:
	c = []
	while b != 0:
		if b >= 9:
			c.append(9)
			b -= 9
		else:
			c.append(b)
			b = 0
	while a - len(c) != 0:
		c.append(0)
	d = c[:]
	d.reverse()
	if a != 1 and b == 1:
		for i in c:
			print(i, end='')
	elif d[0] != 0:
		for i in d:
			print(i, end='')
	else:
		for i in range(len(d)):
			if d[i] != 0:
				d[i] -= 1
				d[0] = 1
				break
		for i in d:
			print(i, end='')
	print(end=' ')
	for i in c:
		print(i, end='')


(m, k) = map(int, input().split(' '))
if k == 0 and m == 1:
	print(0, 0)
elif k == 0 or k > 9 * m:
	print(-1, -1)
else:
	s = k
	maximum = [0] * m
	minimum = [0] * m
	i = 0
	while i < m and s > 0:
		if s <= 9:
			maximum[i] += s
			s = 0
		else:
			maximum[i] += 9
			s -= 9
		i += 1
	s = k
	minimum[0] = 1
	s -= 1
	j = m - 1
	while j >= 0 and s > 0:
		if s <= 9:
			minimum[j] += s
			s = 0
		else:
			minimum[j] += 9
			s -= 9
		j -= 1
	n1 = ''
	n2 = ''
	for e in minimum:
		n1 += str(e)
	for e in maximum:
		n2 += str(e)
	print(n1, n2)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	e = s // m
	amax = []
	for i in range(m):
		amax.append(e)
	l = s % m
	for i in range(m):
		if l > 0:
			amax[i] += 1
			l -= 1
		else:
			break
	for i in range(m):
		j = i + 1
		while amax[i] < 9:
			if j >= m:
				break
			else:
				temp = amax[i]
				amax[i] += min(9 - amax[i], amax[j])
				amax[j] -= min(9 - temp, amax[j])
				j += 1
	amin = amax[::-1]
	if amin[0] == 0:
		for i in range(m):
			if amin[i] > 0:
				amin[i] -= 1
				amin[0] = 1
				break
	for i in amin:
		print(i, end='')
	print(end=' ')
	for i in amax:
		print(i, end='')
	print()


asdf = [int(x) for x in input().split(' ')]
length = asdf[0]
summ = asdf[1]
smallest = 0
largest = 0
if length * 9 < summ:
	smallest = -1
	largest = -1
elif summ < 1:
	if length == 1:
		smallest = 0
		largest = 0
	else:
		smallest = -1
		largest = -1
else:
	smallestDigs = [1]
	largestDigs = [1]
	for i in range(1, length):
		smallestDigs.append(0)
		largestDigs.append(0)
	currentSum = 1
	currentIndex = length - 1
	while currentSum < summ:
		if summ - currentSum >= 9:
			smallestDigs[currentIndex] = 9
			currentSum += 9
		else:
			smallestDigs[currentIndex] = smallestDigs[currentIndex] + summ - currentSum
			currentSum = summ
		currentIndex -= 1
	if summ <= 9:
		largestDigs = [summ]
		largestDigs.extend([0 for k in range(1, length)])
	else:
		largestDigs[0] = 9
		currentSum = 9
		currentIndex = 1
		while currentSum < summ:
			if summ - currentSum >= 9:
				largestDigs[currentIndex] = 9
				currentSum += 9
			else:
				largestDigs[currentIndex] = summ - currentSum
				currentSum = summ
			currentIndex += 1
	for i in range(length):
		smallest += int(10 ** (length - 1 - i) * smallestDigs[i])
		largest += int(10 ** (length - 1 - i) * largestDigs[i])
print(str(smallest) + ' ' + str(largest))


(m, s) = map(int, input().split())
if m != 1 and s == 0 or s > 9 * m:
	print('-1 -1')
elif (m, s) == (1, 0):
	print('0 0')
else:
	rem = s
	for i in range(1, m + 1):
		if i == 1:
			b = 1
		else:
			b = 0
		d = max(b, rem - 9 * (m - i))
		print(d, end='')
		rem -= d
	print(' ', end='')
	rem = s
	for i in range(1, m + 1):
		d = min(9, rem)
		print(d, end='')
		rem -= d


(M, S) = list(map(int, input().split()))
if M == 1 and S == 0:
	print('0 0')
	exit(0)
if M > 1 and S == 0 or S > 9 * M:
	print(-1, end=' ')
else:
	s = S
	res = ''
	for i in range(M - 1):
		next = min(9, s - 1)
		s -= next
		res = str(next) + res
	res = str(max(s, 1)) + res
	print(res, end=' ')
if M > 1 and S == 0 or S > 9 * M:
	print(-1)
else:
	s = S
	for i in range(M):
		next = min(9, s)
		s -= next
		print(next, end='')
	print()


(a, b) = input().split()
a = int(a)
b = int(b)
c = b - 1
n = 10 ** (a - 1)
m = 0
if b < 0 or b > 9 * a:
	print('-1 -1')
elif a == 1 and b == 0:
	print('0 0')
elif b == 0 and a > 1:
	print('-1 -1')
else:
	for i in range(a):
		if b >= 9:
			m += 9 * 10 ** (a - 1 - i)
		if 0 < b < 9:
			m += b * 10 ** (a - 1 - i)
			b = 0
			break
		if b <= 0:
			break
		b -= 9
	for i in range(a - 1):
		if c >= 9:
			n += 9 * 10 ** i
		if 0 < c < 9:
			n += c * 10 ** i
			c = 0
			break
		if c <= 0:
			break
		c -= 9
	if c > 0:
		n += c * 10 ** (a - 1)
	print(n, m)


(m, s) = map(int, input().split())
if 9 * m < s:
	print(*[-1, -1])
elif s == 0 and m > 1:
	print(*[-1, -1])
elif s == 0:
	print(0, 0)
else:
	(a, b) = ([0] * m, [0] * m)
	a[0] = 1
	r = s
	s -= 1
	for i in range(0, m):
		for j in range(1, 10):
			if r != 0:
				b[i] += 1
				r -= 1
			if s != 0:
				a[m - 1 - i] += 1
				s -= 1
			if r == 0:
				break
	b = int(''.join(map(str, b)))
	a = int(''.join(map(str, a)))
	print(a, b)


def find_max_num(s, m):
	if s == 0 and m != 1 or s > m * 9:
		return '-1'
	else:
		return find_max_num_aux(s, m)

def find_max_num_aux(s, m):
	if s < 0:
		return '-1'
	if m == 1:
		return str(s)
	else:
		for i in range(9, -1, -1):
			x = find_max_num_aux(s - i, m - 1)
			if int(x) != -1:
				return str(i) + x
			i -= 1
		return '-1'

def find_min_num(s, m):
	if s == 0 and m != 1 or s > m * 9:
		return '-1'
	elif s == 0:
		return '0'
	else:
		for i in range(1, 10):
			if s - i <= (m - 1) * 9:
				break
		return str(i) + find_min_num_aux(s - i, m - 1)

def find_min_num_aux(s, m):
	if s < 0 or s > m * 9:
		return '-1'
	if s == m * 9:
		return '9' * m
	if m == 1:
		if s < 10:
			return str(s)
	else:
		for i in range(0, 10):
			x = find_min_num_aux(s - i, m - 1)
			if int(x) != -1:
				return str(i) + x
			i += 1
		return '-1'
(_m, _s) = input().split()
print(find_min_num(int(_s), int(_m)) + ' ' + find_max_num(int(_s), int(_m)))


def can(m, s):
	if s >= 1 and s <= m * 9 or s == 0:
		return 1
	return 0
(m, s) = map(int, input().split())
sum = s
max = ''
min = ''
if m == 1 and s >= 0 and (s <= 9):
	print(s, s)
else:
	for i in range(1, m + 1):
		for d in range(10):
			if (i == 1 and d > 0 or i > 1) and can(m - i, sum - d):
				min = min + str(d)
				sum = sum - d
				break
		else:
			print('-1 -1')
			break
	sum = s
	for i in range(1, m + 1):
		for d in range(9, -1, -1):
			if (i == 1 and d > 0 or i > 1) and can(m - i, sum - d):
				max = max + str(d)
				sum -= d
				break
		else:
			break
	else:
		print(min, max)


(m, s) = input('').split()
m = int(m)
s = int(s)
if s > m * 9 or (s == 0 and m != 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	(x, k, p) = (0, 0, 1)
	n = int(10 ** (m - 1))
	while s > 9:
		p = 10 * p
		k = k + 1
		x = 9 * n + x
		n = 10 ** (m - k - 1)
		s = s - 9
	x = int(s * n + x)
	if len(str(x)) < m:
		print(m - len(str(x)))
		x = int(x * 10 ** (m - len(str(x))))
	y = str(int(x))[::-1]
	if y[0] == '0':
		y = int(y) + 10 ** (m - 1) - p
	print(int(y), int(x))


(m, s) = [int(x) for x in input().split()]
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or s > m * 9:
	print(-1, -1)
else:
	s2 = s
	output = ''
	if s - (m - 1) * 9 < 0:
		output += '1'
		s -= 1
		for i in range(1, m):
			a = max(0, s - (m - i - 1) * 9)
			output += str(a)
			s -= a
	else:
		for i in range(m):
			a = max(0, s - (m - i - 1) * 9)
			output += str(a)
			s -= a
	output += ' '
	for i in range(m):
		a = min(9, s2)
		output += str(a)
		s2 -= a
	print(output)


(M, S) = map(int, input().split())
if S == 0 and M == 1:
	print('0 0')
	exit()
elif S == 0 or M * 9 < S:
	print('-1 -1')
	exit()
(m, s) = (M, S)
l = []
if s <= (m - 1) * 9 + 1:
	l.append(1)
	s -= 1
while len(l) < m:
	r = (m - len(l) - 1) * 9
	if s <= r:
		l.append(0)
	else:
		l.append(s - r)
		s -= s - r
(m, s) = (M, S)
h = []
while s >= 9:
	h.append(9)
	s -= 9
while len(h) < m:
	h.append(s)
	s = 0
print(''.join((repr(x) for x in l)), ''.join((repr(x) for x in h)))


(m, s) = map(int, input().split())
k = s
r = s
l = []
t = []

def max():
	global k
	global l
	for i in range(0, m):
		if k >= 9:
			l.append(9)
			k = k - 9
		elif 1 <= k < 9:
			l.append(k)
			k = 0
		else:
			l.append(0)
	l = int(''.join(list(map(str, l))))
	print(l)

def min():
	global r
	global t
	for i in range(0, m):
		if r == 0:
			print(0)
		if r > 9:
			t.append(9)
			r = r - 9
		elif 1 < r <= 9 and i != m - 1:
			t.append(r - 1)
			r = 1
		elif 1 < r <= 9 and i == m - 1:
			t.append(r)
			break
		elif i == m - 1:
			t.append(1)
		else:
			t.append(0)
	t.reverse()
	t = int(''.join(list(map(str, t))))
	print(t, end=' ')
if s > 9 * m:
	print('-1', end=' ')
	print('-1')
	exit()
elif s == 0 and m == 1:
	print(0, end=' ')
	print(0)
elif s == 0:
	print('-1', end=' ')
	print('-1')
	exit()
else:
	min()
	max()


str1 = input()
a = int(str1.split()[0])
b = int(str1.split()[1])
if 9 * a < b:
	print('-1 -1')
elif 1 > b:
	if a == 1:
		print(0, 0)
	if a != 1:
		print('-1 -1')
else:
	c = b // 9
	d = b % 9
	n = 0
	p1 = 0
	p2 = 0
	while n < c:
		p1 = p1 + 9 * 10 ** (a - n - 1)
		n = n + 1
	p1 = p1 + d * 10 ** (a - n - 1)
	e = b - 1
	f = e // 9
	d = e % 9
	m = 0
	while m < f:
		p2 = p2 + 9 * 10 ** m
		m = m + 1
	if f >= a - 1:
		p2 = (e % 9 + 1) * 10 ** (a - 1) + p2
	else:
		p2 = p2 + 10 ** (a - 1)
		p2 = e % 9 * 10 ** m + p2
	if 9 * a == b:
		p1 = p2
	print(int(p2), int(p1))


(m, s) = map(int, input().split())
strings = []
count = s
n = 0
if s == 0 and m > 1 or s > m * 9:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	for i in range(m):
		strings.append(0)
	while count > 0:
		if count >= 9:
			strings[n] = 9
			count -= 9
		else:
			strings[n] = count
			count = 0
		n += 1
	string = [str(i) for i in strings]
	max_num = int(''.join(string))
	nstrings = []
	for i in range(m):
		nstrings.append(0)
	n = 0
	count = s
	while count > 0:
		n -= 1
		if count >= 9:
			nstrings[n] = 9
			count -= 9
		else:
			nstrings[n] = count
			count = 0
	if nstrings[0] == 0:
		nstrings[0] = 1
		nstrings[n] -= 1
	nstring = [str(i) for i in nstrings]
	min_num = int(''.join(nstring))
	print(min_num, max_num)


def sum2(n, s):
	if s == 0 and n == 1:
		return '0 0'
	elif s == 0 and n != 1:
		return '-1 -1'
	numL = ''
	if s > 9 * n:
		return '-1 -1'
	numL += '9' * (s // 9)
	if len(numL) < n:
		numL += str(s - s // 9 * 9)
	numL += '0' * (n - len(numL))
	numS = numL[::-1]
	zeros = 0
	for i in range(len(numS)):
		if numS[i] != '0':
			numS = numS[i:]
			break
		zeros += 1
	if zeros == 0:
		return str(numS) + ' ' + str(numL)
	numS = '1' + '0' * (zeros - 1) + str(int(numS[0]) - 1) + numS[1:]
	return str(numS) + ' ' + str(numL)
(n, s) = [int(x) for x in input().split()]
print(sum2(n, s))


(m, s) = map(int, input().split())
temp = m
m = s
s = temp
numbers = [9] * s
difference = 9 * s - m
low = ''
high = ''
i = 0
if s == 0 or m == 0:
	if s == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif 9 * s < m:
	print(-1, -1)
else:
	while i < len(numbers):
		if difference >= 9:
			numbers[i] = 0
			difference -= 9
			if difference == 0:
				break
		else:
			numbers[i] = 9 - difference
			break
		i += 1
	i = 0
	while i < len(numbers):
		low += str(numbers[i])
		i += 1
	i = -1
	while i >= -len(numbers):
		high += str(numbers[i])
		i -= 1
	if numbers[0] == 0:
		j = 0
		while low[j] == '0':
			j += 1
		numbers[0] = 1
		numbers[j] -= 1
		numbers = list(map(str, numbers))
		low = ''.join(numbers)
	print(low, high)


(n, m) = map(int, input().split())
ma = ''
mas = m
mi = ''
mis = m
done = False
for i in range(n):
	for j in range(9, (not bool(i)) - 1 if i != n - 1 else -1, -1):
		if 0 <= mas - j <= (n - i - 1) * 9:
			ma += str(j)
			mas -= j
			break
	else:
		break
	for j in range(not bool(i) if i != n - 1 else 0, 10):
		if 0 <= mis - j <= (n - i - 1) * 9:
			mi += str(j)
			mis -= j
			break
	else:
		break
else:
	print(mi, ma)
	done = True
if not done:
	print(-1, -1)


(m, s) = list(map(int, str.split(input())))
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	num = [0] * (m - 1) + [1]
	for i in range(m):
		num[i] += min(9, s - sum(num))
	a = str.join('', list(map(str, num[::-1])))
	num = [0] * m
	for i in range(m):
		num[i] = min(9, s - sum(num))
	b = str.join('', list(map(str, num)))
	print(a, b)


def get_max(num_digits, sum_digits):
	if sum_digits > 9 * num_digits:
		return (-1, -1)
	max_num = [None for __ in range(num_digits)]
	start_num = 9
	current_sum = 0
	current_digit = 0
	while current_digit < num_digits:
		while start_num > sum_digits - current_sum and start_num > 0:
			start_num -= 1
		if current_digit == 0 and start_num == 0 and (num_digits > 1):
			return (-1, -1)
		if start_num < 0:
			return (-1, -1)
		max_num[current_digit] = start_num
		current_sum += start_num
		current_digit += 1
	min_num = max_num[::-1]
	if min_num[0] != 0:
		max_num = ''.join(map(str, max_num))
		min_num = ''.join(map(str, min_num))
		return (min_num, max_num)
	else:
		for idx in range(len(min_num)):
			if min_num[idx] != 0:
				min_num[idx] -= 1
				min_num[0] = 1
				break
		max_num = ''.join(map(str, max_num))
		min_num = ''.join(map(str, min_num))
		return (min_num, max_num)
(m, s) = list(map(int, input().split()))
(minim, maxim) = get_max(m, s)
print(minim, maxim)


(m, s) = [int(x) for x in input().split()]
if m == 1 and s >= 0 and (s <= 9):
	x = str(s)
	y = str(s)
elif m == 1 and (s < 0 or s > 9):
	x = '-1'
	y = '-1'
elif m > 1 and (s < 1 or s > 9 * m):
	x = '-1'
	y = '-1'
else:
	a = s - 1
	b = 9 * m - s
	c = a // 9
	d = a % 9
	e = b // 9
	f = b % 9
	if c < m - 1:
		x = '1' + '0' * (m - c - 2) + str(d) + '9' * c
	else:
		x = str(1 + d) + '9' * (m - 1)
	y = '9' * (m - e - 1) + str(9 - f) + '0' * e
print(int(''.join(x)), int(''.join(y)))


(n, m) = map(int, input().split())
if m == 1:
	x = '1' + '0' * (n - 1)
	print(x, x)
elif m == 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif m <= 9:
	if n == 1:
		print(m, m)
	else:
		y = str(m) + '0' * (n - 1)
		z = '1' + '0' * (n - 2) + str(m - 1)
		print(z, y)
else:
	c = '9'
	m -= 9
	while m > 0:
		if m > 9:
			c += str(9)
			m -= 9
		else:
			c += str(m)
			m = 0
	k = len(c)
	if k > n:
		print(-1, -1)
	elif k == n:
		print(c[::-1], c)
	elif c[-1] == '1':
		x = c[::-1]
		print('1' + '0' * (n - k) + x[1:], c + '0' * (n - k))
	else:
		y = c[-1]
		p = c[::-1]
		z = '1' + '0' * (n - k - 1) + str(int(y) - 1) + p[1:]
		print(z, c + '0' * (n - k))


def f0(m, s):
	n = [0 for x in range(m)]
	n[0] = 1
	s -= 1
	for i in range(m - 1, -1, -1):
		if s == 0:
			break
		if s < 10:
			n[i] += s
			break
		else:
			n[i] = 9
			s -= 9
	n = [str(x) for x in n]
	return ''.join(n)

def f1(m, s):
	n = [0 for x in range(m)]
	for i in range(m):
		if s == 0:
			break
		if s < 10:
			n[i] = s
			break
		else:
			n[i] = 9
			s -= 9
	n = [str(x) for x in n]
	return ''.join(n)
(m, s) = (int(x) for x in input().split())
if m == 1 and s == 0:
	print('0 0')
elif s < 1 or s > m * 9:
	print('-1 -1')
else:
	print(f0(m, s), f1(m, s))


def f(m, s):
	(a, b) = divmod(s, 9)
	res = '9' * a
	if b:
		res += str(b) + '0' * (m - a - 1)
	else:
		res += '0' * (m - a)
	return res
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
	exit()
if 9 * m >= s > 0:
	(a, b) = divmod(s, 9)
	if m - a > 1:
		print('1', f(m - 1, s - 1)[::-1], sep='', end=' ')
	else:
		print(f(m, s)[::-1], end=' ')
	print(f(m, s))
	exit()
print(-1, -1)


(m, s) = map(int, input().split())
su = s
m2 = m
if m > 1 and s == 0:
	print('-1 -1')
	exit()
elif s / m > 9:
	print('-1 -1')
	exit()
elif m == 1 and s == 0:
	print('0 0')
	exit()
else:
	d = 0
	while m != 0:
		if s > 9:
			e = 9
		else:
			e = s
		d += e * 10 ** (m - 1)
		s -= e
		m -= 1
	k = su
	c = ''
	for i in range(m2 - 1, -1, -1):
		j = max(0, k - 9 * i)
		if j == 0 and i == m2 - 1:
			j = 1
		c += str(j)
		k = k - int(j)
print(c, d)


(m, s) = map(int, input().split())
if s > m * 9 or (s < 1 and m > 1):
	print('-1 -1')
else:
	a = s
	b = s
	index = m - 1
	while index >= 0:
		pos = max(0, a - 9 * index)
		if index == m - 1 and a and (pos == 0):
			pos = 1
		print(pos, end='')
		index -= 1
		a -= pos
	print(' ')
	index = m - 1
	while index >= 0:
		pos = min(9, b)
		print(pos, end='')
		index -= 1
		b -= pos


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
(m, s) = L()
if 9 * m < s:
	print(-1, -1)
	exit()
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit()
if m == 1:
	if s <= 9:
		print(s, s)
	else:
		print(-1, -1)
	exit()
mn = 0
mx = 0
x = s // 9
mx = '9' * x + str(s % 9) * (x != m) + '0' * (m - x - 1)
mn = '9' * (x - int(s % 9 == 0))
if len(mn) == m - 1:
	mn += str(s - 9 * (x - int(s % 9 == 0)))
else:
	mn += str(s - 9 * (x - int(s % 9 == 0)) - 1)
if len(mn) == m:
	mn = mn[::-1]
else:
	a = m - len(mn)
	mn += '0' * (a - 1) + '1'
	mn = mn[::-1]
print(mn, mx)
endtime = time.time()


z = input().split()
m = int(z[0])
s = int(z[1])
if s > 9 * m:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
elif s < 1:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif m * 9 == s:
	print('9' * m, '9' * m)
else:
	maximum = '9' * int(s / 9)
	maximum += str(s % 9)
	maximum += '0' * (m - int(s / 9) - 1)
	minimum = list(maximum[::-1])
	if minimum[0] == '0':
		minimum[m - maximum.find('0')] = int(minimum[m - maximum.find('0')]) - 1
		minimum[0] = '1'
	for i in minimum:
		print(i, end='')
	print(' ', maximum)


def Biggest(m, s):
	ans = 0
	if m == 1 and s == 0:
		return 0
	for i in range(m):
		ans = ans * 10 + min(9, s)
		if s > 9:
			s -= 9
		else:
			s = 0
	if ans == 0 or s != 0:
		return -1
	else:
		return ans

def Smallest(m, s):
	ans = ''
	if m == 1 and s == 0:
		return '0'
	if s == 0:
		return -1
	for i in range(m):
		if s > 9:
			ans = '9' + ans
			s -= 9
		elif i != m - 1:
			if s != 0:
				ans = str(s - 1) + ans
				s = 0
			else:
				ans = '0' + ans
		elif i == m - 1:
			if s == 0:
				s = 1
			if s > 9:
				return -1
			ans = str(s) + ans
			return ans
	return -1
(m, s) = input().split()
(m, s) = (int(m), int(s))
print(str(Smallest(m, s)) + ' ' + str(Biggest(m, s)))


import sys
from functools import lru_cache
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
sys.setrecursionlimit(2 * pow(10, 6))
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(m, s) = sp()
div = ceil(s / 9)
if div > m:
	out('-1 -1')
	exit()
if s == 0 and m > 1:
	out('-1 -1')
	exit()
high = '9' * floor(s / 9) + (str(s % 9), '')[not s % 9]
for i in range(m - len(high)):
	high += '0'
low = ['0']
low.extend(['0'] * (m - 1))
i = m - 1
while s > 0:
	if s > 9:
		low[i] = '9'
		s -= 9
	else:
		low[i] = str(s)
		if i != 0:
			low[i] = str(int(low[i]) - 1)
		s = 1
		break
	i -= 1
if low[0] == '0':
	low[0] = str(s)
out(''.join(low) + ' ' + str(high))


(m, s) = map(int, input().split())
(m1, s1) = (m, s)
(a, b) = ([], [])
if m * 9 < s or (s == 0 and m != 1):
	print('-1 -1')
elif s == 1:
	print('1' + '0' * (m - 1), '1' + '0' * (m - 1))
elif m == 1:
	print(s, s)
elif m > 1:
	if s - 1 < (m - 1) * 9:
		b.append('1')
		s -= 1
	if s % 9 != 0:
		b.append(str(s % 9))
	s -= s % 9
	while s > 9:
		b.append('9')
		s -= 9
	if s != 0:
		b.append(str(s))
	print(b[0] + '0' * (m1 - len(b)) + ''.join(b[1:]), end=' ')
	s = s1
	while s > 9:
		a.append('9')
		s -= 9
	a.append(str(s))
	print(''.join(a) + '0' * (m1 - len(a)))


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print('0 0\n')
	else:
		print('-1 -1\n')
	exit()
temp = '9' * (s // 9)
if s % 9:
	temp += f'{s % 9}'
if len(temp) > m:
	print('-1 -1\n')
	exit()
maximum = temp
while len(maximum) < m:
	maximum += '0'
while len(temp) < m:
	temp = temp[:-1] + f'{int(temp[-1]) - 1}'
	while len(temp) < m - 1:
		temp += '0'
	temp += '1'
minimum = temp[::-1]
print(f'{minimum} {maximum}')


mn = input().split()
m = int(mn[0])
n = int(mn[1])
temp = n
A = [0 for i in range(0, m)]
B = [0 for i in range(0, m)]
if m == 1 and n == 0:
	print('0 0')
elif n < 1 or n > 9 * m:
	print('-1 -1')
else:
	A[0] = 1
	n -= 1
	for i in range(m - 1, -1, -1):
		if n > 9:
			A[i] += 9
		else:
			A[i] += n
		n -= A[i]
	n = int(mn[1])
	for i in range(0, m):
		if n > 9:
			B[i] += 9
		else:
			B[i] += n
		n -= B[i]
	minimum = 0
	maximum = 0
	for i in range(0, m):
		minimum += A[i] * pow(10, m - i - 1)
	for i in range(m - 1, -1, -1):
		maximum += B[i] * pow(10, m - i - 1)
	print(minimum, maximum)


import sys
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	sys.exit(0)
if m * 9 < s:
	print(-1, -1)
	sys.exit(0)
if m == 1:
	print(s, s)
	sys.exit(0)
l = int(s / 9)
mx = '9' * l
if l < m:
	mx += str(s % 9)
if m - l - 1 > 0:
	mx += '0' * (m - l - 1)
if l < m and s % 9 == 0:
	mi = '8' + '9' * (l - 1)
	if m - l - 1 > 0:
		mi = '1' + '0' * (m - l - 1) + mi
	else:
		mi = '1' + mi
	print(mi, mx)
	sys.exit(0)
else:
	mi = '9' * l
	if l < m:
		if l == m - 1:
			mi = str(s % 9) + mi
		else:
			mi = str(s % 9 - 1) + mi
	if m - l - 1 > 0:
		if m - l - 1 > 1:
			mi = '1' + '0' * (m - l - 2) + mi
		else:
			mi = '1' + mi
	print(mi, mx)


a = input()
m = int(a.split()[0])
s = int(a.split()[1])
k = 0
if 9 * m < s:
	print('-1 -1')
elif s == 0 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
elif s <= 9 and s > 0:
	print(10 ** (m - 1) + s - 1, 10 ** (m - 1) * s)
else:
	if (s - 1) % 9 == 0 and s != 10:
		for i in range(m - int(s / 9), m):
			k += 10 ** i
		ax = 9 * k + s % 9 * 10 ** (m - int(s / 9) - 1)
		k = 0
		for i in range(0, int(s / 9)):
			k += 10 ** i
		ix = 9 * k + 10 ** (m - 1)
	elif (s - 1) % 9 != 0 and s != 10 and ((s - 1) % 9 != 8):
		for i in range(m - int(s / 9), m):
			k += 10 ** i
		ax = 9 * k + s % 9 * 10 ** (m - int(s / 9) - 1)
		k = 0
		for i in range(0, int(s / 9)):
			k += 10 ** i
		ix = 9 * k + 10 ** (m - 1)
		ix += (s - 1) % 9 * 10 ** int(s / 9)
	elif (s - 1) % 9 != 0 and s != 10 and ((s - 1) % 9 == 8) and (s < 9 * m):
		for i in range(m - int(s / 9), m):
			k += 10 ** i
		ax = 9 * k + s % 9 * 10 ** (m - int(s / 9) - 1)
		k = 0
		for i in range(0, int(s / 9 - 1)):
			k += 10 ** i
		ix = 9 * k + 10 ** (m - 1)
		ix += (s - 1) % 9 * 10 ** int(s / 9 - 1)
	elif (s - 1) % 9 != 0 and s != 10 and ((s - 1) % 9 == 8) and (s == 9 * m):
		for i in range(0, int(m)):
			k += 10 ** i
		ix = 9 * k
		ax = ix
	else:
		ix = 10 ** (m - 1) + 9
		ax = 10 ** (m - 1) * 9 + 10 ** (m - 2)
	print(int(ix), int(ax))


(digit, total) = map(int, input().split())
if total == 0 and digit == 1:
	print(0, 0)
elif total == 0 or total > 9 * digit:
	print(-1, -1)
else:
	nine = total // 9
	rem = total % 9
	if rem != 0:
		mx = '9' * nine + str(rem)
	else:
		mx = '9' * nine
	mx = mx + '0' * (digit - len(mx))
	if mx[-1] != '0':
		mn = mx[::-1]
	else:
		zeros = mx.count('0')
		mx_rev = mx[::-1]
		change = mx_rev[zeros]
		new = str(int(change) - 1)
		mn = mx_rev.replace(change, new, 1)
		mn = mn.replace('0', '1', 1)
	print(mn, mx)


(m, s) = [int(i) for i in input().split()]
st = s
if s <= 0 and m > 1 or s > m * 9:
	print('-1', '-1')
	exit()
else:
	for i in range(m - 1, -1, -1):
		last = max(0, s - 9 * i)
		if last <= 0 and i == m - 1 and (s != 0):
			last = 1
		print(last, end='')
		s -= last
	print(' ', end='')
	for i in range(m - 1, -1, -1):
		first = min(9, st)
		print(first, end='')
		st -= first


(n, k) = map(int, input().split())
if n != 1 and k == 0 or k > 9 * n:
	print('-1 -1')
else:
	p = k // 9
	r = k % 9
	u = '0' * n
	x = u
	su = 0
	i = n - 1
	while su != k:
		if su < k:
			x = k - su
			if x < 9:
				u = u[:i] + str(x) + u[i + 1:]
				su += x
			else:
				u = u[:i] + '9' + u[i + 1:]
				su += 9
		elif su > k:
			u = u[:i] + '0' + u[i + 1:]
			su -= 1
		if su == k:
			g = u.count('0')
			x = u[::-1]
			if g == 0:
				break
			else:
				u = '1' + '0' * (g - 1) + str(int(u[i]) - 1) + u[i + 1:]
		i -= 1
	print(u, x)


(m, s) = (int(t) for t in input().split())
if (m, s) == (1, 0):
	print(0, 0)
elif s > 9 * m or s < 1:
	print(-1, -1)
elif s == 1:
	print('1' + '0' * (m - 1) + ' ' + '1' + '0' * (m - 1))
elif s == 9 * m:
	print('9' * m + ' ' + '9' * m)
else:
	minim = [1] + [0] * (m - 1)
	tmp = s - 1
	index = m - 1
	while tmp != 0:
		if tmp < 9:
			minim[index] += tmp
			tmp = 0
		else:
			minim[index] += 9
			tmp -= 9
		index -= 1
	for i in range(m):
		print(minim[i], end='')
	print(' ', end='')
	maxim = [0] * m
	tmp = s
	index = 0
	while tmp != 0:
		if tmp < 9:
			maxim[index] += tmp
			tmp = 0
		else:
			maxim[index] += 9
			tmp -= 9
		index += 1
	for i in range(m):
		print(maxim[i], end='')


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
	return
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
else:
	n = (s - 1) // 9
	if n == m - 1:
		print(s - n * 9, '9' * n, sep='', end=' ')
		print('9' * n, s - n * 9, sep='')
	else:
		print('1', '0' * (m - n - 2), s - n * 9 - 1, '9' * n, sep='', end=' ')
		print('9' * n, s - n * 9, '0' * (m - n - 1), sep='')


def make_small(m, s):
	if s == 0:
		return -1 if m > 1 else 0
	s -= 1
	result = ''
	for i in range(m):
		digit_to_append = min(9, s)
		result += str(digit_to_append)
		s -= digit_to_append
	result = result[::-1]
	result = list(result)
	result[0] = str(int(result[0]) + 1)
	result = ''.join(result)
	if s != 0 or int(result[0]) == 0 or len(result) != m:
		return -1
	return result

def make_large(m, s):
	if s == 0:
		return -1 if m > 1 else 0
	result = ''
	for i in range(m):
		digit_to_append = min(9, s)
		result += str(digit_to_append)
		s -= digit_to_append
	if s != 0 or int(result[0]) == 0 or len(result) != m:
		return -1
	return result
(m, s) = [int(x) for x in input().split()]
print('{} {}'.format(make_small(m, s), make_large(m, s)))


(n, s) = map(int, input().split(' '))
if n == 1 and s == 0:
	print(0, 0)
elif s < 1 or s > 9 * n:
	print(-1, -1)
else:
	arr = [0] * n
	arr1 = [0] * n
	s1 = s
	i = 0
	while s > 9:
		arr[i] = 9
		s -= 9
		i += 1
	arr[i] = s
	if arr[-1] == 0:
		arr1[0] = 1
		flag = 0
		i = 2
		while i <= n:
			if flag == 0:
				if arr[-i] != 0:
					arr1[i - 1] = arr[-i] - 1
					flag = 1
				else:
					arr1[i - 1] = arr[-i]
			else:
				arr1[i - 1] = arr[-i]
			i += 1
		for i in arr1:
			print(i, end='')
		print(end=' ')
		for i in arr:
			print(i, end='')
	else:
		i = n - 1
		while i >= 0:
			print(arr[i], end='')
			i -= 1
		print(end=' ')
		for i in arr:
			print(i, end='')


inpu = input().split()
length = int(inpu[0])
sum = int(inpu[1])
if length == 1 and sum == 0:
	print('0 0')
elif length * sum == 0 or sum / length > 9:
	print('-1 -1')
else:
	small = 1 * 10 ** (length - 1)
	sumt = sum - 1
	for i in range(length):
		if sumt > 9:
			small += 9 * 10 ** i
			sumt -= 9
		else:
			small += sumt * 10 ** i
			break
	print(small, end=' ')
	small = 0
	for i in range(length):
		if sum >= 9:
			small += 9 * 10 ** (length - i - 1)
			sum -= 9
		else:
			small += sum * 10 ** (length - i - 1)
			break
	print(small)


from sys import stdin, stdout

def main():
	(length, total) = [int(i) for i in stdin.readline().split()]
	if length == 1 and total == 0:
		stdout.write('0 0\n')
	elif total == 0 or total > 9 * length:
		stdout.write('-1 -1\n')
	else:
		arr = []
		for i in range(length):
			arr = arr + [10 ** i] * 9
		upper = 0
		for i in range(total):
			upper += arr.pop(-1)
			if len(arr) == 0:
				break
		arr = []
		for i in range(length):
			arr = arr + [10 ** i] * 9
		lower = 0
		lower += arr.pop(-1)
		for i in range(total - 1):
			lower += arr.pop(0)
			if len(arr) == 0:
				break
		stdout.write(str(lower) + ' ' + str(upper) + '\n')
main()


temparr = input()
temparr = temparr.split()
numofdigit = int(temparr[0])
totalsum = int(temparr[1])
smalltotalsum = int(temparr[1])
getfinalaaa = ''

def check(digit, sumleft, strs):
	if digit == 0 and sumleft > 0:
		return -1
	if digit == 0 and sumleft == 0:
		return strs
	if sumleft < 0:
		return -1
	if sumleft > 9 * digit:
		return -1
	for i in range(0, 10):
		newsum = sumleft - i
		strstemp = strs[:] + str(i)
		ansleft = check(digit - 1, newsum, strstemp)
		if ansleft != -1:
			return ansleft
for i in range(1, 10):
	sumleft = smalltotalsum - i
	strs = str(i)
	ansleft = check(numofdigit - 1, sumleft, strs)
	if ansleft != -1:
		break
getfinalaaa += str(ansleft)
getfinalaaa += ' '
if ansleft == -1:
	if totalsum == 0 and numofdigit == 1:
		print('0', '0')
	else:
		print('-1 -1')
else:

	def checkmost(digit, sumleft, strs):
		if digit == 0 and sumleft > 0:
			return -1
		if digit == 0 and sumleft == 0:
			return strs
		if sumleft < 0:
			return -1
		if sumleft > 9 * digit:
			return -1
		for i in range(9, -1, -1):
			newsum = sumleft - i
			strstemp = strs[:] + str(i)
			ansleft = checkmost(digit - 1, newsum, strstemp)
			if ansleft != -1:
				return ansleft
	for i in range(9, 0, -1):
		sumleft = totalsum - i
		strs = str(i)
		ansleft = checkmost(numofdigit - 1, sumleft, strs)
		if ansleft != -1:
			break
	getfinalaaa += str(ansleft)
	print(getfinalaaa)


import math
(m, s) = map(int, input().split())
end = []
head = []
output = ' '
if s == 0 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
elif m == 1:
	if s >= 10:
		print('-1 -1')
	else:
		print(str(s) + ' ' + str(s))
elif s == 1:
	output = '1' + '0' * (m - 1) + output + '1' + '0' * (m - 1)
	print(output)
else:
	numof9 = s // 9
	sleft = s % 9
	if numof9 > m:
		print('-1 -1')
	elif numof9 == m and sleft == 0:
		print('9' * numof9 + ' ' + '9' * numof9)
	elif numof9 == m and sleft != 0:
		print('-1 -1')
	elif numof9 == m - 1 and sleft != 0:
		print(str(sleft) + '9' * numof9 + ' ' + '9' * numof9 + str(sleft))
	else:
		digits = ['9'] * numof9
		if sleft != 0:
			digits.append(str(sleft - 1))
		else:
			digits = ['9'] * (numof9 - 1)
			digits.append('8')
		digits = digits + ['0'] * (m - len(digits) - 1)
		digits.sort()
		digits = ['1'] + digits
		output = ''.join(digits) + output + '9' * numof9
		if sleft != 0:
			output = output + str(sleft) + '0' * (m - numof9 - 1)
		else:
			output = output + '0' * (m - numof9)
		print(output)


n = input().split()
m = int(n[0])
s = int(n[1])
if s == 0 and m == 1:
	print('0 0')
if s == 0 and m >= 2 or s > 9 * m:
	print('-1 -1')
if s <= 9 and s > 0:
	a = 10 ** (m - 1) + s - 1
	b = s * 10 ** (m - 1)
	print('%d %d' % (a, b))
if s > 9 and s < 9 * m:
	c = s // 9
	e = (s - 1) // 9
	b = 0
	a = 10 ** (m - 1)
	for i in range(c):
		z = m - i - 1
		b = b + 9 * 10 ** z
	for i in range(e):
		a = a + 9 * 10 ** i
	d = s - 9 * c
	f = s - 1 - 9 * e
	b = b + d * 10 ** (m - c - 1)
	a = a + f * 10 ** e
	print('%d %d' % (a, b))
if s == 9 * m and s > 9:
	a = 10 ** m - 1
	b = 10 ** m - 1
	print('%d %d' % (a, b))


def det(m, s):
	return s < 0 or m * 9 < s
(m, s) = map(int, input().split())
if det(m, s):
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
elif s == 0:
	print(-1, -1)
else:
	s2 = s
	m2 = m
	for i in range(m):
		if i == 0:
			for j in range(1, 10):
				if not det(m - 1, s - j):
					print(j, end='')
					m -= 1
					s -= j
					break
		else:
			for j in range(10):
				if not det(m - 1, s - j):
					print(j, end='')
					m -= 1
					s -= j
					break
	(s, m) = (s2, m2)
	print(' ', end='')
	for i in range(m):
		for j in range(9, -1, -1):
			if not det(m - 1, s - j):
				print(j, end='')
				m -= 1
				s -= j
				break


(n, m) = [int(i) for i in input().split()]
c = m // 9
d = m % 9
k = n * [0]
if m <= 9 and n == 1:
	print(m, m)
if m <= 9 and n > 1:
	if m == 1:
		k[0] = 1
		k = list(map(str, k))
		print(''.join(k), ''.join(k))
	elif m == 0:
		print(-1, -1)
	else:
		u = k
		u[0] = 1
		u[n - 1] = m - 1
		u = list(map(str, u))
		uu = ''.join(u)
		s = n * [0]
		s[0] = m
		s = list(map(str, s))
		ss = ''.join(s)
		print(uu, ss)
if c >= n:
	if c > n:
		print(-1, -1)
	if c == n and d != 0:
		print(-1, -1)
	if c == n and d == 0 and (n != 1):
		t = n * ['9']
		t = ''.join(t)
		print(t, t)
elif m > 9:
	for i in range(c):
		k[i] = 9
	if d != 0:
		k[c] = d
	k = list(map(str, k))
	zz = ''.join(k)
	if c + 1 == n:
		k.reverse()
		k = list(map(str, k))
		mm = ''.join(k)
		print(mm, zz)
	else:
		if d != 0:
			k[c] = d - 1
		else:
			k[c] = 0
			k[c - 1] = 8
		k[n - 1] = 1
		k.reverse()
		k = list(map(str, k))
		mm = ''.join(k)
		print(mm, zz)


(m, s) = map(int, input().split())
if s < 10 and m == 1:
	print(s, s)
elif s == 0 and m > 1:
	print('-1', '-1')
elif s > 9 * m:
	print('-1', '-1')
else:
	t = s
	x = 0
	a = 0
	while t > 8:
		x = x + 9 * 10 ** (m - a - 1)
		t = t - 9
		a = a + 1
	if t > 0:
		x = x + t * 10 ** (m - a - 1)
	y = 0
	if s < 10:
		y = 10 ** (m - 1) + s - 1
	elif s <= 9 * (m - 1) + 1:
		if (s - 1) % 9 > 0:
			y = 10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** int((s - 1 - (s - 1) % 9) / 9) - 1
		else:
			y = 10 ** (m - 1) + 10 ** ((s - 1) // 9) - 1
	else:
		y = (s - 9 * m + 10) * 10 ** (m - 1) - 1
	print(y, x)


import math
(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print('0 0')
elif s == 0 and m != 1:
	print('-1 -1')
elif s == 1:
	print('1' + '0' * (m - 1), '1' + '0' * (m - 1))
elif 9 * m < s:
	print('-1 -1')
else:
	_min = ''
	_min2 = ''
	_max = ''
	temp = s
	temp1 = s - 1
	while s != 0:
		_min = str(min(9, s)) + _min
		s -= min(9, s)
	while temp1 != 0:
		_min2 = str(min(9, temp1)) + _min2
		temp1 -= min(9, temp1)
	_min2 = '1' + '0' * (m - len(_min2) - 1) + _min2
	while temp != 0:
		_max += str(min(9, temp))
		temp -= min(9, temp)
	_max += '0' * (m - len(_max))
	_min = _min if len(_min) == m else _min2
	print(_min, _max)


(l, s) = [int(v) for v in input().strip().split()]
tempSum = s
max_ = 0
if s == 0:
	if l == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	for i in range(l):
		max_ *= 10
		temp = min(tempSum, 9)
		tempSum -= temp
		max_ += temp
	if tempSum > 0:
		print('-1 -1')
	else:
		min_ = str(max_)[::-1]
		index = 0
		for i in range(len(min_)):
			if min_[i] != '0':
				break
			index = i
		if min_[0] == '0':
			min_ = str(int(min_[0]) + 1) + min_[1:]
			min_ = min_[0:index + 1] + str(int(min_[index + 1]) - 1) + min_[index + 2:]
		print(min_, max_)


(a, b) = (int(x) for x in input().split(' '))
if a > 1 and b == 0 or b > 9 * a:
	print('-1 -1')
elif a == 1 and b == 0:
	print('0 0')
else:
	c = a * [0]
	m = b
	for i in range(a):
		if m > 9:
			c[i] = 9
			m -= 9
		else:
			c[i] = m
			break
	da = ''.join((str(x) for x in c))
	d = a * [0]
	n = b
	if b > 9 * (a - 1):
		for i in range(a):
			if n > 9:
				d[a - i - 1] = 9
				n -= 9
			else:
				d[a - i - 1] = n
				break
	else:
		d[0] = 1
		n -= 1
		for i in range(1, a):
			if n > 9:
				d[a - i] = 9
				n -= 9
			else:
				d[a - i] = n
				break
	xiao = ''.join((str(x) for x in d))
	print(xiao, da)


(m, s) = map(int, input().split())
max_res = ''
min_res = ''
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or 9 * m < s:
	print(-1, -1)
else:
	max_res = '9' * (s // 9)
	if s % 9 > 0:
		max_res += str(s % 9)
	min_res = max_res[::-1]
	max_res = max_res.ljust(m, '0')
	if len(min_res) < m:
		min_res = str(int(min_res[0]) - 1) + min_res[1:]
		min_res = min_res.rjust(m - 1, '0')
		min_res = '1' + min_res
	print(min_res, max_res)


(m, s) = [int(i) for i in input().split()]
if m > 1 and s == 0:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif m * 9 < s:
	print('-1 -1')
elif m == 1:
	print(s, s)
else:
	k = max(s - (m - 1) * 9, 1)
	print(k, end='')
	n9 = (s - k) // 9
	r9 = (s - k) % 9
	n0 = m - n9 - 2
	if n0 > 0:
		for i in range(n0):
			print('0', end='')
	if m - n9 - 2 > -1:
		print(r9, end='')
	if n9 > 0:
		for i in range(n9):
			print('9', end='')
	print(' ', end='')
	n9 = s // 9
	r9 = s % 9
	if n9 > 0:
		for i in range(n9):
			print('9', end='')
		if n9 < m:
			print(r9, end='')
		if n9 + 1 < m:
			for i in range(m - n9 - 1):
				print('0', end='')
	else:
		print(r9, end='')
		for i in range(m - 1):
			print('0', end='')


(n, s) = tuple(map(int, input().split(' ')))
x = n * [0]
if s == 0 and n != 1 or s / n > 9:
	print('-1 -1')
	exit()
elif s == 0 and n == 1:
	print('0 0')
	exit()
for i in range(n):
	if s < 9:
		x[i] = s
		break
	else:
		x[i] = 9
		s -= 9
x.sort(reverse=True)
largest = 0
for i in range(n):
	largest += x[i] * 10 ** (n - i - 1)
i = 0
x.sort()
if x[0] == 0:
	while x[i] == 0:
		i += 1
	x[i] -= 1
	x[0] = 1
smallest = 0
for i in range(n):
	smallest += x[i] * 10 ** (n - i - 1)
print(str(smallest) + ' ' + str(largest))


(m, s) = map(int, input().split())
if s == 0 and m > 1 or 9 * m < s:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	d = s // 9
	r = s % 9
	if r != 0:
		rez1 = '9' * d + str(r)
	else:
		rez1 = '9' * d
	rez2 = int(rez1[::-1])
	rez2 = rez2 - 10 ** (len(str(rez2)) - 1) + 10 ** (m - 1)
	rez1 = rez1 + '0' * (m - len(rez1))
	print(rez2, rez1)


(m, s) = input().split()
m = int(m)
s = int(s)
if 9 * m < s:
	print('-1 -1')
elif s == 0 and m != 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	i = 2
	A = []
	s1 = s - 1
	while i <= m:
		if s1 >= 9:
			A.extend([9])
			s1 -= 9
			i += 1
		elif s1 < 9 and s1 > 0:
			A.extend([s1])
			s1 = 0
			i += 1
		else:
			A.extend([0])
			i += 1
	A.sort()
	A1 = [str(x) for x in A]
	print(str(1 + s1) + ''.join(A1), end=' ')
	i = 1
	A = []
	s1 = s
	while i <= m:
		if s1 >= 9:
			A.extend([9])
			s1 -= 9
			i += 1
		elif s1 < 9 and s1 > 0:
			A.extend([s1])
			s1 = 0
			i += 1
		else:
			A.extend([0])
			i += 1
	A.sort(reverse=True)
	A1 = [str(x) for x in A]
	print(''.join(A1), end=' ')


(a, b) = map(int, input().split())
z = [0] * a
z1 = [0] * a
o = b - 1
if a == 1 and b == 0:
	print(0, 0)
	exit()
for i in range(a):
	for j in range(9, -1, -1):
		if j <= b:
			z[i] = j
			break
	b -= z[i]
for i in range(a - 1):
	for j in range(9, -1, -1):
		if j <= o:
			z1[i] = j
			break
	o -= z1[i]
z1 = z1[::-1]
z1[0] = o + 1
print(*(z1 if z1[0] != 0 and o < 9 else [-1]), ' ', *(z if not b and z[0] != 0 else [-1]), sep='')


def large(m, s):
	if m == 1 and s == 0:
		return 0
	l = []
	for i in range(1, m + 1):
		for k in range(0, 10):
			if s - k < 0:
				return -1
			if s - k <= (m - i) * 9 or k == s:
				l.append(k)
				s -= k
				flag = 1
				break
	if len(l) == 0:
		return -1
	t = ''
	l.sort(reverse=True)
	if l[0] == 0:
		return -1
	for i in range(m):
		t += str(l[i])
	return t

def small(m, s):
	if m == 1 and s == 0:
		return 0
	l = []
	for i in range(1, m + 1):
		for k in range(0, 10):
			if s - k < 0:
				return -1
			if s - k <= (m - i) * 9 or k == s:
				if len(l) == 0 and k == 0:
					continue
				l.append(k)
				s -= k
				flag = 1
				break
	if len(l) == 0:
		return -1
	u = ''
	t = ''
	for i in range(m):
		u += str(l[i])
	return u
(m, s) = [int(x) for x in input().split()]
a = small(m, s)
b = large(m, s)
print(a, b)


(x, y) = [int(t) for t in input().split()]
num = y
if y == 0 and x != 1 or y > 9 * x:
	print('-1 -1')
	exit()
else:
	mini = 0
	maxi = 0
	n = 0
	while y > 9:
		mini += 10 ** n * 9
		y -= 9
		n += 1
	mini = mini + (y - 1) * 10 ** n + 10 ** (x - 1)
	n = x - 1
	y = num
	while y > 9:
		maxi += 10 ** n * 9
		y -= 9
		n -= 1
	maxi = maxi + y * 10 ** n
print(mini, maxi)


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	txt = ''
	mm = m
	while m > 0:
		m -= 1
		if s >= 9:
			s -= 9
			txt += '9'
		else:
			txt += str(s)
			s -= s
	mintxt = txt[-1::-1]
	if mintxt[0] == '0':
		for i in range(mm):
			if mintxt[i] != '0':
				index = i
				break
		mintxt = '1' + mintxt[1:index] + str(int(mintxt[index]) - 1) + mintxt[index + 1:]
	if s == 0:
		print(mintxt, txt)
	else:
		print(-1, -1)


(n, m) = list(map(int, input().split()))
if m > n * 9 or (m == 0 and n != 1):
	print('-1 -1')
elif n == 1 and m == 0:
	print('0 0')
elif n == 1 and m == 1:
	print('1 1')
else:
	temp = m
	i = 0
	mi = ma = ''
	if m - 1 > 9 * (n - 1):
		mi += str(m - 9 * (n - 1))
		m = 9 * (n - 1)
		mi += '9' * (n - 1)
	else:
		mi += '1'
		m -= 1
		if m % 9 != 0:
			mi = mi + max(0, n - 2 - m // 9) * '0' + str(m % 9) + m // 9 * '9'
		else:
			mi = mi + max(0, n - 1 - m // 9) * '0' + m // 9 * '9'
	m = temp
	ma = m // 9 * '9'
	if m // 9 < n:
		ma += str(m % 9)
	ma += '0' * (n - 1 - m // 9)
	print(mi, ma)


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif 9 * m < s:
	print(-1, -1)
else:
	ans = [0] * m
	S = 0
	for j in range(m - 1, -1, -1):
		if S == s:
			break
		for i in range(9, -1, -1):
			if S + i < s:
				ans[j] = i
				S += i
				break
			elif S + i == s:
				if j == 0:
					ans[j] = i
					break
				else:
					ans[j] = i - 1
					ans[0] = 1
					S = s
					break
	ans2 = [0] * m
	S = 0
	for j in range(m):
		if s - S > 8:
			ans2[j] = 9
			S += 9
		elif s == S:
			break
		else:
			ans2[j] = s - S
			break
	print(*ans, sep='', end=' ')
	print(*ans2, sep='')


(a, b) = map(int, input().split())
if a == 1 and b == 0:
	print('0 0')
elif b > a * 9 or b == 0:
	print('-1 -1')
else:
	x = [0] * a
	x[0] += 1
	c = b
	c -= 1
	counter = -1
	while c:
		add = min(c, 9)
		x[counter] += add
		c -= add
		counter -= 1
	print(''.join(map(str, x)), end=' ')
	x = [0] * a
	c = b
	counter = 0
	while c:
		add = min(c, 9)
		x[counter] += add
		c -= add
		counter += 1
	print(''.join(map(str, x)))


import sys
(m, s) = list(map(lambda x: int(x), input().split()))
temp_s = s
if m == 1 and s == 0:
	print(0, 0)
	sys.exit(0)

def can(m, s):
	return s >= 0 and m * 9 >= s

def can_max(m, s):
	return s >= 0
answer = ''
for i in range(0, m):
	for d in range(0, 10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, temp_s - d):
			temp_s -= d
			answer += str(d)
			break
answer_min = 0
if len(answer) != m or answer[0] == '0' or temp_s != 0:
	answer_min = -1
else:
	answer_min = answer
answer = ''
for i in range(0, m):
	for d in range(9, -1, -1):
		if can_max(m - i - 1, s - d):
			s -= d
			answer += str(d)
			break
answer_max = 0
if len(answer) != m or answer[0] == '0' or s != 0:
	answer_max = -1
else:
	answer_max = answer
print(answer_min, answer_max)


(m, s) = map(int, input().split())
k = 1
if s == 0 and m == 1:
	print(s, s)
	exit()
elif s == 0:
	print(-1, -1)
	exit()
if s // 9 + int(s % 9 != 0) > m:
	print(-1, -1)
	exit()
smax = []
for i in range(s // 9):
	smax.append(9)
if s % 9 != 0:
	smax.append(s % 9)
k = 0
for i in range(m - s // 9 - int(s % 9 != 0)):
	k += 1
	smax.append(0)
smin = smax[:]
smin.sort()
if k != 0:
	smin[0] = 1
	smin[k] -= 1
for i in smin:
	print(i, end='')
print(' ', end='')
for i in smax:
	print(i, end='')


(a, b) = input().split()
import math
a = int(a)
b = int(b)
if b > a * 9 or (b == 0 and a > 1):
	print('-1 -1')
elif 1 < a <= b <= 9 or (1 < b <= a and b <= 9):
	print('1' + '0' * (a - 2) + str(b - 1) + ' ' + str(b) + '0' * (a - 1))
elif 9 < b <= a:
	print('1' + '0' * (a - math.ceil(b / 9) - 1) + str(b % 9 - 1) + '9' * math.floor(b / 9) + ' ' + '9' * math.floor(b / 9) + str(b % 9) + '0' * (a - math.floor(b / 9) - 1))
else:
	data = ''
	Data = ''
	for i in range(a):
		if b >= 9:
			data = data + '9'
			Data = '9' + Data
			b = b - 9
		elif 0 < b < 9:
			data = data + str(b)
			Data = str(b) + Data
			b = 0
		else:
			data = data + '0'
			if len(Data) >= 2 and int(Data[0]) == 1:
				Data = Data[0] + '0' + Data[1:]
			elif len(Data) >= 2 and int(Data[0]) > 1:
				Data = '1' + str(int(Data[0]) - 1) + Data[1:]
			else:
				Data = Data + '0'
	print(Data + ' ' + data)


(m, s) = [int(elem) for elem in input().split()]
a = []
for i in range(101):
	a.append([-1] * 901)
b = []
for i in range(101):
	b.append([-1] * 901)
for j in range(10):
	a[1][j] = j
	b[1][j] = j
for i in range(2, 101):
	for j in range(1, 10):
		a[i][j] = 10 ** (i - 1) + j - 1
		b[i][j] = b[i - 1][j] * 10
	for j in range(10, 9 * i + 1):
		a[i][j] = 9 + 10 * a[i - 1][j - 9]
		b[i][j] = 9 * 10 ** (i - 1) + b[i - 1][j - 9]
print(a[m][s], b[m][s])


s = input().split(' ')
m = int(s[0])
s = int(s[1])
s1 = s
if s > m * 9 or (m > 1 and s < 1):
	print('-1 -1')
else:
	res = [0 for i in range(m + 1)]
	s -= 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			res[i] = 9
			s -= 9
		else:
			res[i] = s
			s = 0
	res[0] = s + 1
	for i in range(m):
		print(res[i], end='')
	print(' ', end='')
	res = [0 for i in range(m + 1)]
	for i in range(m):
		if s1 > 9:
			res[i] = 9
			s1 -= 9
		else:
			res[i] = s1
			s1 = 0
	for i in range(m):
		print(res[i], end='')


k = input().split()
n = int(k[0])
s = int(k[1])
result = []
len = n
sum = s
small_num = 0
small_num_index = 0
if sum > 9 * n or (sum == 0 and n > 1):
	print('-1 -1')
else:
	for i in range(n):
		if sum == 0:
			result.append(0)
			len -= 1
		elif sum - 9 > 0:
			sum -= 9
			result.append(9)
			len -= 1
		else:
			result.append(sum)
			small_num = sum
			small_num_index = i
			sum = 0
			len -= 1
	sum = s
	len = n
	if sum == 0:
		print('0', end='')
		len -= 1
	elif sum - 1 <= 9 * (len - 1):
		print('1', end='')
		len -= 1
		sum -= 1
	else:
		print(sum - 9 * (len - 1), end='')
		len -= 1
		sum = 9 * len
	for i in range(n - 1):
		if sum <= 9 * (len - 1):
			print('0', end='')
			len -= 1
		else:
			print(sum - 9 * (len - 1), end='')
			len -= 1
			sum = 9 * len
	print(' ', end='')
	for i in range(n):
		print(result[i], end='')
	print()


def check(s, m):
	if m == 1 and s == 0:
		return (0, 0)
	elif s > m * 9 or s == 0:
		return (-1, -1)
	else:
		Low = 10 ** (m - 1)
		for i in range(s - 1):
			Low += 10 ** (i // 9)
		High = 0
		for i in range(s):
			High += 10 ** (m - 1 - i // 9)
		return (Low, High)
(m, s) = map(int, input().split())
print(*check(s, m))


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	mn = 0
	mx = 0
elif s == 0 and m != 1 or s > m * 9:
	mn = -1
	mx = -1
elif s < 10 and m == 1:
	mn = s
	mx = s
elif s < 10 and m > 1:
	mn = '1' + '0' * (m - 2) + str(s - 1)
	mx = str(s) + '0' * (m - 1)
elif s // m == 9:
	mn = '9' * m
	mx = '9' * m
else:
	nine = s // 9
	ost = s % 9
	mx = '9' * nine + str(ost) + '0' * (m - nine - 1)
	if m - nine == 1 and ost == 0:
		mn = '18' + '9' * (nine - 1)
	elif m - nine == 1 and ost != 0:
		mn = str(ost) + '9' * nine
	elif m - nine > 1 and ost == 0:
		mn = '1' + '0' * (m - nine - 1) + '8' + '9' * (nine - 1)
	else:
		mn = '1' + '0' * (m - nine - 2) + str(ost - 1) + '9' * nine
print(mn, mx)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s == 0:
	print(-1, -1)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	a = [1] + [0] * (m - 1)
	s1 = s - 1
	i = m - 1
	while s1 > 9:
		a[i] = 9
		s1 -= 9
		i -= 1
	a[i] += s1
	b = [0] * m
	i = 0
	while s > 9:
		b[i] = 9
		s -= 9
		i += 1
	b[i] = s
	x1 = x2 = ''
	for i in range(m):
		x1 += str(a[i])
		x2 += str(b[i])
	print(x1, x2)


def minim(a, b):
	if a < b:
		return a
	else:
		return b
(m, s) = input().split()
m = int(m)
s = int(s)
maxi = []
mini = []
mini.append(1)
for i in range(0, m - 1):
	mini.append(0)
for i in range(0, m):
	maxi.append(9)
sum = 9 * m
if s > sum:
	print('-1 -1')
elif s == sum:
	for i in range(0, m):
		print(maxi[i], end='')
	print(' ', end='')
	for i in range(0, m):
		print(maxi[i], end='')
elif s == 0 and m == 1:
	print('0 0')
elif s == 0:
	print('-1 -1')
else:
	k = sum - s
	j = m - 1
	while k > 0:
		if maxi[j] < k:
			maxi[j] = 0
			j = j - 1
			k = k - maxi[j]
		else:
			maxi[j] = maxi[j] - k
			j = j - 1
			k = 0
			break
	t = s - 1
	j = m - 1
	while t > 0:
		s = 9 - mini[j]
		if s < t:
			mini[j] = s
			j = j - 1
			t = t - s
		else:
			mini[j] += t
			t = 0
			break
	for i in range(0, m):
		print(mini[i], end='')
	print(' ', end='')
	for i in range(0, m):
		print(maxi[i], end='')


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print('0  0')
	else:
		print('-1 -1')
else:
	maxi = ''
	mini = ''
	for i in range(m):
		k = str(min(9, s))
		maxi += k
		s -= int(k)
	if s > 0:
		print('-1 -1')
	else:
		x = list(maxi[::-1])
		j = 0
		while x[j] == '0':
			j += 1
		if j > 0:
			x[0] = '1'
			x[j] = str(int(x[j]) - 1)
		for i in x:
			mini += i
		print(mini, maxi)


(n, s) = map(int, input().strip().split())

def maxf(s, n):
	if 9 * n < s:
		return -1
	if s == 0 and n == 1:
		return 0
	if s == 0 and n > 1:
		return -1
	if s <= 9:
		return str(s) + '0' * (n - 1)
	return '9' + maxf(s - 9, n - 1)
m = maxf(s, n)

def minf(s, n):
	if m == -1:
		return -1
	m1 = str(m)
	l = []
	for k in m1:
		l.append(int(k))
	l.sort()
	if l[0] == 0:
		for i in range(n):
			if l[i] != 0:
				(l[0], l[i]) = (l[i], l[0])
				break
	if len(l) > 1:
		i = 0
		j = n - 1
		while j > i:
			while l[j] < 9 and l[i] > (1 if i == 0 else 0):
				l[j] += 1
				l[i] -= 1
			if l[i] > 1 and j - 1 > i:
				j -= 1
			elif l[i] == 1:
				i += 1
			else:
				break
	sp = ''
	for j in l:
		sp += str(j)
	return sp
print(minf(s, n), m)


import math
(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif math.ceil(s / 9) > m or s == 0:
	print(-1, -1)
else:
	nine = s // 9
	x = s % 9
	mx = '9' * nine + ('' if x == 0 else str(x)) + '0' * (m - math.ceil(s / 9))
	if x == 0:
		nine -= 1
		x = 9
	mn = 0
	if math.ceil(s / 9) < m:
		mn = '1' + '0' * (m - math.ceil(s / 9) - 1) + str(x - 1) + '9' * nine
	else:
		mn = str(x) + '9' * nine
	print(mn, mx)


def tn(n):
	if n:
		return tn(n // 10) + 1
	return 0
(n, k) = map(int, input().split())
if k > n * 9 or (k == 0 and n > 1):
	print(-1, -1)
else:
	s = ''
	d = []
	f = k
	while f - 9 > 0:
		f -= 9
		s = '9' + s
	s += str(f)
	s += (n - len(s)) * '0'
	d = s[::-1]
	if d[0] == '0' and len(d) > 1:
		d = int(d)
		d -= 10 ** (tn(d) - 1)
		d = str(d)
		if len(d) < n:
			d = '1' + (n - len(d) - 1) * '0' + d
	print(d, s)


[m, s] = list(map(int, input().split()))
mlist = [0] * m
mlist[0] = s
if s == 0 and m > 1 or s > m * 9:
	smallest = str(-1)
	biggest = str(-1)
else:
	first0 = m
	for i in range(1, m):
		if mlist[i - 1] > 9:
			(mlist[i - 1], mlist[i]) = (9, mlist[i - 1] - 9)
		if mlist[i] == 0:
			first0 = i
			break
	firstn = m - first0
	biggest = ''.join([str(c) for c in mlist])
	mlist.reverse()
	if mlist[0] == 0:
		mlist[0] = 1
		mlist[firstn] -= 1
	smallest = ''.join([str(c) for c in mlist])
print(smallest + ' ' + biggest)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	x = (s - 1) // 9
	y = (s - 1) % 9
	if x + 1 == m:
		print('%s' % (y + 1) + '9' * x)
	else:
		num = [1] + [0] * (m - x - 2) + [y] + [9] * x
		print(''.join(list(map(str, num))), end=' ')
	x = s // 9
	y = s % 9
	num = [9] * x + [y] * (y != 0) + [0] * (m - x - 1 + (y == 0))
	print(''.join(list(map(str, num))))


(m, s) = map(int, input().split())
if s == 0 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	nmax = ''
	nmin = ''
	ts = s
	for i in range(m - 1):
		if ts > 9:
			nmin = '9' + nmin
			ts -= 9
		else:
			nmin = chr(ts + 47) + nmin
			ts = 1
		if s > 9:
			nmax = nmax + '9'
			s -= 9
		else:
			nmax = nmax + chr(s + 48)
			s = 0
	if ts > 9:
		print('-1 -1')
	else:
		nmin = chr(ts + 48) + nmin
		nmax = nmax + chr(s + 48)
		print(nmin, nmax)


import sys
(m, s) = [int(x) for x in input().split()]
if m > 1 and s == 0:
	print('-1 -1')
	sys.exit()
f = [[[0] * (s + 1) for j in range(10)] for i in range(0, m + 1)]
for j in range(min(10, s + 1)):
	f[1][j][j] = 1
for i in range(2, m + 1):
	for j in range(min(10, s + 1)):
		for k in range(s + 1):
			if k >= j:
				for t in range(min(10, s + 1)):
					f[i][j][k] = f[i][j][k] | f[i - 1][t][k - j]
max_value = []
tmp = s
for i in range(m, 0, -1):
	flag = 0
	for j in range(9, -1, -1):
		if f[i][j][tmp] == 1:
			flag = j
			break
	max_value.append(flag)
	tmp -= flag
	if i == m and flag == 0:
		break
if tmp > 0:
	print('-1 -1')
	sys.exit()
min_value = []
tmp = s
for i in range(m, 0, -1):
	flag = 0
	t = 0
	if i == m:
		t = 1
	for j in range(t, 10):
		if f[i][j][tmp] == 1:
			flag = j
			break
	min_value.append(flag)
	tmp -= flag
	if i == m and flag == 0:
		break
if tmp > 0:
	print('-1 -1')
	sys.exit()
for i in min_value:
	print(i, end='')
print(' ', end='')
for i in max_value:
	print(i, end='')


(l, s) = map(int, input().split())
if l == 1 and s == 0:
	print(0, 0)
elif l * 9 < s or s == 0:
	print(-1, -1)
else:
	s1 = s
	mx = ''
	while s1 != 0:
		if s1 > 9:
			mx = mx + '9'
			s1 -= 9
		else:
			mx = mx + str(s1)
			s1 = 0
	else:
		leng = len(mx)
		if leng != l:
			mx = mx + '0' * (l - leng)
	s1 = s - 1
	mn = ''
	while s1 != 0:
		if s1 > 9:
			mn = mn + '9'
			s1 -= 9
		else:
			mn = mn + str(s1)
			s1 = 0
	else:
		mn = '1' + '0' * (l - 1 - len(mn)) + mn[:][::-1]
	if len(mn) > l:
		mn = str(int(mn[0]) + int(mn[1])) + mn[2:]
	print(mn, mx)


(m, s) = [int(i) for i in input().split()]

def find(rev=False):
	if m == 1 and s == 0:
		return 0
	(sum, result) = (s, '')
	for i in range(m):
		j = 1 if i == 0 else 0
		ok = False
		for v in range(j, 10) if rev else reversed(range(j, 10)):
			if (m - i - 1) * 9 >= sum - v >= 0:
				ok = True
				sum -= v
				result += str(v)
				break
		if not ok:
			return -1
	return result
print(find(True), find(False))


(n, m) = map(int, input().split())
a = ['0'] * n
b = ['0'] * n
flag = 0
if m == 0 and n != 1:
	flag = 1
for i in range(n - 1, -1, -1):
	if m < 10 and i > 1 and (m != 1) and (m != 0):
		a[i] = str(m - 1)
		a[0] = '1'
		m = 0
		break
	elif m >= 10:
		a[i] = '9'
		m = m - 9
	elif m < 10 and i == 1 and (m != 1) and (m != 0):
		a[i] = str(m - 1)
		a[0] = '1'
		m = 0
	elif m == 1 and i > 1:
		a[0] = '1'
		m = 0
	elif m < 10 and i == 0 and (m != 0):
		a[i] = str(m)
		m = 0
if m != 0:
	flag = 1
b = a
c = ''.join(a)
b.sort(reverse=True)
for i in range(0, n - 1):
	if int(b[i]) + int(b[i + 1]) <= 9:
		b[i] = str(int(b[i]) + int(b[i + 1]))
		b[i + 1] = '0'
if flag == 0:
	print(c + ' ' + ''.join(b))
else:
	print('-1' + ' ' + '-1')


msStr = input()
mStr = msStr.split()[0]
sStr = msStr.split()[1]
m = int(mStr)
s = int(sStr)
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
	quit()

def digList2Num(digList):
	size = len(digList)
	sum = 0
	for i in range(size):
		sum = sum + digList[i] * 10 ** (size - 1 - i)
	return sum
maxList = list()
for i in range(m):
	if s > 9:
		maxList.append(9)
		s = s - 9
	else:
		maxList.append(s)
		s = 0
maxNum = digList2Num(maxList)
minList = maxList
minList.reverse()
if minList[0] == 0:
	for i in range(m):
		if minList[i] != 0:
			minList[0] = minList[0] + 1
			minList[i] = minList[i] - 1
			break
minNum = digList2Num(minList)
print(minNum, maxNum)


x = input().split()
a = int(x[0])
b = int(x[1])
v = b
v2 = b
v1 = a
if a == 1 and b == 0:
	print(f'{0} {0}')
elif b == 0:
	print(f'{-1} {-1}')
else:
	emon = []
	b = v2
	while v2:
		if b >= 9:
			b = b - 9
			emon.append(9)
		elif b >= 8:
			b = b - 8
			emon.append(8)
		elif b >= 7:
			b = b - 7
			emon.append(7)
		elif b >= 6:
			b = b - 6
			emon.append(6)
		elif b >= 5:
			b = b - 5
			emon.append(5)
		elif b >= 4:
			b = b - 4
			emon.append(4)
		elif b >= 3:
			b = b - 3
			emon.append(3)
		elif b >= 2:
			b = b - 2
			emon.append(2)
		elif b >= 1:
			b = b - 1
			emon.append(1)
		if b == 0:
			break
	if len(emon) > a:
		print(f'{-1} {-1}')
	else:
		g = 0
		z = []
		if len(emon) < a:
			g = a - len(emon)
			for i in range(g):
				h = 0
				z.append(h)
			x = emon.copy()
			y = x[::-1]
			f = y[0]
			f1 = y[0]
			y.remove(f)
			a1 = 0
			if int(f) > 1:
				z.remove(0)
				a1 = int(f) - 1
				f = 1
			f = str(f)
			p = ''.join((str(m) for m in x))
			r = ''.join((str(x) for x in y))
			q = ''.join((str(x) for x in z))
			if a1 != 0:
				le1 = len(f + q + str(a1) + r)
				if le1 == v1:
					t = int(f + q + str(a1) + r)
				else:
					t = int(str(f1) + q + r)
			else:
				t = int(f + q + r)
			le = len(f + q + r)
			w = 1
			for i in range(le - 1):
				w = w * 10
			sum = 0
			if t == int(p + q):
				for i in range(w, int(p + q)):
					f = list(str(i))
					for j in f:
						sum = sum + int(j)
					if sum == v:
						t = i
						break
					sum = 0
			if len(p + q) < v1:
				q = q + str('0')
			print(f'{t} {p + q}')
		elif len(emon) == a:
			m = emon.copy()
			y = m[::-1]
			m = ''.join((str(x) for x in m))
			y = ''.join((str(x) for x in y))
			print(f'{y} {m}')


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	k = s
	(a, b) = ([], [])
	for i in range(m):
		if s >= 10:
			a.append('9')
			b.append('9')
			s -= 9
			k -= 9
		else:
			a.append(str(s))
			s = 0
			if k > 0:
				if i < m - 1:
					b.append(str(k - 1))
					k = 1
				else:
					b.append(str(k))
					k = 0
	b.reverse()
	print(''.join(b), ''.join(a))


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def _min(m, s):
	if m == 1 and s == 0:
		return 0
	if s == 0:
		return -1
	curr_sum = 1
	idx = m - 1
	res = [1] + [0 for _ in range(m - 1)]
	while idx > 0 and curr_sum != s:
		if s - curr_sum > 9:
			res[idx] = 9
			curr_sum += 9
		else:
			res[idx] = s - curr_sum
			curr_sum += s - curr_sum
		idx -= 1
	if s - curr_sum > 8:
		return -1
	else:
		res[0] += s - curr_sum
	return ''.join(map(str, res))

def _max(m, s):
	if m == 1 and s == 0:
		return 0
	if s == 0:
		return -1
	curr_sum = 1
	res = [1] + [0 for _ in range(m - 1)]
	if s - curr_sum > 8:
		res[0] += 8
		curr_sum += 8
	else:
		res[0] += s - curr_sum
		curr_sum += s - curr_sum
	for i in range(1, m):
		if curr_sum == s:
			break
		if s - curr_sum > 9:
			res[i] = 9
			curr_sum += 9
		else:
			res[i] = s - curr_sum
			curr_sum += s - curr_sum
	if curr_sum != s:
		return -1
	return ''.join(map(str, res))

def solve():
	(m, s) = read_tuple(int)
	print(_min(m, s), _max(m, s))
solve()


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


(n, t) = map(int, input().split(' '))
dec = [9 for i in range(n)]

def min():
	if n == 1 and t == 0:
		return 0
	m = dec.copy()
	if t == 0:
		return -1
	if 9 * n < t:
		return -1
	else:
		sub = 9 * n - t
		if sub <= 8:
			m[0] = 9 - sub
			return ''.join(list(map(str, m)))
		else:
			m[0] = 1
			sub -= 8
			ind = sub // 9
			for i in range(1, ind + 1):
				m[i] = 0
			if ind + 1 < len(m):
				m[ind + 1] = m[ind + 1] - sub + ind * 9
			return ''.join(list(map(str, m)))

def max():
	if n == 1 and t == 0:
		return 0
	m = dec
	if t == 0:
		return -1
	if 9 * n < t:
		return -1
	else:
		sub = 9 * n - t
		if sub <= 9:
			m[0] = m[0] - sub
			return ''.join(list(map(str, m[::-1])))
		m[0] = 0
		sub -= 9
		ind = sub // 9
		for i in range(1, ind + 1):
			m[i] = 0
		if ind + 1 < len(m):
			m[ind + 1] = m[ind + 1] - sub + ind * 9
		return ''.join(list(map(str, m[::-1])))
print(min(), max())


(x, y) = map(int, input().split())
listMax = []
m = 0
strMax = ''
if x == 1:
	if y > 9:
		print('-1', '-1')
	else:
		print(y, y)
else:
	for i in range(0, x):
		if y >= 9:
			listMax.append(9)
			y -= 9
			strMax += '9'
			m += 1
		elif 0 < y < 9:
			listMax.append(y)
			strMax += str(y)
			y = 0
		else:
			listMax.append(0)
			strMax += '0'
	if y > 0:
		strMax = '0'
	if int(strMax) == 0:
		print('-1', '-1')
	elif m == x:
		listMin = listMax[::-1]
		strMin = ''
		for i in listMin:
			strMin += str(i)
		print(strMin, strMax)
	else:
		lastNum = listMax[m]
		a = listMax[-1]
		if lastNum >= 1 and a == 0:
			listMax[m] = lastNum - 1
			listMax[-1] = 1
		elif lastNum == 0 and a == 0:
			listMax[m - 1] = 8
			listMax[-1] = 1
		listMin = listMax[::-1]
		strMin = ''
		for x in listMin:
			strMin += str(x)
		print(strMin, strMax)


def maxi(m, s, q, r):
	d = 0
	big = ''
	for i in range(q):
		big += '9'
	d += 9 * q
	diff = s - d
	dg = m - q
	if dg < 0:
		return -1
	if dg == 0:
		if d == s:
			return big
		else:
			return -1
	big += str(diff)
	d += diff
	dg -= 1
	for i in range(dg):
		big += '0'
	return big

def mini(m, s, q, r):
	d = 0
	f = 0
	small = ''
	nines = ''
	dg = m
	if s > 9:
		for i in range(q):
			nines += '9'
		d += 9 * q
		dg = m - q
	diff = s - d
	j = 0
	if diff == 0 and s != 0 and (dg > 0):
		good = nines
		good = '8' + nines[1:]
		nines = good
		j = 1
	elif dg == 0:
		if d == s:
			return nines
	elif dg == 1:
		small += str(diff)
		d += diff
		f = 1
	else:
		small += str(diff - 1)
		d += diff - 1
		f = 0
	if j == 0:
		dg -= 1
	zeros = ''
	if dg > 0:
		for i in range(dg - 1):
			zeros += '0'
	if f == 0:
		small = '1' + zeros + small + nines
	else:
		small = small + nines
	if small[0] == '0' and s > 0:
		new = small
		small = small[1:]
		lead = str(int(small[1]) - 1)
		new = '1' + lead + small[1:]
		return new
	return small
l = [int(x) for x in input().split()]
m = l[0]
s = l[1]
q = s // 9
r = s % 9
big = maxi(m, s, q, r)
small = ''
if s == 0 and m > 1 or big == -1:
	print(-1, -1)
else:
	small = mini(m, s, q, r)
	print(small, big)


(m, s) = map(int, input().split())
if m > 1 and s == 0 or m * 9 < s:
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	a = []
	for i in range(m):
		if (s - 9 * i) // 9 > 0:
			a.append('9')
		else:
			a.append(str(s - 9 * i))
			a.append('0' * (m - 1 - i))
			break
	max = ''.join(a)
	b = list(max)[::-1]
	if b[0] != '0':
		min = ''.join(b)
	else:
		for i in range(m):
			if b[i] != '0':
				b[i] = str(int(b[i]) - 1)
				break
		b[0] = '1'
	min = ''.join(b)
	print(min, max)


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


data = list(map(int, input().split()))
ndigits = data[0]
d_sum = data[1]
if d_sum == 0:
	if ndigits > 1:
		print('-1 -1')
	else:
		print('0 0')
elif 9 * ndigits < d_sum:
	print('-1 -1')
else:
	to_minimal = d_sum
	minimal = ''
	for x in range(ndigits - 1):
		for number in range(9, -1, -1):
			if to_minimal - number > 0:
				to_minimal -= number
				minimal += str(number)
				break
	minimal += str(to_minimal)
	maximal = ''
	for x in range(ndigits - 1):
		for number in range(9, -1, -1):
			if d_sum - number > -1:
				d_sum -= number
				maximal += str(number)
				break
	maximal += str(d_sum)
	for index in range(ndigits - 1, -1, -1):
		print(minimal[index], end='')
	print(' ' + str(maximal))


(m, s) = list(map(int, input().split()))
flag = True
large = 0
small = 0
m1 = m - 1
m2 = 0
s1 = s
if s == 0 and m == 1:
	(small, large) = (0, 0)
	flag = False
elif s > 9 * m or s < 1:
	flag = False
	large = -1
	small = -1
if flag:
	while s1 != 0:
		if s1 > 9:
			large += 9 * 10 ** m1
			small += 9 * 10 ** m2
			s1 -= 9
			m1 -= 1
			m2 += 1
		else:
			large += s1 * 10 ** m1
			if m2 == m - 1:
				small += s1 * 10 ** m2
			else:
				small += 10 ** (m - 1)
				small += (s1 - 1) * 10 ** m2
			s1 = 0
print(small, large)


(m, s) = [int(n) for n in input().rstrip().split(' ')]
small = 0
s_s = s - 1
for i in range(m):
	d = 9 if s_s >= 9 else s_s
	s_s -= d
	if i == m - 1:
		d += 1
	small = small + 10 ** i * d
large = 0
s_l = s
for _ in range(m):
	d = 9 if s_l >= 9 else s_l
	s_l -= d
	large = large * 10 + d
ans1 = small if s_s == 0 and len(str(small)) == m else -1
ans2 = large if s_l == 0 and len(str(large)) == m else -1
print(f'{ans1} {ans2}')


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s < 1 or s > m * 9:
	print('-1 -1')
else:
	a = [0] * m
	b = [0] * m
	for i in range(m - 1):
		if i == 0:
			for j in range(1, 10):
				if s - (sum(a) + j) <= (m - i - 1) * 9:
					a[i] = j
					break
			for x in range(9, 0, -1):
				f = s - (sum(b) + x)
				if f <= (m - i - 1) * 9 and f >= 0:
					b[i] = x
					break
		else:
			for j in range(0, 10):
				if s - (sum(a) + j) <= (m - i - 1) * 9:
					a[i] = j
					break
			for x in range(9, -1, -1):
				f = s - (sum(b) + x)
				if f <= (m - i - 1) * 9 and f >= 0:
					b[i] = x
					break
	a[-1] = s - sum(a)
	b[-1] = s - sum(b)
	print(''.join(map(str, a)), ''.join(map(str, b)))


def solve_lrg(leng, num_l, req):
	if leng == 0 or req < 0:
		if req == 0:
			return ''.join(list(map(str, num_l)))
		else:
			return []
	if req < 10:
		num_l.append(req)
		req = 0
	else:
		num_l.append(9)
		req -= 9
	return solve_lrg(leng - 1, num_l, req)

def solve_sm(leng, num_l, req):
	if leng == 0 or req < 0:
		if req == 0:
			num_l.reverse()
			return ''.join(list(map(str, num_l)))
		else:
			return []
	if req < 10 and leng == 1:
		num_l.append(req)
		req = 0
	elif req == 1 and leng > 1:
		num_l.append(0)
	elif req < 10 and leng > 1:
		num_l.append(req - 1)
		req = 1
	else:
		num_l.append(9)
		req -= 9
	return solve_sm(leng - 1, num_l, req)
(leng, su) = list(map(int, input().split()))
small = solve_sm(leng, [], su)
big = solve_lrg(leng, [], su)
if leng * 9 < su or (su == 0 and leng > 1):
	print('-1 -1')
else:
	print(small, big)


a = input().split()
num = int(a[1])
c = int(a[0])
m = 0
s = []
n = []
output = []
if num == 0:
	if c == 1:
		print(0, 0)
	else:
		print(-1, -1)
if num > 9 * c:
	print(-1, -1)
if 0 < num <= 9 * c:
	while num >= 9:
		s.append('9')
		num -= 9
		c -= 1
		m += 1
	if num > 0:
		s.append(str(num))
		if c > 1:
			n.append('1')
		if c == 1:
			n.append(str(num))
		c -= 1
	if c == 0:
		for j in range(m):
			n.append('9')
		output.append(str(''.join(n)))
		output.append(str(''.join(s)))
	if c > 0:
		for i in range(c):
			s.append('0')
		if c > 1:
			if num == 0:
				n.append('1')
				for l in range(c - 1):
					n.append('0')
				n.append('8')
				for k in range(m - 1):
					n.append('9')
			if num > 0:
				for l in range(c - 1):
					n.append('0')
				n.append(str(num - 1))
				for k in range(m):
					n.append('9')
		if c == 1:
			num -= 1
			n.append(str(num))
			for p in range(m):
				n.append('9')
		output.append(str(''.join(n)))
		output.append(str(''.join(s)))
	print(' '.join(output))


i = 0
(m, s) = map(int, input().split())
k = s
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or m * 9 < s:
	print(-1, -1)
elif s == 1:
	x = '1' + (m - 1) * '0'
	print(x, x)
else:
	s = k
	ans = 0
	i = 0
	while i < m:
		if s >= 9:
			ans += 9
			ans *= 10
		else:
			ans += s
			ans *= 10
		s = max(s - 9, 0)
		i += 1
	ans //= 10
	(a, b) = (-1, m)
	for i in range(len(str(ans)) - 1):
		if str(ans)[i + 1] == '0':
			a = i
			break
	g = ''
	if a != -1:
		g = str(ans)[a - 1::-1]
		if a != 0:
			g = str(ans)[a:b] + g
	else:
		g = str(ans)[::-1]
	g = list(map(int, list(g)))
	for i in range(m - 1):
		if g[i] > 0 and (not (g[i] == 1 and g[i + 1] == 0)):
			if g[i] + g[i + 1] > 9:
				g[i] -= 9 - g[i + 1]
				g[i + 1] = 9
			else:
				g[i + 1] += g[i]
				g[i] = 0
	if g[0] == 0:
		for i in range(m):
			if g[i] > 0:
				g[i] -= 1
				g[0] = 1
				break
	k = ''
	for i in g:
		k += str(i)
	k = int(k)
	print(k, ans)


(m, s) = map(int, input().split())
s_tp = [s, s]
m_tp = [m, m]
sm_num = ''
lr_num = ''
for i in range(m):
	for j in range(int(not i), 10):
		if m_tp[0] == 1:
			sm_num += str(s_tp[0])
			break
		if (s_tp[0] - j) / (m_tp[0] - 1) <= 9 and s_tp[0] - j >= 0:
			s_tp[0] -= j
			m_tp[0] -= 1
			sm_num += str(j)
			break
	for j in range(9, -1, -1):
		if m_tp[1] == 1:
			lr_num += str(s_tp[1])
			break
		if (s_tp[1] - j) / (m_tp[1] - 1) <= 9 and s_tp[1] - j >= 0:
			s_tp[1] -= j
			m_tp[1] -= 1
			lr_num += str(j)
			break
if m_tp[0] == 1 and m_tp[1] == 1 and (m > 1 and s != 0):
	print(sm_num, lr_num)
elif m == 1 and s <= 9:
	print(s, s)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
if m > 1 and s == 0 or s > 9 * m:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	arr = []
	while len(arr) != m:
		arr.append(min(9, s))
		s -= min(9, s)
	st = ''.join(map(str, arr))
	rst = arr[::-1]
	if rst[0] == 0:
		rst[0] = 1
		for i in range(1, len(rst)):
			if rst[i] != 0:
				rst[i] -= 1
				break
	lt = ''.join(map(str, rst))
	print(lt, st)


import math
import copy
(a, b) = [int(q) for q in input().split()]
if b == 0 and a != 1:
	print('-1 -1')
elif b == 0 and a == 1:
	print('0 0')
elif b > 9 * a:
	print('-1 -1')
else:
	if b < 9:
		an = [b]
		for i in range(a - 1):
			an.append(0)
		if a - 1 > 0:
			ans = [1]
			for i in range(a - 2):
				ans.append(0)
			ans.append(b - 1)
		else:
			ans = an
	else:
		m = math.floor(b / 9)
		n = b - m * 9
		an = []
		for f in range(m):
			an.append(9)
		if a - m != 0:
			an.append(n)
			for e in range(a - m - 1):
				an.append(0)
		if a - m - 1 > 0:
			ans = [1]
			m2 = math.floor((b - 1) / 9)
			n2 = b - 1 - m2 * 9
			for i in range(a - 2 - m2):
				ans.append(0)
			ans.append(n2)
			for f in range(m2):
				ans.append(9)
		else:
			ans = copy.deepcopy(an)
			ans.reverse()
	for s in ans:
		print(s, end='')
	print(end=' ')
	for r in an:
		print(r, end='')


(m, s) = map(int, list(input().split()))
if s != 0:
	if s < 9 * m:
		b = s // 9
		c = s % 9
		if b == m - 1:
			n1 = str(c) + b * '9'
			n2 = b * '9' + str(c)
		else:
			if c != 0:
				n1 = '1' + (m - 1 - b - 1) * '0' + str(c - 1) + b * '9'
			else:
				n1 = '1' + (m - 1 - b - 1) * '0' + str(c) + '8' + (b - 1) * '9'
			n2 = b * '9' + str(c) + (m - 1 - b) * '0'
	elif s == 9 * m:
		n1 = m * '9'
		n2 = m * '9'
	else:
		n1 = '-1'
		n2 = '-1'
	print(n1, end=' ')
	print(n2)
elif m == 1:
	print('0 0')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
if m != 1 and s == 0 or s > 9 * m:
	print('-1 -1')
else:
	rem = s
	i = m - 1
	maxi = 0
	while i >= 0:
		maxi += min(rem, 9) * 10 ** i
		rem -= min(rem, 9)
		i -= 1
	rem = s - 1
	mini = 0
	for j in range(0, m - 1):
		mini += min(max(0, rem), 9) * 10 ** j
		rem -= min(max(0, rem), 9)
	mini += (rem + 1) * 10 ** (m - 1)
	print(mini, maxi)


(n, s) = map(int, input().split())
if s < 1 and n > 1 or n * 9 < s:
	print(-1, -1)
else:
	m = s
	ma = [0] * n
	for i in range(n):
		if m >= 9:
			ma[i] += 9
			m -= 9
		else:
			ma[i] += m
			m -= m
	mi = ma[::-1]
	if mi[0] == 0:
		if len(set(mi)) <= 2:
			mi[mi.index(max(mi))] -= 1
			mi[0] += 1
		else:
			mi[mi.index(max(mi)) - 1] -= 1
			mi[0] += 1
	print(''.join(map(str, mi)), ''.join(map(str, ma)))


(m, s) = input().split(' ', 1)
(m, s) = (int(m), int(s))

def rev(a):
	return a[::-1]
if 9 * m < s or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	(max1, min1) = ('', '')
	i = 1
	while i <= m:
		if s >= 9:
			s = s - 9
			max1 = max1 + '9'
			i = i + 1
			continue
		elif 0 < s < 9:
			max1 = max1 + str(s)
			s = 0
			i = i + 1
			continue
		elif s == 0:
			max1 = max1 + '0'
			i = i + 1
			continue
	min1 = rev(max1)
	if min1[0] == '0':
		mimi = '1'
		for i in range(len(min1)):
			if min1[i] != '0':
				mark = i
				mark1 = int(min1[i])
				break
		mimi = mimi + min1[1:mark] + str(mark1 - 1) + min1[mark + 1:]
		min1 = mimi
	print(min1, max1)


(m, s) = map(int, input().split())
t = {}
if m == 1 and s <= 9 and (s >= 0):
	print(str(s) + ' ' + str(s))
if m != 1 and s == 0 or s > m * 9:
	print('-1 -1')
if m > 1 and s >= 1 and (s < m * 9):
	nmax = ''
	c9 = s // 9
	y9 = s % 9
	if c9 >= 1:
		nmax += '9' * c9
		nmax += str(y9)
		nmax += '0' * (m - c9 - 1)
	if c9 == 0:
		nmax += str(y9)
		nmax += '0' * (m - 1)
	nmin = ''
	c9x = (s - 1) // 9
	if c9x == m - 1:
		y9x = s - 9 * c9x
		nmin += str(y9x)
		nmin += '9' * c9
	if c9x < m - 1:
		y9x = s - 9 * c9x - 1
		nmin += '1'
		nmin += '0' * (m - c9x - 2)
		nmin += str(y9x)
		nmin += '9' * c9x
	print(nmin + ' ' + nmax)
if m != 1 and s == m * 9:
	print('9' * m + ' ' + '9' * m)


(m, s) = map(int, input().split())
temp = s
large = []
i = 0
while i < m:
	if s > 9:
		s -= 9
		large.append('9')
	else:
		large.append(str(s))
		s -= s
	i += 1
large = ''.join(large)
if large[0] == '0' and m > 1 or s > 0:
	large = -1
small = []
i = m - 1
s = temp
while i > 0:
	if s > 9:
		small.append('9')
		s -= 9
	elif s > 1:
		small.append(str(s - 1))
		s = 1
	else:
		small.append('0')
	i -= 1
if s < 10:
	small.append(str(s))
	s = 0
small = small[::-1]
small = ''.join(small)
if m > 1 and small[0] == '0' or s > 0:
	small = -1
print(small, large)


from sys import stdin, stderr

def readInts():
	return map(int, stdin.readline().strip().split())

def print_err(*args, **kwargs):
	print(*args, file=stderr, **kwargs)

def solve(m, s):
	if m == 1 and s == 0:
		return ('0', '0')
	if s == 1:
		out = str(10 ** (m - 1))
		return (out, out)

	def toOut(ns):
		return ''.join(map(str, ns))
	bad = ('-1', '-1')
	(m2, s2) = (m, s)
	rhs_rev = []
	while s2 > 10:
		rhs_rev.append(9)
		s2 -= 9
		m2 -= 1
	if m2 < 0:
		return bad
	if m2 <= 1:
		if s2 > 9:
			return bad
		if m2 == 1 and s2 > 0:
			rhs_rev.append(s2)
		if m2 == 0 and s2 > 0:
			return bad
		rhs_rev = toOut(rhs_rev)
		return (rhs_rev[::-1], rhs_rev)
	largest_rev = rhs_rev[::-1]
	m2large = m2
	if s2 < 1:
		return bad
	if s2 == 10:
		largest_rev.append(9)
		largest_rev.append(1)
		m2large -= 2
	else:
		largest_rev.append(s2)
		m2large -= 1
	while m2large > 0:
		largest_rev.append(0)
		m2large -= 1
	largest = largest_rev[::-1]
	rhs_rev.append(s2 - 1)
	s2 = 1
	m2 -= 1
	while m2 > 1:
		rhs_rev.append(0)
		m2 -= 1
	rhs_rev.append(1)
	m2 -= 1
	if m2large < 0 or m2 < 0:
		return bad
	rhs_rev = toOut(rhs_rev)
	largest_rev = toOut(largest_rev)
	return (rhs_rev[::-1], largest_rev)

def run():
	(m, s) = readInts()
	print(' '.join(solve(m, s)))

def test():
	for m in range(1, 4):
		for s in range(40):
			print(m, s, solve(m, s))
run()


(m, s) = [int(i) for i in input().split()]
if (m == 1) & (s == 0):
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	max = ''
	min = []
	ms = s
	while len(max) < m:
		if ms > 9:
			min.append('9')
			max += '9'
			ms -= 9
		else:
			min.append(str(ms))
			max += str(ms)
			ms = 0
	min.reverse()
	if min[0] == '0':
		for i in range(m):
			if min[i] != '0':
				min[0] = '1'
				min[i] = str(int(min[i]) - 1)
				break
	print(''.join(min), max)


(m, s) = map(int, input().split(' '))
if s == 0 and m != 1 or s > 9 * m:
	print('-1 -1')
elif m == 1:
	print(s, s)
else:
	ma = []
	for i in range(m):
		if s > 9:
			ma.append('9')
			s -= 9
		else:
			ma.append(str(s))
			s -= s
	mx = ''.join(ma)
	ma.reverse()
	if ma[0] == '0':
		ma[0] = '1'
		i = 1
		while ma[i] == '0':
			i += 1
		ma[i] = str(ord(ma[i]) - ord('1'))
	mi = ''.join(ma)
	print(mi, mx)


l = str(input())
m = int(l.split()[0])
s = int(l.split()[1])
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
	exit()
k = s
for i in range(m - 1, -1, -1):
	j = max(0, k - 9 * i)
	if j == 0 and i == m - 1 and (k != 0):
		j = 1
	print(j, end='')
	k -= j
print(' ', end='')
k = s
for i in range(m - 1, -1, -1):
	j = min(9, k)
	print(j, end='')
	k -= j
print()


(n, s) = [int(i) for i in input().split()]
mi = 0
ma = 0
if s == 0 and n != 1 or s > 9 * n:
	print(-1, -1)
else:
	e = s % 9
	w = s // 9
	for i in range(w):
		mi += 9 * 10 ** i
	if e == 0:
		mi = mi + 10 ** (n - 1) - 10 ** (w - 1)
	else:
		mi = mi + 10 ** (n - 1) + (e - 1) * 10 ** w
	for i in range(w):
		ma += 9 * 10 ** (n - i - 1)
	if n != w:
		ma += e * 10 ** (n - w - 1)
	print(int(mi), int(ma))


import sys
(m, s) = map(int, sys.stdin.readline().split())
s2 = s
if m == 1 and s == 0:
	max = min = 0
elif s > m * 9 or (m != 1 and s == 0):
	max = min = -1
else:
	l = [str(0)] * m
	for i in range(m):
		if s > 9:
			l[i] = str(9)
			s -= 9
		else:
			l[i] = str(s)
			s -= s
	max = ''.join(l)
	l2 = [str(0)] * m
	for i in range(m - 1, -1, -1):
		if s2 > 9:
			l2[i] = str(9)
			s2 -= 9
		elif i == 0:
			l2[0] = str(s2)
			min = ''.join(l2)
			break
		else:
			l2[i] = str(s2 - 1)
			l2[0] = str(1)
			min = ''.join(l2)
			break
print(min, max)


(m, s) = [int(i) for i in input().split()]
num = [9 for i in range(m)]

def max_number(num, s):
	total_sum = sum(num)
	i = 1
	while total_sum > s:
		num[-i] -= 1
		total_sum -= 1
		if num[-i] == 0:
			i += 1
	return num

def min_number(num, s):
	aux_num = num[::-1]
	if aux_num[0] == 0:
		for i in range(len(num)):
			if aux_num[i] != 0:
				aux_num[i] -= 1
				aux_num[0] += 1
				break
	return aux_num
if s == 0 and m > 1 or 9 * m < s:
	print('-1 -1')
else:
	max_num = max_number(num, s)
	min_num = min_number(num, s)
	for i in min_num:
		print(i, end='')
	print(' ', end='')
	for k in max_num:
		print(k, end='')


(a, b) = input().split()
a = int(a)
b = int(b)
if a > 1 and b < 1 or b > a * 9:
	print('-1 -1')
else:
	k = b
	for i in range(a - 1, -1, -1):
		j = max(0, k - 9 * i)
		if j == 0 and i == a - 1 and k:
			j = 1
		print(j, end='')
		k -= j
	print('', end=' ')
	k = b
	for i in range(a - 1, -1, -1):
		j = min(9, k)
		print(j, end='')
		k -= j


r = input().split()
length = int(r[0])
digit = int(r[1])
digitc = int(r[1])
le = 0
m = []
ans1 = 0
ans2 = 0
if length == 1 and digit <= 9 * length:
	print(digit, digit)
elif digit == 0 or digit > 9 * length:
	print('-1 -1')
else:
	while le != length:
		if digitc >= 9:
			m.append(9)
			digitc -= 9
			le += 1
		else:
			m.append(digitc)
			le += 1
			digitc = 0
	for i in range(length):
		ans1 += m[i] * 10 ** (length - i - 1)
	if digit > 9 and 9 * length - 8 < digit:
		for i in range(length):
			if m[i] != 0:
				ans2 += m[i] * 10 ** i
			else:
				mid = int(ans2 / 10 ** (i - 1))
				midd = ans2 % 10 ** (i - 1)
				ans2 = int(10 ** i * mid + midd)
	elif digit <= 9:
		ans2 = 10 ** (length - 1) + digit - 1
	elif digit > 9 and 9 * length - 8 >= digit:
		u = digit - 1
		k = 0
		l = []
		while k != length:
			if u >= 9:
				l.append(9)
				u -= 9
				le += 1
			else:
				l.append(u)
				k += 1
				u = 0
		for i in range(length):
			ans2 += l[i] * 10 ** i
		ans2 += 10 ** (length - 1)
	print(ans2, ans1)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	x = ''
	y = ''
	a = 9 * m - s
	b = s
	for i in range(m):
		if i == 0:
			t = min(min(9, a), 8)
			x += str(9 - t)
			a -= t
		else:
			t = max(min(9, a), 0)
			x += str(9 - t)
			a -= t
		u = min(9, b)
		y += str(u)
		b -= u
	print(int(x), int(y))


(m, s) = map(int, input().split())
(dp, dp2) = ([], [])
if s > m * 9 or (s == 0 and m > 1):
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif s == 1:
	dp.append('1')
	for i in range(m - 1):
		dp.append('0')
	dp2 = dp
elif s > 1 and s < 10 and (m != 1):
	dp.append(str(s))
	for i in range(m - 1):
		dp.append('0')
	dp2.append('1')
	for i in range(m - 2):
		dp2.append('0')
	dp2.append(str(s - 1))
elif s > 1 and s < 10 and (m == 1):
	dp.append(str(s))
	dp2 = dp
elif s % 9 == 0 and s != 9:
	a = s // 9
	for i in range(a):
		dp.append('9')
	for i in range(m - a):
		dp.append('0')
	if m <= a:
		dp2.append(str(9))
		for i in range(m - a):
			dp2.append('0')
		for i in range(a - 1):
			dp2.append('9')
	else:
		dp2.append('1')
		for i in range(m - a - 1):
			dp2.append('0')
		dp2.append(str(8))
		for i in range(a - 1):
			dp2.append('9')
else:
	a = s // 9
	for i in range(a):
		dp.append('9')
	dp.append(str(s % 9))
	for i in range(m - a - 1):
		dp.append('0')
	if m > 2:
		dp2.append(str(1))
		for i in range(m - a - 2):
			dp2.append('0')
		dp2.append(str(s % 9 - 1))
		for i in range(a):
			dp2.append('9')
	if len(dp2) != m:
		dp2.clear()
		dp2.append(str(s % 9))
		for i in range(m - 1):
			dp2.append('9')
print(''.join(dp2), ''.join(dp))


import sys
import math
from collections import defaultdict

def maxCreate(m, s):
	q = s // 9
	r = s % 9
	res = '9' * q
	if len(res) == m:
		return int(res)
	else:
		res += str(r)
		while len(res) < m:
			res += '0'
		return int(res)

def minCreate(m, s):
	if m == 1:
		return s
	q = s // 9
	r = s % 9
	res = '9' * q
	if len(res) == m - 1:
		res += str(r)
		return int(res[::-1])
	elif len(res) == m:
		return int(res[::-1])
	else:
		if r == 0:
			res = res[:-1] + str(int(res[-1]) - 1)
		else:
			res += str(r - 1)
		while len(res) < m - 1:
			res += '0'
		if len(res) < m:
			res += '1'
		return int(res[::-1])

def solve():
	(m, s) = map(int, input().split())
	if s > 9 * m or (s == 0 and m > 1):
		print(-1, -1)
		return
	a = minCreate(m, s)
	b = maxCreate(m, s)
	print(a, b)
test_cases = 1
for _ in range(test_cases):
	solve()


def solve(m, s):
	if m == 1 and s == 0:
		return (0, 0)
	if s < 1 or s > 9 * m:
		return (-1, -1)
	(s1, s2) = (s, s)
	(min_v, max_v) = (0, 0)
	for i in range(1, m):
		for v in range(0 + (i == 1), 10):
			if 0 <= s1 - v and s1 - v <= 9 * (m - i):
				min_v = min_v * 10 + v
				s1 -= v
				break
		else:
			print('error')
		for v in range(9, 0 - (i != 1), -1):
			if 0 <= s2 - v and s2 - v <= 9 * (m - i):
				max_v = max_v * 10 + v
				s2 -= v
				break
		else:
			print('error')
	return (min_v * 10 + s1, max_v * 10 + s2)
(m, s) = [int(x) for x in input().split()]
print(*solve(m, s))


(m, s) = map(int, input().split())
ss = s
l = [0] * m
l[0] = 1
s -= 1
for i in range(m - 1, 0, -1):
	if s >= 9:
		l[i] = 9
		s -= 9
	else:
		l[i] = s
		s = 0
minn = 0
if s >= 9 or (ss == 0 and m != 1):
	print(-1, -1)
else:
	l[0] += s
	for i in l:
		minn += i
		minn *= 10
	minn = minn // 10
	l = [0] * m
	s = ss
	for i in range(0, m):
		if s >= 9:
			l[i] = 9
			s -= 9
		else:
			l[i] = s
			s = 0
	maxx = 0
	for i in l:
		maxx += i
		maxx *= 10
	maxx = maxx // 10
	print(minn, maxx)


(a, b) = map(int, input().split())
if a == 1 and b == 0:
	print('0 0')
elif b < 1 or b > 9 * a:
	print('-1 -1')
else:
	c = 9 * a - b
	n = 0
	int(n)
	while True:
		if c < 9:
			break
		else:
			c -= 9
			n += 1
			pass
	x = 0
	y = 0
	if n >= 1:
		x += 8 * 10 ** (a - 1)
		for i in range(1, n):
			x += 9 * 10 ** (a - i - 1)
		x += (c + 1) * 10 ** (a - n - 1)
	else:
		x += c * 10 ** (a - 1)
	minimum = 10 ** a - 1 - x
	d = b
	m = 0
	int(m)
	while True:
		if d < 9:
			break
		else:
			d -= 9
			m += 1
			pass
	if m >= 1:
		for i in range(1, m + 1):
			y += 9 * 10 ** (a - i)
		if d == 0:
			pass
		else:
			y += d * 10 ** (a - m - 1)
	else:
		y += d * 10 ** (a - 1)
	print(minimum, y)


(m, s) = [int(x) for x in input().split()]
minn = maxn = ''
smin = smax = s

def possible(sum, digits):
	return sum >= 0 and sum <= 9 * digits
for i in range(m):
	for j in range(10):
		if possible(smin - j, m - i - 1) and (i > 0 or j > 0 or (m == 1 and j == 0)):
			minn += str(j)
			smin -= j
			break
	else:
		print(-1, -1)
		exit()
for i in range(m):
	for j in range(9, -1, -1):
		if possible(smax - j, m - i - 1) and (i > 0 or j > 0 or (m == 1 and j == 0)):
			maxn += str(j)
			smax -= j
			break
if int(minn) == 0 and m != 1:
	print(-1, -1)
else:
	print(minn, maxn)


(length, summary) = map(int, input().split(' '))

def can(m, s):
	if s >= 0 and s <= 9 * m:
		return True
	return False

def searchMin(s, length):
	minn = ''
	for i in range(length):
		for d in range(10):
			if (i > 0 or d > 0 or (length == 1 and d == 0)) and can(length - i - 1, s - d):
				minn += str(d)
				s -= d
				break
	return str(minn)

def searchMax(s, length):
	maxx = ''
	for i in range(length):
		for d in range(9, -1, -1):
			if (i > 0 or d > 0 or (length == 1 and d == 0)) and can(length - i - 1, s - d):
				maxx += str(d)
				s -= d
				break
	return str(maxx)
mn = searchMin(summary, length)
mx = searchMax(summary, length)
if mn == '':
	mn = '-1'
if mx == '':
	mx = '-1'
if length == 1 and summary == 0:
	print('0 0')
elif length > 1 and summary == 0:
	print('-1 -1')
else:
	print(mn + ' ' + mx)


(m, s) = [int(i) for i in input().split()]
b = s
if m == 1:
	if 0 <= s <= 9:
		print(s, s)
	else:
		print('-1 -1')
if m > 1:
	if s > 9 * m or s == 0:
		print('-1 -1')
	else:
		n = []
		for i in range(m):
			if s >= 9:
				n.append(9)
				s -= 9
			elif 0 <= s < 9:
				n.append(s)
				s = 0
		n1 = [str(k) for k in n]
		maxn = ''.join(n1)
		if b > 1:
			if n[len(n) - 1] == 0:
				o = []
				for j in range(len(n)):
					if n[j] == 0:
						o.append(j)
				u = o[0] - 1
				n[u] -= 1
				n[len(n) - 1] = 1
				n2 = n[::-1]
				n2 = [str(k) for k in n2]
				minn = ''.join(n2)
			elif n[len(n) - 1] > 0:
				n2 = sorted(n)
				n2 = [str(k) for k in n2]
				minn = ''.join(n2)
		if b == 1:
			minn = maxn
		print(minn, maxn)


import sys
(n, s) = map(int, input().split())
max_n = [0] * n
min_n = [0] * n
min_n[0] = 1
if s is 0 and n > 1:
	print(-1, -1)
	sys.exit(0)
if s is 0 and n is 1:
	print(0, 0)
	sys.exit(0)
if s > 9 * n:
	print(-1, -1)
	sys.exit(0)
s1 = s - 1
for i in range(n):
	if s >= 9:
		max_n[i] = 9
		s = s - 9
	elif s < 9 and s is not 0:
		max_n[i] = s
		s = 0
for i in range(n):
	if s1 >= 9:
		min_n[n - i - 1] = 9
		s1 = s1 - 9
	elif s1 < 9 and s1 > 0:
		if n - i - 1 is 0:
			min_n[n - i - 1] = s1 + 1
		else:
			min_n[n - i - 1] = s1
		s1 = 0
max_n = map(str, max_n)
max_n = ''.join(max_n)
min_n = map(str, min_n)
min_n = ''.join(min_n)
print(min_n, max_n)


(d, n) = map(int, input().split())
maxa = [0] * d
mina = [0] * d
m = n
if n / d > 9 or n / d == 0:
	if d == 1 and n == 0:
		print(0, 0)
	else:
		print(-1, -1)
else:
	for i in range(d):
		k = 9
		while True:
			if n - k >= 0:
				maxa[i] = str(k)
				n -= k
				break
			else:
				k -= 1
	for i in range(d):
		if i == 0:
			k = 1
		else:
			k = 0
		while True:
			if m - k <= 9 * (d - 1 - i):
				mina[i] = str(k)
				m -= k
				break
			else:
				k += 1
	print(''.join(mina), ''.join(maxa))


import copy
(m, s) = map(int, input().split())
s1 = copy.deepcopy(s)
small = []
big = []
if m == 1 and s == 0:
	print(0, 0)
elif m > 1 and s == 0 or s > m * 9:
	print(-1, -1)
else:
	for i in range(1, m + 1):
		k = s - (m - i) * 9
		if i == 1:
			if k < 1:
				k = 1
		elif k < 0:
			k = 0
		s -= k
		small.append(k)
	num = 0
	for j in range(1, m + 1):
		if 9 * j > s1:
			num = j
			break
	if num == 0:
		for h in range(0, j):
			big.insert(h, 9)
	else:
		for h in range(0, j - 1):
			big.insert(h, 9)
		big.insert(j - 1, s1 - 9 * (j - 1))
		if m > j:
			for a in range(j, m):
				big.insert(a, 0)
print(''.join(('%s' % g for g in small)), end=' ')
print(''.join(('%s' % g for g in big)))


(m, s) = [int(i) for i in input().split()]
if m == 1 and s <= 9:
	print(s, s)
elif m == 1:
	print(-1, -1)
elif s >= 1 and s <= m * 9:
	min_val = [0] * m
	max_val = [0] * m
	min_val[0] = 1
	s_ = s - 1
	for i in range(1, m):
		if s_ <= 0:
			break
		else:
			min_val[m - i] = min(9, s_)
			s_ -= min_val[m - i]
	if s_ >= 1:
		min_val[0] = s_ + 1
	s_ = s
	for i in range(m):
		if s_ <= 0:
			break
		else:
			max_val[i] = min(9, s_)
			s_ -= max_val[i]
	print(int(''.join([str(j) for j in min_val])), int(''.join([str(j) for j in max_val])))
else:
	print(-1, -1)


(x, y) = map(int, input().split())
a = y // 9
p = '9' * a
q = p + str(y - a * 9) + '0' * (x - (a + 1))
if x == 1 and y == 0:
	print(0, 0)
	exit()
elif y / 9 > x or (x > 1 and y == 0):
	print(-1, -1)
	exit()
elif y % 9 == 0 and len(q) > x:
	r = q[::-1]
	r = r.replace(r[0], '')
	q = q.replace(q[x], '')
elif q[::-1][0] == '0':
	r = '1' + '0' * (x - (a + 2)) + str(y - a * 9 - 1) + p
	if y % 9 == 0:
		r = '1' + '0' * (x - (a + 1)) + '8' + '9' * (a - 1)
else:
	r = q[::-1]
print(r, q)


(m, const_s) = map(int, input().split())
a = []
s = const_s
for i in range(m - 1, -1, -1):
	k = min(s - i * 9, 9)
	if len(a) > 0:
		k = max(0, k)
	else:
		k = max(1, k)
	s -= k
	if s < 0:
		break
	a.append(k)
if len(a) == m and s == 0:
	a = ''.join([str(i) for i in a])
else:
	a = -1
b = []
s = const_s
for _ in range(m):
	d = min(s, 9)
	if len(b) == 0:
		d = max(1, d)
	s -= d
	if s < 0:
		break
	b.append(d)
if len(b) == m and s == 0:
	b = ''.join([str(i) for i in b])
else:
	b = -1
if m == 1 and const_s == 0:
	a = 0
	b = 0
print(a, b)


(n, s) = map(int, input().split())
sma = [0] * n
lar = [0] * n
sma[0] = 1
if n == 1 and s == 0:
	print(0, 0)
	exit()
elif n > 1 and s == 0:
	print(-1, -1)
	exit()
elif s > 9 * n:
	print(-1, -1)
	exit()
else:
	ds = s - 1
	for i in range(n - 1, -1, -1):
		mm = min(9, ds)
		sma[i] += mm
		ds -= mm
	ds = s
	for i in range(n):
		mm = min(9, ds)
		lar[i] = mm
		ds -= mm
print(*sma, sep='', end=' ')
print(*lar, sep='')


def maxNum(l, s):
	if l == 1:
		return s
	elif s < 10:
		return s * 10 ** (l - 1)
	else:
		return 9 * 10 ** (l - 1) + maxNum(l - 1, s - 9)

def minNum(l, s):
	if l == 1:
		return s
	if s == 1:
		return minNum(l - 1, 1) * 10
	if s < 10:
		return s - 1 + minNum(l - 1, 1) * 10
	return 9 + minNum(l - 1, s - 9) * 10

def foo(l, s):
	if s == 0 and l == 1:
		return (0, 0)
	if s == 0 or s > l * 9:
		return (-1, -1)
	mx = maxNum(l, s)
	mn = minNum(l, s)
	return (mn, mx)
(l, s) = map(int, input().strip().split())
(mn, mx) = foo(l, s)
print(mn, mx)


(m, s) = map(int, input().split())
if m == 1:
	l = 0
else:
	l = 1
r = 9 * m
if not l <= s <= r:
	print(-1, -1)
else:
	if m > 1:
		num_min = [1] + [0 for i in range(m - 1)]
	else:
		num_min = [0]
	num_max = [9 for i in range(m)]
	x = (r - s) // 9
	for i in range(m - x, m):
		num_max[i] = 0
	num_max[m - x - 1] -= (r - s) % 9
	y = (s - l) // 9
	for i in range(m - y, m):
		num_min[i] = 9
	num_min[m - y - 1] += (s - l) % 9
	for i in range(m):
		print(num_min[i], end='', sep='')
	print(' ', end='', sep='')
	for i in range(m):
		print(num_max[i], end='', sep='')
	print()


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
	exit()
t = s
r = [0 for i in range(m)]
i = 0
r[i] = min(s, 9)
s = s - r[i]
i = 1
while s > 0 and i < len(r):
	r[i] = min(s, 9)
	s = s - r[i]
	i = i + 1
if s == t or s > 0:
	ans = -1
else:
	for i in range(len(r)):
		r[i] = str(r[i])
	ans = ''.join(r)
r1 = [0 for i in range(m)]
r1[0] = 1
k = t
t = t - 1
if t:
	for i in range(m - 1, -1, -1):
		t1 = min(9 - r1[i], t)
		r1[i] = r1[i] + t1
		t = t - t1
if t == k or t > 0:
	ans1 = -1
else:
	for i in range(len(r1)):
		r1[i] = str(r1[i])
	ans1 = ''.join(r1)
print(ans1, ans)


X = 101
Y = 901

def pr(dp):
	for i in dp:
		print(*i)

def getMax():
	dp = [[0 for i in range(Y)] for j in range(X)]
	for i in range(10):
		dp[1][i] = i
	for i in range(2, X):
		for j in range(1, Y):
			if j > 9 * i:
				break
			if dp[i - 1][j] != 0:
				dp[i][j] = dp[i - 1][j] * 10
			else:
				dp[i][j] = dp[i][j - 1] + 1
	return dp

def getMin():
	dp = [[0 for i in range(Y)] for j in range(X)]
	for i in range(10):
		dp[1][i] = i
	for i in range(1, X):
		dp[i][1] = 10 ** (i - 1)
	for i in range(2, X):
		for j in range(2, Y):
			f = 0
			s = list(str(dp[i][j - 1])[::-1])
			for k in range(len(s)):
				if s[k] != '9':
					s[k] = str(int(s[k]) + 1)
					f = 1
					break
			if f != 0:
				dp[i][j] = int(''.join(s[::-1]))
	return dp
(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print(0, 0)
else:
	ma = getMax()
	mi = getMin()
	a = mi[n][s]
	b = ma[n][s]
	if a != 0 and b != 0:
		print(a, b)
	else:
		print(-1, -1)


def maxLimitNo(m, s):
	if m * 9 < s:
		return '-1'
	if m > 1 and s == 0:
		return '-1'
	i = 0
	ans = ''
	flag = True
	while i < m:
		if not flag:
			i += 1
			ans += '0'
			continue
		num = s - 9
		if num >= 0:
			ans += '9'
			s -= 9
		elif num < 0:
			ans += str(s)
			flag = False
		i += 1
	return ans

def minNumber(m, s):
	if m * 9 < s or (m > 1 and s < 1):
		return '-1'
	if m == 1 and s == 0:
		return '0'
	i = 0
	ans = '1'
	flag = True
	n = s - (m - 1) * 9
	if n > 0:
		s -= n
		m -= 1
		ans = str(n)
	else:
		s -= 1
		m -= 1
	ans2 = maxLimitNo(m, s)
	if ans2 == '-1':
		if m <= 0:
			return ans
		ans2 = ''
		while i < m:
			ans2 += '0'
			i += 1
	return ans + ans2[::-1]
(m, s) = map(int, input().split(' '))
print(minNumber(m, s), maxLimitNo(m, s), sep=' ')


def adder(n):
	cnt = 0
	while n:
		cnt += n % 10
		n //= 10
	return cnt

def suml2(l, s):
	base = int('9' * (l - 1))
	lim = int('1' + '0' * l)
	for i in range(base + 1, lim):
		if adder(i) == s:
			lst = [j for j in str(i)]
			return i

def suml(l, s):
	if s == 0 and l > 1:
		print(-1, -1)
		return ''
	if s < 20 and l > 1:
		mini = suml2(l, s)
	if l == 1 and s == 0:
		print(0, 0)
		return ''
	dp = [0] * l
	curr = 0
	for i in range(l):
		dp[i] = min(9, s - curr)
		curr += dp[i]
	if sum(dp) != s:
		print(-1, -1)
		return ''
	lst1 = sorted(dp)
	if lst1[lst1.count(0)] != 1 and lst1.count(0) > 0:
		middle = [0] * lst1.count(0)
		middle[-1] = lst1[lst1.count(0)] - 1
		temp = [1] + middle + lst1[lst1.count(0) + 1:]
	else:
		temp = [lst1[lst1.count(0)]] + [0] * lst1.count(0) + lst1[lst1.count(0) + 1:]
	if s < 20 and l > 1:
		print(mini, ''.join(map(str, lst1[::-1])))
		return ''
	print(''.join(map(str, temp)), ''.join(map(str, lst1[::-1])))
	return ''
(a, b) = map(int, input().strip().split())
print(suml(a, b))


(m, s) = map(int, input().split())

def check_val(m, s):
	return s <= 9 * m

def max_num(m, s):
	number = [0 for i in range(m + 1)]
	for i in range(m):
		if s >= 9:
			number[i] = 9
			s = s - 9
		else:
			number[i] = s
			s = 0
	return ''.join(map(str, number[:-1]))

def min_num(m, s):
	number = [0 for i in range(m + 1)]
	s = s - 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			number[i] = 9
			s = s - 9
		else:
			number[i] = s
			s = 0
	number[0] = s + 1
	return ''.join(map(str, number[:-1]))
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif check_val(m, s):
	print(min_num(m, s), max_num(m, s))
else:
	print(-1, -1)


from math import floor
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
if 1 <= s <= 9 * m:
	if s <= 9:
		print(10 ** (m - 1) + s - 1, s * 10 ** (m - 1))
	else:
		x = [0 for i in range(m)]
		a = floor(s / 9)
		b = s - 9 * a
		for i in range(0, a):
			x[i] = 9
		if b > 0:
			x[a] = b
		y = list(map(str, x))
		max = ''.join(y)
		if x[m - 1] > 0:
			min = ''.join(reversed(y))
		else:
			x[m - 1] = 1
			if x[a] > 0:
				x[a] -= 1
			else:
				x[a - 1] -= 1
			y = list(map(str, x))
			min = ''.join(reversed(y))
		print(min, max)
if s > 9 * m:
	print(-1, -1)


(x, y) = [int(i) for i in input().split()]
if x > 1 and y < 1 or x * 9 < y:
	print('-1 -1')
else:
	k = y
	for i in range(x):
		s = max(0, k - (x - i - 1) * 9)
		if s == 0 and i == 0 and (k != 0):
			s = 1
		k = k - s
		print(s, end='')
	print(' ', end='')
	k = y
	for i in range(x):
		s = min(9, k)
		k = k - s
		print(s, end='')


(m, s) = map(int, input().split())
min_num = ''
max_num = ''
if s == 0 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
elif s > m * 9:
	print('-1 -1')
else:
	if s // 9 >= m - 1:
		max_num = '9' * (s // 9) + str(s % 9) * (m - s // 9)
		min_num = max_num[::-1]
	else:
		min_num = '1' + '0' * max(0, m - 2 - (s - 1) // 9) + str((s - 1) % 9) + '9' * ((s - 1) // 9)
		max_num = '9' * (s // 9) + str(s % 9) + '0' * max(0, m - 1 - s // 9)
	print(min_num + ' ' + max_num)


(m, s) = list(map(int, input().split()))
k = m
val = 0
pointer = min(9, s)
if m > 1 and s == 0 or s / m > 9:
	print(-1, -1)
else:
	while m:
		val = val * 10 + pointer
		m -= 1
		s -= pointer
		pointer = min(9, s)
	if val == 0:
		print(0, 0)
	else:
		val = str(val)
		c = 0
		f = 0
		for i in range(k):
			if val[k - i - 1] == '0':
				f = 1
			else:
				c = k - i - 1
				break
		if f == 1:
			v = int(val[c]) - 1
			mval = val[:c] + str(v) + val[c + 1:-1] + '1'
			print(mval[::-1], val)
		else:
			print(val[::-1], val)


line = input().split()
n = int(line[0])
t = int(line[1])
a = ''
if t > 9 * n or (n > 1 and t == 0):
	print('-1 -1')
elif n == 1 and t == 0:
	print('0 0')
else:
	m = int(t / 9)
	b = t % 9
	if b != 0:
		maxa = '9' * m + str(b)
		for i in range(n - len(maxa)):
			maxa += '0'
	else:
		maxa = '9' * m
		for i in range(n - len(maxa)):
			maxa += '0'
	if b != 0:
		mina = str(b) + '9' * m
		for i in range(n - len(mina)):
			a += '0'
		mina = a + mina
		if mina.count('0') > 0:
			mina = list(mina)
			for y in range(len(mina)):
				mina[y] = int(mina[y])
			mina[mina.count(0)] = mina[mina.count(0)] - 1
			mina[0] = 1
	else:
		mina = '9' * m
		for i in range(n - len(mina)):
			a += '0'
		mina = a + mina
		if mina.count('0') > 0:
			mina = list(mina)
			for y in range(len(mina)):
				mina[y] = int(mina[y])
			mina[mina.count(0)] = mina[mina.count(0)] - 1
			mina[0] = 1
	mina = list(mina)
	for y in range(len(mina)):
		mina[y] = int(mina[y])
	for y in range(len(mina)):
		mina[y] = str(mina[y])
	print(''.join(mina), maxa)


(m, s) = map(int, input().split())
num = ''
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
else:

	def f(x, y):
		global num
		if x > 1:
			if y == 0:
				return num + '0' * x
			elif y < 9:
				num += str(y)
				y = 0
			else:
				num += '9'
				y -= 9
			return f(x - 1, y)
		elif x == 1:
			return num + str(y)
	b = f(m, s)
	a = b[::-1]
	if a[0] == '0' and m > 1:
		c = list(a)
		c[0] = '1'
		for i in range(1, m):
			if c[i] != '0':
				c[i] = str(int(c[i]) - 1)
				break
		a = ''.join(c)
	print(a, b)


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print('0 0')
elif s == 0 or 9 * n < s:
	print('-1 -1')
elif n == 1:
	print(s, s)
else:
	p = s
	h = ''
	for i in range(n):
		if p >= 9:
			h += '9'
			p -= 9
		else:
			h += str(p)
			p -= p
	q = s
	l = ''
	for i in range(n):
		if q > 9:
			l = '9' + l
			q -= 9
		elif i != n - 1 and q <= 9:
			l = str(q - 1) + l
			q = 1
		elif i != n - 1 and q == 1:
			l = str(0) + l
		elif i == n - 1 and q <= 9:
			l = str(q) + l
	print(int(l), int(h))


def is_possible(count, sum):
	return (sum != 0 or count <= 1) and 9 * count >= sum

def get_min(count, sum):
	if 9 * count == sum:
		return '{}'.format('9' * count)
	elif (sum - 1) % 9 == 0:
		nine_count = (sum - 1) // 9
		zero_count = count - 1 - nine_count
		return '1{}{}'.format('0' * zero_count, '9' * nine_count)
	elif sum <= 9 * count - 8:
		nine_count = (sum - 1) // 9
		num = (sum - 1) % 9
		zero_count = count - 2 - nine_count
		return '1{}{}{}'.format('0' * zero_count, num, '9' * nine_count)
	else:
		nine_count = count - 1
		num = sum % 9
		return '{}{}'.format(num, '9' * nine_count)

def get_max(count, sum):
	if 9 * count == sum:
		return '{}'.format('9' * count)
	else:
		nine_count = sum // 9
		num = sum % 9
		zero_count = count - 1 - nine_count
		return '{}{}{}'.format('9' * nine_count, num, '0' * zero_count)

def solve(count, sum):
	if sum == 0 and count == 1:
		print('0 0')
	elif is_possible(count, sum):
		print(get_min(count, sum), get_max(count, sum))
	else:
		print('-1 -1')
(count, sum) = map(int, input().split())
solve(count, sum)


(m, s) = map(int, input().split())
if m is 1 and s is 0:
	print(0, 0)
	exit()
if s not in range(1, 9 * m + 1):
	print(-1, -1)
	exit()
digits = s // 9
rem = True if s % 9 else False
largest = ''
for i in range(m):
	if i < digits:
		largest += '9'
	elif rem:
		largest += str(s % 9)
		rem = False
	else:
		largest += '0'
smallest = [0] * m
smallest[0] = 1
s -= 1
digits = s // 9
for i in range(digits):
	smallest[m - i - 1] = 9
smallest[m - i - 2] += s % 9
smallest = [str(x) for x in smallest]
smallest = ''.join(smallest)
print(smallest, largest)


dp = [[-1 for _ in range(110)] for _ in range(1000)]

def solve(ll, ss, ind=0):
	if ind == ll - 1:
		if ss == 0 or ss > 9:
			return (-1, -1)
		else:
			return (ss, ss)
	if dp[ss][ind] != -1:
		return dp[ss][ind]
	res_min = []
	res_max = []
	for i in range(10):
		if ss >= i:
			temp = solve(ll, ss - i, ind + 1)
			if temp[0] != -1:
				res_min.append(temp[0] * 10 + i)
				res_max.append(temp[1] * 10 + i)
	dp[ss][ind] = (min(res_min), max(res_max)) if len(res_min) > 0 else (-1, -1)
	return dp[ss][ind]
(ll, ss) = map(int, input().split())
if ll == 1 and ss == 0:
	res = (0, 0)
else:
	res = solve(ll, ss)
print(res[0], res[1])


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	print(10 ** (m - 1) + sum((10 ** (i // 9) for i in range(s - 1))), sum((10 ** (m - 1 - i // 9) for i in range(s))))


import sys
ms = input()
(m, s) = map(int, ms.split())
if s == 0 and m != 1 or s > m * 9:
	print('-1 -1')
	sys.exit(0)
sum = s
for i in range(m):
	x = max(sum - (m - 1 - i) * 9, 0)
	if x == 0 and i == 0 and (m != 1):
		x = 1
	print(x, end='')
	sum -= x
print(' ', end='')
sum = s
for i in range(m):
	x = min(sum, 9)
	print(x, end='')
	sum -= x


def largest(m, s):
	res = []
	for _ in range(m):
		if s == 0:
			res.append('0')
		elif s < 10:
			res.append(str(s))
			s = 0
		else:
			res.append('9')
			s -= 9
	return ''.join(res)
from collections import deque

def smallest(m, s):
	deq = deque()
	while s != 0:
		if s < 10:
			deq.append(str(s))
			s = 0
		else:
			deq.append(str('9'))
			s -= 9
	res = ['0'] * (m - len(deq))
	if res and res[0] == '0':
		res[0] = '1'
		val = str(int(deq.pop()) - 1)
		res.append(val)
	while deq:
		res.append(deq.pop())
	return ''.join(res)
(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and m != 1):
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	print(smallest(m, s), largest(m, s))


g = input()
s = []
k = 0
q = ''
f = ''
r = ''
u = ''
s = list(map(int, g.split()))
su = s[1]
no = s[0]
if su != 0:
	k = su // 9
	r = su % 9
	if r != 0:
		t = '9' * k + chr(48 + r) + '0' * (no - (k + 1))
	else:
		t = '9' * k + '0' * (no - k)
	for i in range(0, no):
		q = q + t[no - i - 1]
	z = 1
	if q[0] == '0':
		while q[z] == '0':
			z += 1
		r = q[0:z]
		u = q[z + 1:len(q)]
		f = chr(ord(q[z]) - 1)
		q = r + f + u
		q = chr(ord(q[0]) + 1) + q[1:len(t)]
	if len(t) == no:
		print(q, t)
	else:
		print('-1 -1')
elif no > 1:
	print('-1 -1')
else:
	print('0 0')


(m, s) = map(int, input().split())
l = [1]
for i in range(m - 1):
	l.append(0)
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	x = s
	s -= 1
	for i in range(len(l) - 1, -1, -1):
		l[i] += min(9, s)
		s -= min(9, s)
	z = [0] * m
	for i in range(m):
		z[i] = min(9, x)
		x -= min(9, x)
	(a, b) = ('', '')
	for i in range(len(l)):
		a += str(l[i])
		b += str(z[i])
	print(a, b)


(m, s) = input().split()
m = int(m)
s = int(s)
s2 = s
min = ''
max = ''
if m > 1 and s == 0 or s > 9 * m:
	print('-1 -1')
else:
	while s >= 9:
		max += '9'
		s -= 9
	if s != 0:
		max += str(s)
	max += '0' * (m - len(max))
	while s2 > 9:
		min += '9'
		s2 -= 9
	if m - len(min) > 1:
		min += str(s2 - 1)
		min += '0' * (m - len(min) - 1)
		min += '1'
	else:
		min += str(s2)
	min = min[::-1]
	print(min, max)


x = input().split()
m = int(x[0])
s = int(x[1])
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif s > m * 9:
	print('-1 -1')
else:
	s1 = s
	maxlist = []
	for i in range(m):
		num = min(9, s1)
		maxlist.append(num)
		s1 -= num
	maxint = 0
	for i in range(len(maxlist)):
		maxint += maxlist[i] * 10 ** (len(maxlist) - 1 - i)
	if maxlist[len(maxlist) - 1] == 0:
		maxlist[len(maxlist) - 1] = 1
		for i in range(len(maxlist) - 2, -1, -1):
			if maxlist[i] != 0:
				maxlist[i] -= 1
				break
	minint = 0
	for i in range(len(maxlist)):
		minint += maxlist[i] * 10 ** i
	print(minint, maxint)


s = input()
l = s.split()
l = list(map(int, l))
raqam = l[0]
majmo = l[1]
if majmo == 0 and raqam == 1:
	print('0 0')
elif majmo < 1 or majmo > raqam * 9:
	print('-1 -1')
else:
	min = ''
	m = majmo - 1
	for i in range(0, raqam - 1):
		if m > 9:
			min = '9' + min
			m -= 9
		else:
			min = str(m) + min
			m = 0
	min = str(m + 1) + min
	max = ''
	m = majmo
	for i in range(0, raqam):
		if m > 9:
			max = max + '9'
			m -= 9
		else:
			max = max + str(m)
			m = 0
	print('%s %s' % (min, max))


import sys

def valid_capacity(num_digits, sum_digits):
	return 0 <= sum_digits <= 9 * num_digits

def lead_zero(i, digit):
	return i == 0 and digit == 0

def solve_scouter(num_digits, sum_digits):
	if num_digits > 1 and sum_digits == 0:
		print('-1 -1')
		return
	if num_digits == 1 and sum_digits == 0:
		print('0 0')
		return
	cur_sum = sum_digits
	smaller = ''
	for i in range(num_digits):
		for digit in range(10):
			if not lead_zero(i, digit) and valid_capacity(num_digits - i - 1, cur_sum - digit):
				smaller += f'{digit}'
				cur_sum -= digit
				break
	if cur_sum != 0:
		print('-1 -1')
		return
	cur_sum = sum_digits
	bigger = ''
	for i in range(num_digits):
		for digit in range(9, -1, -1):
			if not lead_zero(i, digit) and valid_capacity(num_digits - i - 1, cur_sum - digit):
				bigger += f'{digit}'
				cur_sum -= digit
				break
	if cur_sum != 0:
		print('-1 -1')
		return
	print(f'{smaller} {bigger}')

def solve(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	(n, s) = map(int, f.readline().split())
	solve_scouter(n, s)

def main():
	solve()
main()


(m, s) = map(int, input().split())
if s > 9 * m or (s < 1 and m > 1):
	print(-1, -1)
	exit()
index = m - 1
min_s = s
while index >= 0:
	pos = max(0, min_s - 9 * index)
	if index == m - 1 and min_s > 0 and (pos == 0):
		pos = 1
	print(pos, end='')
	index -= 1
	min_s -= pos
print(' ', end='')
index = m - 1
max_s = s
while index >= 0:
	val = min(9, max_s)
	print(val, end='')
	max_s -= val
	index -= 1


(m, s) = [int(i) for i in input().split()]
s0 = s
if m > 1 and s < 1 or s > m * 9:
	print(-1, -1)
	exit()
for i in range(1, m + 1):
	if i == 1 and s - 1 <= 9 * (m - 1) and (s != 0):
		print('1', end='')
		s -= 1
		continue
	temp = max(0, s - 9 * (m - i))
	print(temp, end='')
	s -= temp
s = s0
print(' ', end='')
for i in range(m):
	if s >= 10:
		s -= 9
		print('9', end='')
	elif 0 < s <= 9:
		print(s, end='')
		s = 0
	elif s == 0:
		print('0', end='')


(m, s) = map(int, input().split())
stmax = ''
stmin = ''
lst = []
stmin1 = ''
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
if s <= 9 * m:
	for i in range(0, m):
		x = min(9, s)
		stmax = stmax + str(x)
		s = s - x
	if s > 0:
		print('-1 -1')
	for i in range(m - 1, -1, -1):
		stmin = stmin + stmax[i]
	for ele in stmin:
		lst.append(int(ele))
	j = 0
	try:
		while lst[j] == 0:
			j += 1
		lst[0] += 1
		lst[j] -= 1
		for ele in lst:
			stmin1 = stmin1 + str(ele)
		print(stmin1, ' ', stmax)
	except:
		print()
else:
	print('-1 -1')


import math
(m, s) = [int(x) for x in input().split(' ')]
if m > 1 and s == 0 or 9 * m < s:
	print(-1, -1)
	exit()
if m == 1 and s == 0:
	print(0, 0)
	exit()
t = s
big = 0
for i in range(m - 1, -1, -1):
	z = min(t, 9)
	big += 10 ** i * z
	t -= z
t = s
small = 0
for i in range(0, m):
	z = min(t, 9)
	small += 10 ** i * z
	t -= z

def ld(n):
	if n < 10:
		return n
	else:
		return ld(n // 10)
if small < 10 ** (m - 1):
	small -= 1 * 10 ** (len(str(small)) - 1)
	small = 10 ** (m - 1) + small
print(small, big)


__author__ = '1'

def minimize(m, s):
	if m == 1 and s == 0:
		return 0
	if s == 0:
		return -1
	array = [0 for i in range(m)]
	array[0] = 1
	currentFiller = m - 1
	val = s - 1
	for i in range(s - 1):
		if array[currentFiller] < 9:
			array[currentFiller] += 1
			val -= 1
		else:
			currentFiller -= 1
			if currentFiller >= 0:
				array[currentFiller] += 1
				val -= 1
			else:
				break
	if val == 0:
		s = ''
		for i in range(len(array)):
			s += str(array[i])
		return s
	else:
		return -1

def maximizeS(m, s):
	array = []
	for i in range(10 ** m):
		summ = 0
		st = str(i)
		for j in range(len(st)):
			summ += ord(str(st[j])[0]) - ord('0')
		if summ == s:
			array.append(i)
	array = sorted(array)
	if len(array) == 0:
		return -1
	else:
		return array[-1]

def minimizeS(m, s):
	array = []
	for i in range(10 ** m):
		if len(str(i)) == m:
			summ = 0
			st = str(i)
			for j in range(len(st)):
				summ += ord(str(st[j])[0]) - ord('0')
			if summ == s:
				array.append(i)
	array = sorted(array)
	if len(array) == 0:
		return -1
	else:
		return array[0]

def maximize(m, s):
	if m == 1 and s == 0:
		return 0
	if s == 0:
		return -1
	array = [0 for i in range(m)]
	array[0] = 1
	currentFiller = 0
	val = s - 1
	for i in range(s - 1):
		if array[currentFiller] < 9:
			array[currentFiller] += 1
			val -= 1
		else:
			currentFiller += 1
			if currentFiller < m:
				array[currentFiller] += 1
				val -= 1
			else:
				break
	if val == 0:
		s = ''
		for i in range(len(array)):
			s += str(array[i])
		return s
	else:
		return -1
for m in range(1, 6):
	for s in range(6):
		pass
(m, s) = list(map(int, input().split(' ')))
a = minimize(m, s)
b = maximize(m, s)
print(a, b)


(p, q) = map(int, input().strip().split())
memo = {}
arr = []

def dp(m, s, o):
	if s <= m * 9 and s >= 0:
		if o == 0:
			for i in range(1, 10):
				if dp(m - 1, s - i, o + 1) == 1:
					arr.append(i)
					break
		else:
			for i in range(10):
				if dp(m - 1, s - i, o + 1) == 1:
					arr.append(i)
					break
		return 1
	else:
		return 0
arrl = []

def dpl(m, s, o):
	if s <= m * 9 and s >= 0:
		if o == 0:
			for i in range(9, 0, -1):
				if dpl(m - 1, s - i, o + 1) == 1:
					arrl.append(i)
					break
		else:
			for i in range(9, -1, -1):
				if dpl(m - 1, s - i, o + 1) == 1:
					arrl.append(i)
					break
		return 1
	else:
		return 0
dp(p, q, 0)
dpl(p, q, 0)
arr.reverse()
arrl.reverse()
if len(arr) == 0:
	if p == 1 and q == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	print(''.join(map(str, arr)) + ' ' + ''.join(map(str, arrl)))


q = str(input())
q = q.split()
m = int(q[0])
s = int(q[1])
if s == 0 and m != 1 or s > 9 * m:
	s = -1
s_ = s
L = []
if s != 0:
	L.append(1)
	for i in range(m - 1):
		L.append(0)
else:
	for i in range(m):
		L.append(0)
x = 1
while s_ > 1:
	d = L[len(L) - x]
	while s_ != 1 and d != 9:
		d += 1
		s_ -= 1
	L[len(L) - x] = d
	x += 1
mini = ''
for i in range(m):
	mini += str(L[i])
s_ = s
L = []
for i in range(m):
	L.append(0)
x = 0
while s_ > 0:
	d = L[x]
	while s_ != 0 and d != 9:
		d += 1
		s_ -= 1
	L[x] = d
	x += 1
maxi = ''
for i in range(m):
	maxi += str(L[i])
if s == -1:
	print('-1 -1')
else:
	print(mini + ' ' + maxi)


def func(m, s):
	ans = ''
	while m >= 1:
		if s >= 10:
			ans += '9'
			s -= 9
		else:
			ans += str(s)
			s = 0
		m -= 1
	return ans

def compute(m, s):
	(ans, c) = ('', 0)
	while m >= 1:
		digit = 0
		while 9 * (m - 1) < s - digit:
			digit += 1
		if digit == 0 and c == 0:
			ans += '1'
			s -= 1
		else:
			ans += str(digit)
			s -= digit
		c += 1
		m -= 1
	return ans
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif m == 1 and s >= 10:
	print('-1 -1')
elif m == 1 and s >= 0 and (s < 10):
	print(s, s)
elif m > 1 and s == 0:
	print('-1 -1')
elif 9 * m < s:
	print('-1 -1')
else:
	v1 = compute(m, s)
	if len(str(v1)) == m:
		v2 = func(m, s)
		if len(str(v2)) == m:
			print(v1, v2)
		else:
			print('-1 -1')
	else:
		print('-1 -1')


(d, sum) = map(int, input().split())
pus = sum
mxs = ''
for i in range(d):
	for j in range(9, -1, -1):
		if i == d - 1:
			if 0 <= sum <= 9:
				mxs += str(sum)
				break
		elif 0 <= (sum - j) / (d - i - 1) <= 9:
			mxs += str(j)
			sum -= j
			break
mns = ''
sum = pus
for i in range(d):
	if i == d - 1:
		if 0 <= sum <= 9:
			mns += str(sum)
	elif i == 0:
		for j in range(1, 10):
			if 0 <= (sum - j) / (d - i - 1) <= 9:
				mns += str(j)
				sum -= j
				break
	else:
		for j in range(10):
			if 0 <= (sum - j) / (d - i - 1) <= 9:
				mns += str(j)
				sum -= j
				break
if mxs.count('0') == d and d > 1:
	mxs = '-1'
if mns.count('0') == d and d > 1:
	mns = '-1'
print(mns if len(mns) == d else -1, mxs if len(mxs) == d else -1)


(m, s) = map(int, input().split())
f = [[0 for i in range(0, 1005)] for i in range(0, 2005)]
for i in range(0, m + 10):
	for j in range(0, s + 10):
		f[i][j] = -1

def dp(pos, sum):
	if sum > s:
		return 0
	if pos == m:
		return sum == s
	if f[pos][sum] != -1:
		tam = f[pos][sum]
		return tam
	res = 0
	for i in range(pos == 0 and m != 1, 10):
		res |= dp(pos + 1, sum + i)
	f[pos][sum] = res
	return res
dp(0, 0)
res1 = str('')
sum = 0
for i in range(1, m + 1):
	for j in range(i == 1 and m != 1, 10):
		if dp(i, sum + j):
			res1 = res1 + str(j)
			sum += j
			break
sum = 0
res2 = str('')
for i in range(1, m + 1):
	for j in range(9, -(i != 1 or m == 1), -1):
		if dp(i, sum + j):
			res2 = res2 + str(j)
			sum += j
			break
if len(res1) != m or len(res2) != m:
	print('-1 -1')
else:
	print(res1, res2)


N = input().split()
m = int(N[0])
s = int(N[1])
ans1 = []
ans = []
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or s / m > 9:
	print('-1 -1')
else:
	a = s
	for i in range(m + 1):
		a = a - 9
		if a < 0:
			b = i
			break
	c = s - b * 9
	for j in range(b):
		ans1.append('9')
	if c > 0:
		ans1.append(str(c))
		for k in range(m - b - 1):
			ans1.append('0')
	else:
		for l in range(m - b):
			ans1.append('0')
	ans.append(''.join(ans1))
	d = ans[0][::-1]
	for o in range(len(d)):
		if int(d[o]) > 0:
			e = o
			break
	print('%d %d' % (int(d) + 10 ** (len(d) - 1) - int(10 ** (len(d) - 1 - o)), int(ans[0])))


while True:
	try:

		def solution(m, s):
			if s == 0 and m == 1:
				print(0, 0)
			elif s == 0 or s > 9 * m:
				print('-1 -1')
			else:
				indx = [0] * 100
				indx[0] = 1
				ts = s - 1
				tlc = m - 1
				while ts > 0:
					while ts > 0 and indx[tlc] < 9:
						indx[tlc] += 1
						ts -= 1
					tlc -= 1
				ind = [0] * 100
				ind[0] = 1
				ts = s - 1
				tlc = 0
				while ts > 0:
					while ts > 0 and ind[tlc] < 9:
						ind[tlc] += 1
						ts -= 1
					tlc += 1
				snum = ''
				lnum = ''
				for i in range(m):
					snum += str(indx[i])
					lnum += str(ind[i])
				print(snum, lnum)

		def read():
			(m, s) = map(int, input().split())
			solution(m, s)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


S = list(map(int, input().split()))
m = S[0]
s = S[1]
s2 = S[1]
st = '-1 -1'
if m == 1:
	if s > 9:
		print(st)
	else:
		print(str(s) + ' ' + str(s))
elif s == 0:
	print(st)
elif s > 9 * m:
	print(st)
else:
	dp = [0 for i in range(m)]
	for i in range(m):
		allowed = None
		if i == 0:
			allowed = 1
		else:
			allowed = 0
		change = max(allowed, s - (m - i - 1) * 9)
		dp[i] = change
		s = s - change
	for i in dp:
		print(i, end='', sep='')
	print(' ', end='', sep='')
	s = s2
	for i in range(m):
		change = min(9, s)
		dp[i] = change
		s = s - change
	for i in dp:
		print(i, end='', sep='')


A = input().split()
m = int(A[0])
s = int(A[1])
if s == 0 and m == 1:
	print(0, 0)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	current = s
	big = [0] * m
	for i in range(0, m):
		if current <= 9:
			big[i] = current
			break
		else:
			big[i] = 9
			current = current - 9
	second = 0
	for i in range(0, m):
		second = 10 * second + big[i]
	current = s
	if s > 9 * (m - 1):
		small = [9] * m
		small[0] = s - 9 * (m - 1)
	else:
		small = [0] * m
		small[0] = 1
		current = current - 1
		for i in range(m - 1, 0, -1):
			if current <= 9:
				small[i] = current
				break
			else:
				small[i] = 9
				current = current - 9
	first = 0
	for i in range(0, m):
		first = 10 * first + small[i]
	print(first, second)


import sys
(m, s) = list(map(int, input().split()))
if m is 1 and s is 0:
	print('0 0')
	sys.exit()
if m * 9 < s or s is 0:
	print('-1 -1')
	sys.exit()
max_val = []
max_n = 9
temp_s = s
temp_m = m
sum_ = 0
while temp_m is not 0:
	if temp_s >= max_n:
		temp_s = temp_s - max_n
		max_val.append(str(max_n))
		temp_m = temp_m - 1
		sum_ = sum_ + max_n
	elif temp_s is 0:
		max_val.append(str(0))
		temp_m = temp_m - 1
	else:
		max_n = max_n - 1
min_val = [0 for i in range(0, m)]
last = m - 1
for i in range(0, s):
	if i is 0:
		min_val[i] = 1
	elif min_val[last] < 9:
		min_val[last] = min_val[last] + 1
	else:
		last = last - 1
		if last < 0:
			print('-1 -1')
			sys.exit()
		min_val[last] = min_val[last] + 1
min_val.sort()
if min_val[0] is 0:
	for i in range(1, len(min_val)):
		if min_val[i] is not 0:
			tmp = min_val[i]
			min_val[i] = 0
			min_val[0] = tmp
			break
print('%s %s' % (''.join((str(x) for x in min_val)), ''.join(max_val)))


(m, s) = map(int, input().split())
if s > m * 9 or (s == 0 and m != 1):
	print(-1, -1, sep=' ')
else:
	mx = []
	m_ = m
	while m:
		temp = min(9, s)
		s -= temp
		m -= 1
		mx.append(str(temp))
	mn = list(reversed(mx))
	if mn[0] == '0' and m_ != 1:
		i = 1
		while i <= m_:
			if int(mn[i]) > 0:
				mn[i] = str(int(mn[i]) - 1)
				mn[0] = '1'
				break
			else:
				i += 1
	mn = int(''.join(mn))
	mx = int(''.join(mx))
	print(mn, mx, sep=' ')


(m, s) = map(int, input().split())
if s == 0 and m != 1 or 9 * m < s:
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	x = ''
	t = s
	while t > 0:
		a = min(9, t)
		t -= a
		x += str(a)
	while len(x) < m:
		x += '0'
	t = s
	t -= 1
	y = ''
	while t > 0:
		a = min(9, t)
		t -= a
		y += str(a)
	while len(y) < m:
		y += '0'
	z = y[::-1]
	z = str(int(z[0]) + 1) + z[1:]
	print(int(z), int(x))


def find_max(num_of_digits, sum_of_digits):
	if sum_of_digits == 0:
		if num_of_digits == 1:
			return 0
		else:
			return -1
	if sum_of_digits > 9 * num_of_digits:
		return -1
	T = [[0 for i in range(sum_of_digits + 1)] for j in range(num_of_digits + 1)]
	for i in range(min(sum_of_digits + 1, 10)):
		T[1][i] = i
	for i in range(2, num_of_digits + 1):
		for s in range(1, sum_of_digits + 1):
			if s > 9:
				T[i][s] = T[i - 1][s - 9] + 9 * 10 ** (i - 1)
			else:
				T[i][s] = T[i - 1][0] + s * 10 ** (i - 1)
	return T[num_of_digits][sum_of_digits]

def find_min(num_of_digits, sum_of_digits):
	if sum_of_digits == 0:
		if num_of_digits == 1:
			return 0
		else:
			return -1
	if sum_of_digits > 9 * num_of_digits:
		return -1
	q = sum_of_digits // 9
	if sum_of_digits % 9 != 0:
		res = '9' * q
		rem = sum_of_digits % 9
		if num_of_digits - q > 1:
			res = '1' + '0' * (num_of_digits - q - 2) + str(rem - 1) + res
		else:
			res = str(rem) + res
	else:
		q = q - 1
		res = '9' * q
		rem = 9
		if num_of_digits - q > 1:
			res = '1' + '0' * (num_of_digits - q - 2) + str(rem - 1) + res
		else:
			res = str(rem) + res
	return res
(m, s) = map(int, input().split())
max_num = find_max(m, s)
min_num = find_min(m, s)
print(str(min_num) + ' ' + str(max_num))


(n, m) = list(map(int, input().split()))
l = []
f = 0
w = n
if m > 9 * n or (m == 0 and n != 1):
	print('-1 -1')
	f = 1
if m == 0 and n == 1:
	print('0 0')
	f = 1
while m > 0 or n > 0:
	if m <= 0 and n > 0:
		l.append('0' * n)
		break
	elif m - 9 <= 0:
		l.append(str(m))
	else:
		l.append('9')
	n = n - 1
	m = m - 9
if f == 0:
	t = ' '.join(l).split(' ')
	k = ' '.join(l).split(' ')
	t.sort()
	k.sort(reverse=True)
	if int('1' + '0' * (w - 1)) <= int(''.join(t)) <= int('9' * w):
		print(''.join(t) + ' ' + ''.join(k))
	elif len(t) > 2:
		print('1' + '0' * (n - 1) + str(int(t[1]) - 1) + ''.join(t[2:]) + ' ' + ''.join(k))
	else:
		print('1' + '0' * (n - 1) + str(int(t[1]) - 1) + ' ' + ''.join(k))


lensum = input().split()
(Len_max, Sum_max) = (int(lensum[0]), int(lensum[1]))
(Len_min, Sum_min) = (int(lensum[0]), int(lensum[1]))
max_output = ''
min_output = ''
if Sum_max == 0 and Len_max > 1 or Sum_max > 9 * Len_max:
	print('-1 -1')
else:
	for i in range(Len_max):
		max_output += str(min([9, Sum_max]))
		Sum_max -= min([9, Sum_max])
	min_output = max_output[::-1]
	if min_output[0] == '0':
		for i in range(Len_min - 1):
			if min_output[i + 1] == '0':
				continue
			min_output = '1' + min_output[1:i + 1] + str(int(min_output[i + 1]) - 1) + min_output[i + 2:]
			break
	print(min_output + ' ' + max_output)


[n, s] = [int(k) for k in input().split()]

def dp(n, s):
	if s <= 9:
		mini = '1'
		if n >= 2:
			for k in range(n - 2):
				mini = mini + '0'
			mini = mini + str(s - 1)
		else:
			mini = str(s)
		maxi = str(s)
		for i in range(n - 1):
			maxi = maxi + '0'
		return [mini, maxi]
	else:
		L = dp(n - 1, s - 9)
		return [L[0] + '9', '9' + L[1]]
if s == 0 and n > 1 or s > 9 * n:
	print('-1 -1')
else:
	print(dp(n, s)[0], dp(n, s)[1])


(m, s) = [int(i) for i in input().split()]
output1 = ''
output2 = ''
if s == 0:
	if m != 1:
		print('-1 -1')
	elif m == 1:
		print('0 0')
elif m * 9 < s:
	print('-1 -1')
elif s <= 9:
	if m == 1:
		output1 += str(s)
		output2 += str(s)
		print(output2, output1)
	elif m != 1:
		output1 += str(s)
		output2 += '1'
		while len(output1) < m:
			output1 += '0'
		while len(output2) < m - 1:
			output2 += '0'
		q = s - 1
		output2 += str(q)
		print(output2, output1)
elif s > 9:
	output1 += '9'
	w = s - 9
	while w > 9:
		output1 += '9'
		w += -9
	output1 += str(w)
	if len(output1) == m:
		output2 = output1[::-1]
	elif len(output1) < m:
		shengyu = m - len(output1)
		output2 += '1'
		while len(output2) < shengyu:
			output2 += '0'
		if w == 0:
			output2 += '08'
		elif w != 0:
			output2 += str(w - 1)
		while len(output2) < m:
			output2 += '9'
	while len(output1) < m:
		output1 += '0'
	print(output2, output1)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(n, s) = gil()
if s == 0 and n == 1:
	print(0, 0)
elif s == 0 or 9 * n < s:
	print(-1, -1)
else:
	s -= 1
	mini = [0] * n
	maxi = [0] * n
	mini[0] = maxi[0] = 1
	r = s
	for i in range(n):
		d = min(r, 9 - maxi[i])
		maxi[i] += d
		maxi[i] = str(maxi[i])
		r -= d
	r = s
	for i in reversed(range(n)):
		d = min(r, 9 - mini[i])
		mini[i] += d
		mini[i] = str(mini[i])
		r -= d
	print(''.join(mini), ''.join(maxi))


(m, s) = input().split(' ')
m = int(m)
s = int(s)
if s == 0 and m != 1 or s > m * 9:
	print('-1 -1')
elif m == 1:
	print(s, end=' ')
	print(s)
elif s == m * 9:
	A = [9 for i in range(m)]
	for i in range(0, m):
		A[i] = str(A[i])
	B = ''.join(A)
	c = int(B)
	print(c, end=' ')
	print(c)
else:
	L = [0 for i in range(m)]
	a = s // 9
	b = s % 9
	c = 0
	d = 0
	for i in range(0, a):
		L[i] = 9
	L[a] = b
	J = L[:]
	for i in range(0, m):
		L[i] = str(L[i])
	H = ''.join(L)
	c = int(H)
	J.reverse()
	if J.count(0) != 0:
		J[0] = 1
		if J[m - a - 1] == 0:
			J[m - a] = 8
		else:
			J[m - a - 1] = J[m - a - 1] - 1
	for i in range(0, m):
		J[i] = str(J[i])
	I = ''.join(J)
	d = int(I)
	print(d, end=' ')
	print(c)


(m, s) = [int(i) for i in input().split()]
smallestnum = int('1' + '0' * (m - 1))
if m == 1:
	smallestnum = 0
bigestnum = int('9' * m)
smallnum = smallestnum
bignum = bigestnum
ninesum = s - 1
if m == 1:
	ninesum = s
nines = []
while True:
	if ninesum < 0:
		smallnum = -1
		break
	if ninesum == 0:
		break
	if ninesum < 9:
		nines.append(ninesum)
		break
	else:
		nines.append(9)
		ninesum -= 9
flag = 0
if len(nines) > 0:
	smallstring = list(str(smallnum))
	for i in range(len(nines)):
		try:
			smallstring[-(i + 1)] = str(int(smallstring[-(i + 1)]) + nines[i])
		except:
			smallnum = -1
			flag = 1
			break
	if flag == 0:
		smallout = ''
		for i in smallstring:
			smallout += i
		smallnum = int(smallout)
ninesum = 0
for i in str(bigestnum):
	ninesum += int(i)
ninesum = ninesum - s
nines = []
while True:
	if ninesum < 0:
		bignum = -1
		break
	if ninesum == 0:
		break
	if ninesum < 9:
		nines.append(ninesum)
		break
	else:
		nines.append(9)
		ninesum -= 9
flag = 0
if len(nines) > 0:
	bigstring = list(str(bignum))
	for i in range(len(nines)):
		try:
			bigstring[-(i + 1)] = str(int(bigstring[-(i + 1)]) - nines[i])
		except:
			bignum = -1
			flag = 1
			break
	if flag == 0:
		bigout = ''
		for i in bigstring:
			bigout += i
		bignum = int(bigout)
if bignum < smallestnum:
	bignum = -1
if smallnum > bigestnum:
	smallnum = -1
print(smallnum, bignum)


(n, m) = [int(x) for x in input().split()]
if n == 1 and m == 0:
	print(0, 0)
elif m < 1 or m > 9 * n:
	print(-1, -1)
elif n == 1:
	print(m, m)
elif n * 9 == m:
	print('9' * n, '9' * n)
else:
	t = m // 9
	k = m % 9
	k2 = k - 1
	k = str(k)
	k2 = str(k2)
	l = n - t - 1
	if l > 0:
		if k == '0':
			print('1' + '0' * l + '8' + '9' * (t - 1), '9' * t + k + '0' * l)
		else:
			print('1' + '0' * (l - 1) + k2 + '9' * t, '9' * t + k + '0' * l)
	else:
		print(k + '9' * t, '9' * t + k + '0' * l)


(a, b) = [int(i) for i in input().split()]
if a == 1 and b < 10:
	print('%d %d' % (b, b))
elif b == 0:
	print('-1 -1')
elif b > 9 * a:
	print('-1 -1')
else:
	x = int(b / 9)
	y = b % 9
	if a == x + 1 and y != 0:
		print(str(y) + '9' * x, '9' * x + str(y))
	elif x == a and y == 0:
		print('9' * x, '9' * x)
	elif y == 0:
		print('1' + '0' * (a - 1 - x) + '8' + '9' * (x - 1), '9' * x + '0' * (a - x))
	else:
		print('1' + '0' * (a - 2 - x) + '%d' % (y - 1) + '9' * x, '9' * x + '%d' % y + '0' * (a - 1 - x))


(length, n_sum) = [int(x) for x in input().split()]
if length > 1 and n_sum == 0:
	print('-1  -1')
	exit()
if n_sum == 0:
	print('0 0')
	exit()
maxes = []
zeros_count = 0
for i in range(0, length):
	max_value = min(n_sum, 9)
	n_sum -= max_value
	maxes.append(str(max_value))
	if max_value == 0:
		zeros_count += 1
if n_sum > 0:
	print('-1  -1')
	exit()
max_str = ''.join(maxes)
mins = [max_str[length - zeros_count - 1]]
mins.extend(['0'] * zeros_count)
for i in range(length - zeros_count - 2, -1, -1):
	mins.append(max_str[i])
if zeros_count > 0:
	a = int(mins[0]) - 1
	mins[0] = '1'
	for i in range(length - 1, -1, -1):
		b = int(mins[i])
		if b + a < 10:
			mins[i] = str(b + a)
			break
min_str = ''.join(mins)
print(min_str, max_str)


def getMax(length, sm):
	if length == 1 and sm == 0:
		return '0'
	elif length == 0 or sm == 0:
		return '-1'
	result = ''
	for i in range(0, length):
		add = min(sm, 9)
		result += str(add)
		sm -= add
	if sm > 0:
		return '-1'
	return result

def getMin(length, sm):
	if length == 1 and sm == 0:
		return '0'
	elif length == 0 or sm == 0:
		return '-1'
	result = ''
	for i in range(0, length):
		if i == length - 1:
			add = min(sm, 9)
		else:
			add = min(sm - 1, 9)
		result = str(add) + result
		sm -= add
	if sm > 0:
		return '-1'
	return result
(m, s) = input().split()
length = int(m)
sm = int(s)
print(getMin(length, sm), getMax(length, sm))


(length, sum) = map(int, input().split())
if sum > 9 * length:
	print('-1 -1')
elif sum == 0:
	if length == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	Max = str(sum) + '0' * (length - 1)
	for i in range(1, length):
		if sum > 9 * i:
			other = sum - 9 * i
			Max = '9' * i + str(other) + '0' * (length - i - 1)
	Min = '1' + '0' * (length - 2) + str(sum - 1)
	for i in range(1, length):
		if sum >= 1 + 9 * i:
			other = sum - 9 * i - 1
			if length >= 3:
				Min = '1' + '0' * (length - i - 2) + str(other) + '9' * i
			if length < i + 2:
				other = sum - 9 * i
				Min = str(other) + '9' * i
	if length == 2 and sum < 9:
		Min = '1' + str(sum - 1)
	if length == 1:
		Min = str(sum)
	print(Min, Max, sep=' ')


inp = input()
chars = inp.split()
m = int(chars[0])
s = int(chars[1])
if s == 0 and m == 1:
	print('0 0')
	exit()
if s < 1 or s > 9 * m:
	print('-1 -1')
	exit()
if s > 9 * (m - 1):
	x = s - 9 * (m - 1)
	a = x
	for i in range(m - 1):
		a = a * 10 + 9
else:
	a = 10 ** (m - 1)
	s1 = s - 1
	pow1 = 1
	for i in range(m - 1):
		if s1 >= 9:
			x = 9
			s1 = s1 - x
		else:
			x = s1
			s1 = 0
		a = a + x * pow1
		pow1 = pow1 * 10
s1 = s
if s1 <= 9:
	b = s1 * 10 ** (m - 1)
else:
	b = 9
	s1 = s1 - 9
	for i in range(m - 1):
		if s1 <= 9:
			x = s1
			s1 = 0
		else:
			x = 9
			s1 = s1 - x
		b = b * 10 + x
print(a, b)


(m, s) = map(int, input().split(' '))
(smll, lrg) = (0, 0)
if s == 0 and m == 1:
	(smll, lrg) = (0, 0)
elif s > m * 9 or (s == 0 and m != 0):
	(smll, lrg) = (-1, -1)
else:
	s1 = s
	smll = ''
	nines = 0
	while s1 > 9:
		smll += '9'
		nines += 1
		s1 -= 9
	smll += str(s1)
	smll += '0' * (m - len(smll))
	lrg = smll[::-1]
	if lrg[0] == '0':
		lrg = lrg[0:m - nines - 1] + chr(ord(lrg[m - nines - 1]) - 1) + lrg[m - nines:]
		lrg = '1' + lrg[1:]
print(lrg, ' ', smll)


(m, s) = map(int, input().split())

def g(s):
	a = ''
	for i in range(m):
		v = min(9, s)
		a += str(v)
		s -= v
	return a
a = g(s)
if s < 1:
	print(-(m > 1), -(m > 1))
elif 9 * m < s:
	print(-1, -1)
else:
	print(a[::-1] if a[-1] > '0' else '1' + g(s - 1)[-2::-1], a)


def min_num(m, s):
	unit = 1
	acum = 0
	num = 0
	for i in range(m):
		dig = 9
		if i + 1 < m:
			while dig + acum >= s and dig >= 0:
				dig -= 1
		else:
			while dig + acum > s and dig >= 0:
				dig -= 1
		acum += dig
		num += dig * unit
		unit *= 10
	if acum != s or (s == 0 and m > 1):
		return -1
	else:
		return num

def max_num(m, s):
	num = ''
	for i in range(m):
		low = min(9, s)
		num += str(low)
		s -= low
	return num

def main():
	(m, s) = [int(i) for i in input().split()]
	min = str(min_num(m, s))
	if min == '-1':
		print('-1 -1')
	else:
		print(str(min) + ' ' + max_num(m, s))
main()


(n, m) = map(int, input().split())
if m == 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
	quit()
if n * 9 < m:
	print(-1, -1)
	quit()
mm = m - 1
d = 0
num_min = 10 ** (n - 1)
while mm > 9:
	num_min += 9 * 10 ** d
	d += 1
	mm -= 9
num_min += mm * 10 ** d
num_max = int('9' + '0' * (n - 1))
m -= 9
d = n - 2
while m > 0:
	num_max += 9 * 10 ** d
	d -= 1
	m -= 9
num_max += m * 10 ** (d + 1)
print(num_min, num_max)


a = input().split()
if int(a[0]) * 9 < int(a[1]):
	print('%d %d' % (-1, -1))
elif int(a[1]) == 0 and int(a[0]) != 1:
	print('%d %d' % (-1, -1))
elif int(a[1]) == 0 and int(a[0]) == 1:
	print('%d %d' % (0, 0))
else:
	d = ['0' for i in range(int(a[0]))]
	b = int(a[1]) // 9
	c = int(a[1]) % 9
	for i in range(0, b):
		d[i] = str(9)
	if c != 0:
		d[b] = str(c)
	f = ''.join(d)
	g = ['0' for i in range(int(a[0]))]
	j = int(a[1]) - 1
	k = j // 9
	l = j % 9
	if k < int(a[0]) - 1:
		for i in range(int(a[0]) - k, int(a[0])):
			g[i] = str(9)
		g[0] = str(1)
		g[int(a[0]) - k - 1] = str(l)
	else:
		for i in range(int(a[0]) - k, int(a[0])):
			g[i] = str(9)
		g[0] = str(l + 1)
	m = ''.join(g)
	print('%s %s' % (m, f))


(m, s) = map(int, input().split())
min_num = [0] * m
if s == 0 and m == 1:
	print('0 0')
	exit(0)
if s == 0 or s > m * 9:
	print('-1 -1')
	exit(0)
ci = len(min_num) - 1
s1 = s
while s > 0:
	a = min(9, s)
	s -= a
	min_num[ci] = a
	ci -= 1
if min_num[0] == 0:
	min_num[0] = 1
	for i in range(1, len(min_num)):
		if min_num[i] > 0:
			min_num[i] -= 1
			break
max_num = [0] * m
ci = 0
while s1 > 0:
	a = 9 if s1 >= 9 else s1
	s1 -= a
	max_num[ci] = a
	ci += 1
print(''.join(map(str, min_num)), ''.join(map(str, max_num)))


import sys

def find_largest(m, s):
	ts = s
	ds = [0 for i in range(m)]
	for i in range(m):
		ds[i] = str(min(ts, 9))
		ts -= min(ts, 9)
	if ts > 0:
		return -1
	else:
		d = ''.join(ds)
		return int(d)

def find_smallest(m, s):
	ts = s - 1
	ds = [0 for i in range(m)]
	ds[0] = '1'
	for i in range(m):
		ds[i] = str(min(ts, 9))
		ts -= min(ts, 9)
	if ts > 0 or int(ds[-1]) > 8:
		return -1
	else:
		ds[-1] = str(int(ds[-1]) + 1)
	d = ''.join(ds[::-1])
	return int(d)

def solve(m, s):
	if s == 0 and m == 1:
		return (0, 0)
	if s == 0 and m > 1:
		return (-1, -1)
	largest = find_largest(m, s)
	smallest = find_smallest(m, s)
	return (smallest, largest)
inputs = []
for line in sys.stdin:
	inputs.append(line.strip())
(m, s) = map(int, inputs[0].split())
(x, y) = solve(m, s)
sys.stdout.write('{} {}\n'.format(x, y))


(m, s) = [int(i) for i in input().split()]
k = ['1'] + ['0'] * (m - 1)
k1 = ['0'] * m
s1 = s
flag = 0
if m == 1 and s == 0:
	flag = 1
	print('0 0')
if (m * 9 < s or s == 0) and flag == 0:
	flag = 1
	print('-1 -1')
else:
	for i in range(m - 1):
		ind = m - 1 - i
		j = 9
		while s1 > 1:
			if s1 - j >= 1:
				s1 = s1 - j
				k[ind] = str(j)
				break
			j = j - 1
	if s1 > 1:
		k[0] = str(s1)
	for i in range(m):
		j = 9
		while s > 0:
			if s - j >= 0:
				s = s - j
				k1[i] = str(j)
				break
			j = j - 1
if flag == 0:
	print(''.join(k), ''.join(k1))


a = list(map(int, input().split()))
m = a[0]
s = a[1]

def f(m, s):
	MAX = ''
	for i in range(0, m):
		t = min(9, s)
		MAX += str(t)
		s -= t
	return MAX

def g(m, s):
	MIN = ''
	for k in range(1, 10):
		if k + 9 * (m - 1) >= s:
			MIN += str(k)
			break
	b = f(m - 1, s - k)
	MIN += b[::-1]
	return MIN
if m == 1 and s == 0:
	print('0 0')
elif m < 0 or s > 9 * m or s < 1:
	print('-1 -1')
else:
	MAX = f(m, s)
	MIN = g(m, s)
	print(MIN + ' ' + MAX)


(m, s) = [int(x) for x in input().split()]
n = [0, 0]
l = []
if s > 9 * m or s < 0 or (s == 0 and m > 1):
	n = [-1, -1]
elif s == 0 and m == 1:
	n = [0, 0]
else:
	for i in range(0, m):
		a = int(min(s, 9))
		l.append(a)
		s = s - a
		n[0] = n[0] * 10 + a
	d = 0
	e = 0
	for i in range(len(l) - 1, -1, -1):
		if l[m - 1] == 0 and d == 0:
			n[1] = 1
			d = 1
			e = 1
		elif l[i] != 0 and e == 1:
			n[1] = n[1] * 10 + l[i] - 1
			e = 0
		else:
			n[1] = n[1] * 10 + l[i]
print(n[1], '', n[0])


(m, s) = [int(x) for x in input().split()]

def can(m, s):
	return s >= 0 and s <= 9 * m
res1 = []
sumi = s
for i in range(0, m):
	for j in range(0, 10):
		if (i > 0 or j > 0 or (m == 1 and j == 0)) and can(m - i - 1, sumi - j):
			res1.append(j)
			sumi -= j
			break
if s == 0 and m > 1:
	print(-1, -1)
elif len(res1) == m:
	print(*res1, sep='', end=' ')
	res1 = []
	sumi = s
	for i in range(0, m):
		for j in range(9, -1, -1):
			if (i > 0 or j > 0 or (m == 1 and j == 0)) and can(m - i - 1, sumi - j):
				res1.append(j)
				sumi -= j
				break
	print(*res1, sep='')
else:
	print(-1, -1)


import sys
(m, s) = [int(i) for i in input().split(' ')]
son1 = []
son2 = []
s1 = s
s2 = s
for i in range(m):
	son1.append(0)
	son2.append(0)
if s1 > 0:
	son1[0] = 1
	s1 -= 1
for i in range(m):
	if s1 > 9:
		if son1[m - i - 1] + 9 < 10:
			son1[m - i - 1] += 9
			s1 -= 9
	elif son1[m - i - 1] + s1 < 10:
		son1[m - i - 1] += s1
		s1 = 0
	if s2 > 9:
		if son2[i] + 9 < 10:
			son2[i] += 9
			s2 -= 9
	elif son2[i] + s2 < 10:
		son2[i] += s2
		s2 = 0
if s1 == 0 and (son1[0] > 0 or m == 1):
	for i in son1:
		print(i, end='')
else:
	print(-1, end='')
print(' ', end='')
if s2 == 0 and (son2[0] > 0 or m == 1):
	for i in son2:
		print(i, end='')
else:
	print(-1, end='')


z = input().split()
m = int(z[0])
n = int(z[1])
la = []
li = []
k = int(n / 9)
if m > 1 and n == 0 or n > 9 * m:
	print('-1 -1')
	quit()
else:
	for i in range(k):
		la.append('9')
	if k != m:
		s = n - 9 * k
		la.append(str(s))
	t = m - k - 1
	for i in range(t):
		la.append('0')
	ma = ''.join(la)
	k = int((n - 1) / 9)
	if m - k == 1:
		s = n - 9 * k
		li.append(str(s))
	else:
		s = n - 9 * k - 1
		li.append('1')
		t = m - k - 2
		for i in range(t):
			li.append('0')
		li.append(str(s))
	for i in range(k):
		li.append('9')
	mi = ''.join(li)
	print(mi + ' ' + ma)


(a, b) = map(int, input().split())
c = [0] * a
n = [0] * a
n[0] = 1
c[0] = 1
e = 0
f = a - 1
while 1:
	d = 0
	for i in range(len(n)):
		d += n[i]
	if d == b:
		break
	n[f] += 1
	if n[f] == 9:
		f -= 1
	if f == -1:
		break
while 1:
	d = 0
	for i in range(len(c)):
		d += c[i]
	if d == b:
		l = 1
		break
	c[e] += 1
	if c[e] == 9:
		e += 1
	if e == a:
		break
if b / a == 9:
	s = '9' * a
	print(s, s)
elif a == 1 and b == 0:
	print('0 0')
elif b > a * 9 or b == 0:
	print('-1 -1')
else:
	print(*n, ' ', *c, sep='')


(m, n) = (int(i) for i in input().split())
if n == 0 and m != 1 or m * 9 < n:
	print(-1, -1)
elif n // 9 == m:
	print('9' * m, '9' * m)
else:
	m1 = m
	m1 -= n // 9
	m1 -= 1
	maxim = '9' * (n // 9) + str(n % 9) + '0' * m1
	if m1 == 0:
		minim = str(n % 9) + '9' * (n // 9)
	else:
		n -= 1
		m1 = m
		m1 -= n // 9
		m1 -= 2
		minim = '1' + '0' * m1 + str(n % 9) + '9' * (n // 9)
	print(minim, maxim)


L = input().split()
m = int(L[0])
n = int(L[1])

def mi(a, b):
	c = [0 for j in range(0, a)]
	for i in range(0, a):
		if b > 9:
			c[a - 1 - i] = 9
			b = b - 9
		else:
			if i == a - 1:
				c[0] = b
			else:
				c[0] = 1
				c[a - 1 - i] = b - 1
			break
	return c

def ma(a, b):
	c = [0 for j in range(0, a)]
	for i in range(0, a):
		if b > 9:
			c[i] = 9
			b = b - 9
		else:
			c[i] = b
			b = 0
			break
	return c
if m == 1 and n == 0:
	print('0 0')
elif 9 * m < n or n <= 0:
	print('-1 -1')
else:
	s = ''.join((str(i) for i in mi(m, n)))
	t = ''.join((str(i) for i in ma(m, n)))
	print(int(s), int(t))


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


import math
import itertools
gh = lambda : map(int, input().split())
mod = 998244353
mod = int(mod)

def can(m, s):
	return 9 * m >= s and s >= 0

def main():
	(m, s) = gh()
	if m == 1 and s == 0:
		print('0 0')
		return
	t = s // 9
	mx = ''
	for i in range(t):
		mx += '9'
	if len(mx) < m:
		mx += str(s % 9)
	while len(mx) < m:
		mx += '0'
	mn = ''
	for i in range(1, m + 1):
		for j in range(10):
			if j == 0 and i > 1 or j > 0:
				if can(m - i, s - j):
					mn += str(j)
					s -= j
					break
	if len(mn) < m or len(mx) < m:
		print(-1, -1)
		return
	print(mn, mx)
main()


import collections
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def solve():
	(m, s) = map(int, input().split(' '))
	if s > 9 * m:
		print('-1 -1')
		return
	if s == 0:
		if m > 1:
			print('-1 -1')
			return
		else:
			print('0 0')
			return
	lo = [0 for i in range(m)]
	lo[0] = 1
	(sm, curr) = (1, m - 1)
	while curr >= 1 and sm < s:
		left = s - sm
		if left >= 9:
			lo[curr] = 9
			sm += 9
			curr -= 1
		else:
			lo[curr] = left
			sm += left
			break
	if sm < s:
		left = s - (sm - 1)
		lo[0] = left
	mini = ''.join(list(map(str, lo)))
	hi = [0 for i in range(m)]
	if s <= 9:
		hi[0] = s
		maxi = ''.join(list(map(str, hi)))
		print(mini, maxi)
		return
	hi[0] = 9
	(sm, curr) = (9, 1)
	while curr < m and sm < s:
		left = s - sm
		if left > 9:
			hi[curr] = 9
			curr += 1
			sm += 9
		else:
			hi[curr] = left
			sm += left
			break
	maxi = ''.join(list(map(str, hi)))
	print(mini, maxi)
t = 1
for _ in range(t):
	solve()


(m, s) = [int(x) for x in input().split()]
if m == 1 and s == 0:
	print(0, 0)
elif s > 9 * m or (s == 0 and m != 0):
	print(-1, -1)
else:
	a = ''
	wei = s // 9
	for i in range(wei):
		a = a + '9'
	if s % 9 != 0:
		a = a + str(s % 9)
	if len(a) < m:
		a = a + '0' * (m - len(a))
	elif len(a) > m:
		a = a[:len(a) - m]
	b = a[::-1]
	if b[0] == '0':
		b = '1' + b[1:]
		count = 0
		for i in range(1, len(a)):
			if count == 0:
				if b[i] != '0':
					count += 1
					b = b[0:i] + str(int(b[i]) - 1) + b[i + 1:]
	print(b, a)


(m, n) = map(int, input().strip().split())
if n > 9 * m:
	print('-1 -1')
elif m == 1:
	print(n, n)
elif n == 0:
	print(-1, -1)
elif n == 9 * m:
	print('9' * m, '9' * m)
elif n > (m - 1) * 9:
	print(str(n % 9) + '9' * (m - 1), '9' * (m - 1) + str(n % 9))
else:
	print('1' + '0' * (m - (n - 1) // 9 - 2) + str((n - 1) % 9) + '9' * ((n - 1) // 9), '9' * (n // 9) + str(n % 9) + '0' * (m - n // 9 - 1))


(m, s) = map(int, input().split())
a = [0 for i in range(m)]
b = [0 for i in range(m)]
s1 = s
if m * 9 < s or (m > 1 and s == 0):
	print('-1 -1')
else:
	t = 0
	while t < m and s > 0:
		if (m - t - 1) * 9 >= s:
			if t == 0:
				a[t] = 1
				t += 1
				s = s - 1
			else:
				a[t] = 0
				t += 1
		elif s % 9 == 0:
			a[t] = 9
			s = s - 9
			t += 1
		else:
			a[t] = s % 9
			s = s - s % 9
			t += 1
	for i in range(m - 1):
		print(a[i], end='')
	print(a[m - 1], end=' ')
	t = 0
	s = s1
	while t < m and s >= 0:
		if s >= 9:
			b[t] = 9
			t += 1
			s = s - 9
		elif s < 9:
			b[t] = s
			t += 1
			s = 0
		elif s == 0:
			b[t] = 0
			t += 1
	for i in range(m):
		print(b[i], end='')


(m, s) = [int(i) for i in input().split()]
maxx = ''
minn = []
s1 = s
s2 = s
for i in range(m):
	if s > 9:
		maxx += '9'
		s -= 9
	else:
		maxx += str(s)
		s = 0
	if s1 > 9:
		minn.insert(0, '9')
		s1 -= 9
	else:
		minn.insert(0, str(s1))
		s1 = 0
if minn[0] == '0':
	for i in range(1, len(minn)):
		if int(minn[i]) > 0:
			minn[i] = str(int(minn[i]) - 1)
			minn[0] = '1'
			break
if s > m * 9 or s != 0:
	maxx = -1
	minn = ['-1']
if maxx == '0' * m:
	maxx = -1
if ''.join(minn) == '0' * m:
	minn = ['-1']
if s2 == 0 and m == 1:
	minn = ['0']
	maxx = 0
print(''.join(minn), maxx)


(m, s) = map(int, input().split())
if m * 9 < s:
	print('-1 -1')
	exit()
if s == 0 and m != 1:
	print('-1 -1')
	exit()
k = s
max = []
for i in range(m):
	if s < 10:
		max.append(s)
		s = 0
	else:
		max.append(9)
		s -= 9
min = []
for i in range(m):
	if m == 1:
		min.append(k)
		break
	if 9 * (m - i - 1) < k:
		temp = 9 * (m - i - 1)
		min.append(k - temp)
		k = temp
	elif i == 0:
		min.append(1)
		k -= 1
	else:
		min.append(0)
print(''.join(map(str, min)), end=' ')
print(''.join(map(str, max)))


(n, m) = list(map(int, input().split()))
c = n
if n == 1 and m == 0:
	print('0 0')
elif 9 * n < m or m < 1:
	print('-1 -1')
else:
	a = m // 9
	b = str(m % 9)
	number = []
	if n >= 2:
		for i in range(1, 10):
			if (m - i) / (n - 1) <= 9:
				break
		n -= 1
		m -= i
		number.append(i)
	while n > 1:
		for i in range(10):
			if (m - i) / (n - 1) <= 9:
				break
		number.append(i)
		n -= 1
		m -= i
	number.append(m)
	v = list(map(str, number))
	if b == '0':
		print(''.join(v), '9' * a + '0' * (c - a))
	else:
		print(''.join(v), '9' * a + b + '0' * (c - a - 1))


(m, s) = list(map(int, input().split()))
if s == 0 and m > 1 or 9 * m < s:
	print('-1 -1')
elif s == 0 and m == 1:
	print(0, 0)
else:
	a1 = ''
	s1 = s
	while s1 - 9 >= 0:
		a1 = a1 + '9'
		s1 = s1 - 9
	if s1 > 0:
		a1 = a1 + str(s1)
	a1 = a1 + '0' * (m - len(a1))
	a2 = ''
	s2 = s
	c = m
	while s2 > 9:
		a2 = a2 + '9'
		c = c - 1
		s2 = s2 - 9
	if s2 > 0:
		if c == 1:
			a2 = str(s2) + a2
		else:
			a2 = '1' + '0' * (c - 2) + str(s2 - 1) + a2
	print(a2, a1)


a = list(input().split(' '))
m = int(a[0])
s = int(a[1])
if s == 0 or s > 9 * m:
	if m == 1 and s == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	b = m * [0]
	c = s // 9
	d = s % 9
	for i in range(0, c):
		b[i] = 9
	if c != m:
		b[c] = d
	e = m * [0]
	for i in range(0, m):
		e[i] = b[m - i - 1]
	if e[0] == 0:
		e[0] = 1
		if d != 0:
			e[m - c - 1] -= 1
		else:
			e[m - c] -= 1
	for i in range(0, m):
		b[i] = str(b[i])
		e[i] = str(e[i])
	p = ''.join(b)
	q = ''.join(e)
	print('%d %d' % (int(q), int(p)))


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

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

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
(m, s) = mi()
if s == 0 and m > 1 or 9 * m < s:
	exit(print('-1 -1'))
minn = [0] * m
minn[0] = min(1, s)
t = s - minn[0]
for i in range(m - 1, -1, -1):
	if t <= 0:
		break
	minn[i] += min(9, t)
	t -= minn[i]
maxn = [0] * m
t = s
for i in range(m):
	if t <= 0:
		break
	maxn[i] += min(9, t)
	t -= maxn[i]
print(''.join(map(str, minn)), ''.join(map(str, maxn)))


(m, s) = list(map(int, input().split()))
if s > m * 9 or (m != 1 and s == 0):
	print('-1 -1')
elif m == 1 and s <= 9:
	print(s, s)
else:
	a = [9] * (s // 9)
	if s % 9 > 0:
		a += [s % 9]
	l = len(a)
	if l == m:
		a.sort()
		b = list(reversed(a))
		print(*a, sep='', end=' ')
		print(*b, sep='')
	else:
		b = a[:]
		t = min(a)
		a.remove(t)
		a.append(t - 1)
		a += [0] * (m - (l + 1))
		a.sort()
		print(1, *a, sep='', end=' ')
		b += [0] * (m - l)
		b.sort()
		b = list(reversed(b))
		print(*b, sep='')


def Legkisebb(curr, su):
	tes = list(str(curr))
	while su > 0:
		for i in range(len(tes)):
			if tes[i] != '9':
				temp = int(tes[i])
				temp = temp + 1
				tes[i] = str(temp)
				su = su - 1
				break
	return int(''.join(tes))

def Legnagyobb(curr, su):
	tes = list(str(curr))
	while su > 0:
		for i in range(len(tes) - 1, -1, -1):
			if tes[i] != '9':
				temp = int(tes[i])
				temp = temp + 1
				tes[i] = str(temp)
				su = su - 1
				break
	return int(''.join(tes))
T = input().split()
m = int(T[0])
s = int(T[1])
Curr = 10 ** (m - 1)
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or m * 9 < s:
	print('-1 -1')
else:
	print(Legnagyobb(Curr, s - 1), Legkisebb(Curr, s - 1))


(m, s) = list(map(int, input().split()))
if m == 1 and s < 10:
	print(s, s)
elif 1 <= m <= 100 and 0 <= s <= 900 and (m * 9 >= s) and (not (m > 1 and s == 0)):
	(max, min) = (['0'] * m, [])
	for i in range(m):
		if s >= 9:
			max[i] = '9'
			min.append('9')
			s -= 9
		else:
			max[i] = str(s)
			break
	if max.count('0') != 0:
		if s == 0:
			min[-1] = '8'
			min.append('1')
		elif s != 1:
			min.append(str(s - 1))
			min.append('1')
		else:
			min.append('1')
		min = str(min[-1]) + '0' * (m - len(min)) + ''.join(reversed(min[:-1]))
		print(int(''.join(min)), int(''.join(max)))
	else:
		print(int(''.join(reversed(max))), int(''.join(max)))
else:
	print('-1 -1')


(m, s) = input().split()
(m, s) = (int(m), int(s))
if 9 * m < s or (m > 1 and s == 0):
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	x = int(s / 9)
	y = s % 9
	if y == 0:
		if x == m:
			print(str(9) * m, str(9) * m)
		else:
			print('1' + str(0) * (m - 1 - x) + '8' + str(9) * (x - 1), str(9) * x + str(0) * (m - x))
	elif x == m - 1:
		print(str(y) + str(9) * x, str(9) * x + str(y))
	else:
		print('1' + str(0) * (m - 2 - x) + str(y - 1) + str(9) * x, str(9) * x + str(y) + str(0) * (m - 1 - x))


(m, s) = [int(i) for i in input().split()]
output = [-1, -1]
mini = []
maxi = []
if s == 0 and m == 1:
	output = [0, 0]
if s >= 1 and s <= 9:
	mini.extend([0 for i in range(m)])
	maxi.extend([0 for i in range(m)])
	if m > 1:
		mini[0] = 1
		mini[m - 1] = s - 1
		maxi[0] = s
	elif m == 1:
		mini[0] = s
		maxi[0] = s
if s > 9 and s <= 9 * m:
	stop = False
	i = 0
	while not stop:
		if s > 9:
			mini.append(9)
			maxi.append(9)
			s -= 9
			i += 1
		else:
			mini.append(s)
			maxi.append(s)
			stop = True
	mini.sort()
	if len(mini) < m:
		if mini[0] > 1:
			mini[0] -= 1
			mini.reverse()
			mini.append(1)
			mini.reverse()
	mini = mini[:1] + [0 for i in range(m - len(mini))] + mini[1:]
	if len(maxi) < m:
		maxi = maxi + [0 for i in range(m - len(maxi))]
if len(mini) != 0:
	output[0] = ''.join([str(i) for i in mini])
	output[1] = ''.join([str(i) for i in maxi])
print(output[0], output[1])


(m, s) = map(int, input().split())
lm = sum([9] * m)
if s < 1 and m != 1 or s > lm:
	print(-1, -1)
else:
	mx = int(s / 9)
	mx2 = int(s % 9)
	l = [9] * mx
	if mx2 > 0:
		l.append(mx2)
	if len(l) < m:
		for i in range(len(l), m):
			l.append(0)
	l2 = l[::-1]
	if l2[0] == 0:
		for (i, j) in enumerate(l2):
			if j != 0:
				l2[i] = l2[i] - 1
				l2[0] = 1
				break
	mi = int(''.join(map(str, l2)))
	mxm = int(''.join(map(str, l)))
	print(mi, mxm)


(m, s) = [int(x) for x in input().split()]
maxnum = ['0'] * m
minrev = ['0'] * m
sumnum = s
tfmax = 0
tfmin = 0
for i in range(m):
	if i < m - 1:
		if sumnum >= 9:
			maxnum[i] = '9'
			sumnum -= 9
		else:
			maxnum[i] = str(sumnum)
			sumnum -= sumnum
	if i == m - 1:
		if sumnum > 9:
			tfmax = 1
		else:
			maxnum[i] = str(sumnum)
			sumnum -= sumnum
maxnumber = ''.join(maxnum)
sumnum = s - 1
for i in range(m):
	if i < m - 1:
		if sumnum >= 9:
			minrev[i] = '9'
			sumnum -= 9
		else:
			minrev[i] = str(sumnum)
			sumnum -= sumnum
	if i == m - 1:
		if sumnum > 8:
			tfmin = 1
		else:
			minrev[i] = str(sumnum + 1)
minrev.reverse()
minnumber = ''.join(minrev)
if tfmax == 1 or tfmin == 1:
	print('-1 -1')
elif m > 1 and s <= 0:
	print('-1 -1')
else:
	print(minnumber, maxnumber)


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	minVal = 10 ** (m - 1)
	maxVal = 0
	for i in range(s - 1):
		minVal = minVal + 10 ** (i // 9)
	for j in range(s):
		maxVal = maxVal + 10 ** (m - 1 - j // 9)
	print(minVal, maxVal)


(m, s) = map(int, input().split())
if s == 0 and m >= 2 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	tmp1 = s
	tmp2 = s
	flag1 = 0
	flag2 = 0
	for i in range(m):
		if i == 0:
			if (m - i) * 9 >= tmp1:
				if (m - i - 1) * 9 < tmp1 - 1:
					print(tmp1 - (m - i - 1) * 9, end='')
					flag1 = 1
				else:
					tmp1 -= 1
					print(1, end='')
		elif flag1 == 1:
			print(9, end='')
		elif (m - i) * 9 >= tmp1:
			if (m - i - 1) * 9 < tmp1:
				print(tmp1 - (m - i - 1) * 9, end='')
				flag1 = 1
			else:
				print(0, end='')
	print('', end=' ')
	for i in range(m):
		if tmp2 >= 9:
			print(9, end='')
			tmp2 -= 9
		else:
			print(tmp2, end='')
			tmp2 -= tmp2


import math
(m, s) = map(int, input().split())
if math.ceil(s / m) > 9 or (s == 0 and m > 1):
	print('-1 -1')
else:
	temp = s
	largest = [0 for i in range(m)]
	for i in range(m):
		for j in range(9, -1, -1):
			diff = temp - j
			if diff >= 0:
				if m - i - 1 == 0:
					if diff == 0:
						largest[i] = j
				elif math.ceil(diff / (m - i - 1)) <= 9:
					largest[i] = j
					temp = diff
					break
	temp = s
	smallest = [0 for i in range(m)]
	for i in range(m):
		for j in range(10):
			if i == 0 and j == 0:
				continue
			diff = temp - j
			if diff >= 0:
				if m - i - 1 == 0:
					if diff == 0:
						smallest[i] = j
				elif math.ceil(diff / (m - i - 1)) <= 9:
					smallest[i] = j
					temp = diff
					break
	l = ''
	for i in largest:
		l += str(i)
	r = ''
	for i in smallest:
		r += str(i)
	print(r + ' ' + l)


(m, s) = [int(x) for x in input().split()]
if s == 0 and m != 1 or s / 9 > m:
	print('-1 -1')
else:
	tm = m
	ts = s
	mn = ''
	while m > 0:
		if m == 1:
			mn = str(s) + mn
		else:
			mn = str(min(9, s - 1)) + mn
			s -= min(9, s - 1)
		m -= 1
	m = tm
	s = ts
	mx = ''
	while m > 0:
		if s > 0:
			mx += str(min(9, s))
			s -= min(9, s)
		else:
			mx += '0'
		m -= 1
	print(mn, mx)


(m, s) = map(int, input().split())
ar = [0] * m
ar[0] = 1
sum1 = 1
if m == 1:
	if s > 9:
		print('-1 -1')
	else:
		print(s, s)
else:
	dd = 0
	for i in range(m - 1, 0, -1):
		if sum1 <= s:
			ar[i] += 9
			sum1 += 9
		if sum1 > s:
			ar[i] -= sum1 - s
			sum1 -= sum1 - s
	if sum1 < s:
		ar[0] += s - sum1
	if ar[0] > 9:
		dd = 1
	min1 = ar[:]
	sum1 = 0
	ar = [0] * m
	ar[0] = 0
	for i in range(m):
		if sum1 <= s:
			sum1 += 9
			ar[i] += 9
		if sum1 > s:
			ar[i] -= sum1 - s
			sum1 -= sum1 - s
	if sum1 < s or dd == 1 or ar[0] == 0 or (min(min1) < 0):
		print('-1 -1')
	else:
		print(''.join(map(str, min1)), ''.join(map(str, ar)))


firstLine = [int(n) for n in input().split()]
length = firstLine[0]
total = firstLine[1]

def ones(a):
	ret = 0
	for i in range(0, a):
		ret *= 10
		ret += 1
	return ret

def nines(a):
	ret = 0
	for i in range(0, a):
		ret *= 10
		ret += 9
	return ret

def digitSum(a):
	return sum(map(int, str(a)))
act = True
if total < 1 and length > 1 or total > 9 * length:
	print(-1, -1)
	act = False
if act:
	low = 10 ** (length - 1)
	index = 0
	while digitSum(low) != total:
		low += min(9, total - digitSum(low)) * 10 ** index
		index += 1
	high = nines(length)
	index = 0
	while digitSum(high) != total:
		high -= min(9, digitSum(high) - total) * 10 ** index
		index += 1
	print(low, high)


def findDigit(i, z):
	y = str(z)
	x = int(y[i])
	return x
a = input().split()
b = [0] * int(a[0])
c = int(int(a[1]) / 9)
d = int(a[1]) % 9
e = []
if (c < int(a[0]) or (c == int(a[0]) and d == 0)) and (int(a[1]) != 0 or int(a[0]) == 1):
	for i in range(c):
		b[i] = 9
	if d != 0:
		b[c] = d
else:
	e.append(-1)
f = [0] * int(a[0])
if sum(f) != int(a[1]):
	f[0] = 1
	if sum(f) != int(a[1]):
		for j in range(len(f) - 1):
			for k in range(9):
				f[len(f) - j - 1] = k + 1
				if sum(f) == int(a[1]):
					break
			if sum(f) == int(a[1]):
				break
		if sum(f) != int(a[1]):
			for i in range(2, 10):
				f[0] = i
				if sum(f) == int(a[1]):
					break
if sum(f) != int(a[1]):
	e.append(-1)
if e != []:
	print('-1' + ' ' + '-1')
else:
	print(''.join(map(str, f)) + ' ' + ''.join(map(str, b)))


(len, sm) = map(int, input().split())
sm1 = sm
if sm == 0 and len > 1:
	print('-1 -1')
	exit()
if sm > len * 9:
	print('-1 -1 ')
	exit()
maxi = ''
for i in range(len):
	if sm == 0:
		maxi += '0'
		continue
	elif sm >= 9:
		sm -= 9
		maxi += '9'
	else:
		maxi += str(sm)
		sm = 0
mini = ''
sm = sm1
for i in range(len):
	if i == 0:
		if sm == 0:
			mini += '0'
		elif sm <= (len - i - 1) * 9:
			mini += '1'
			sm -= 1
		elif sm == 9 * (len - i):
			mini += '9'
			sm -= 9
		else:
			mini += str(9 - (9 * (len - i) - sm))
			sm = 9 * (len - i - 1)
		continue
	if sm == 0:
		mini += '0'
	elif sm < (len - i - 1) * 9:
		mini += '0'
	elif sm == 9 * (len - i):
		mini += '9'
		sm -= 9
	else:
		mini += str(9 - (9 * (len - i) - sm))
		sm = 9 * (len - i - 1)
print(mini, maxi)


(m, s) = [int(i) for i in input().split()]
a = s // 9
p = m - a
b = s % 9
if p == 0 and b == 0:
	h = m * [9]
	H = m * [9]
	min = ''
	max = ''
	for i in h:
		min += str(i)
	for j in H:
		max += str(j)
elif p == 1 and m != 1:
	if b == 0:
		h = [1] + [8] + (m - 2) * [9]
	else:
		h = [b] + (m - 1) * [9]
	H = (m - 1) * [9] + [b]
	min = ''
	max = ''
	for i in h:
		min += str(i)
	for j in H:
		max += str(j)
elif p == 1 and m == 1:
	max = min = s
elif 1 < p < m:
	if b == 0:
		h = [1] + (p - 1) * [0] + [8] + (m - p - 1) * [9]
	else:
		h = [1] + (p - 2) * [0] + [b - 1] + (m - p) * [9]
	H = (m - p) * [9] + [b] + (p - 1) * [0]
	min = ''
	max = ''
	for i in h:
		min += str(i)
	for j in H:
		max += str(j)
elif p == m and b != 0:
	if b == 1:
		H = h = [1] + (m - 1) * [0]
	if b > 1:
		h = [1] + (m - 2) * [0] + [b - 1]
		H = [b] + (m - 1) * [0]
	min = ''
	max = ''
	for i in h:
		min += str(i)
	for j in H:
		max += str(j)
else:
	min = max = -1
print(min, max)


(n, s) = map(int, input().split())
if s == 0 and n != 1:
	print('-1', '-1')
elif n * 9 < s:
	print('-1', '-1')
else:
	a = [0] * n
	b = [0] * n
	i = 0
	while sum(a) != s:
		if sum(a) + 9 <= s:
			a[i] = 9
		else:
			a[i] = s - sum(a)
		i += 1
	i = 0
	s -= 1
	while sum(b) != s:
		if sum(b) + 9 <= s:
			b[i] += 9
		else:
			b[i] += s - sum(b)
		i += 1
	b[-1] += 1
	print(''.join((str(i) for i in b[::-1])), ''.join((str(i) for i in a)))


inp = input()
s = inp.split()
try:
	m = int(s[0])
	n = int(s[1])
except:
	print('Please enter digits between 1 & 100')
	quit()
c9 = 0
text9 = '9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
text0 = '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
sm = 0
smm = 0
if m > 1 and n == 0:
	print('-1', '-1')
	quit()
if m == 0:
	print('-1', '-1')
	quit()
if m <= 2:
	if m == 1:
		outl = n
		outs = n
		for nnn in str(outl):
			sm = sm + int(nnn)
		for nn in str(outs):
			smm = smm + int(nn)
		if sm == n and smm == n and (len(str(outl)) == len(str(outs)) == m):
			print(outs, outl)
			quit()
		else:
			print('-1', '-1')
			quit()
	if m == 2:
		if n >= 9:
			outl = '9' + str(n - 9)
			outs = str(n - 9) + '9'
			for nnn in str(outl):
				sm = sm + int(nnn)
			for nn in str(outs):
				smm = smm + int(nn)
			if sm == n and smm == n and (len(str(outl)) == len(str(outs)) == m):
				print(outs, outl)
				quit()
			else:
				print('-1', '-1')
				quit()
		if n < 9:
			outs = '1' + str(n - 1)
			outl = str(n) + '0'
			for nnn in str(outl):
				sm = sm + int(nnn)
			for nn in str(outs):
				smm = smm + int(nn)
			if sm == n and smm == n and (len(str(outl)) == len(str(outs)) == m):
				print(outs, outl)
				quit()
			else:
				print('-1', '-1')
				quit()
elif m > 2:
	if n > 9:
		s = n
		while s > 9:
			s = s - 9
			c9 = c9 + 1
			outl = text9[:c9] + str(s) + text0[:m - (c9 + 1)]
			if m - c9 == 1:
				outs = str(s) + text9[:c9]
			elif m - c9 >= 2:
				outs = '1' + text0[:m - (c9 + 2)] + str(s - 1) + text9[:c9]
		for nnn in str(outl):
			sm = sm + int(nnn)
		for nn in str(outs):
			smm = smm + int(nn)
		if sm == n and smm == n and (len(str(outl)) == len(str(outs)) == m):
			print(outs, outl)
			quit()
		else:
			print('-1', '-1')
			quit()
	if n <= 9:
		outl = str(n) + text0[:m - 1]
		outs = '1' + text0[:m - 2] + str(n - 1)
		for nnn in str(outl):
			sm = sm + int(nnn)
		for nn in str(outs):
			smm = smm + int(nn)
		if sm == n and smm == n and (len(str(outl)) == len(str(outs)) == m):
			print(outs, outl)
			quit()
		else:
			print('-1', '-1')
			quit()


(m, s) = [int(x) for x in input().split()]
if s == 0 and m == 1:
	print('0 0')
elif s < 1 or s > 9 * m:
	print('-1 -1')
else:
	a = [1] + [0] * (m - 1)
	a_cnt = s - 1
	for i in range(m - 1, -1, -1):
		if a_cnt > 9:
			a_cnt -= 9
			a[i] += 9
		else:
			a[i] += a_cnt
			break
	b = [0] * m
	b_cnt = s
	for i in range(0, m):
		if b_cnt > 9:
			b_cnt -= 9
			b[i] += 9
		else:
			b[i] += b_cnt
			break
	print(''.join([str(x) for x in a]) + ' ' + ''.join([str(x) for x in b]))


line = input()
(M, S) = line.split()
m = int(M)
s = int(S)
hi = ''
if m == 1 and s == 0:
	print(0, 0)
elif m * 9 < s or s == 0:
	print(-1, end=' ')
	print(-1)
elif m == 1:
	print(s, s)
else:
	t = s % 9
	k = s // 9
	if t == 0:
		if k == m:
			print(int('9' * k), end=' ')
			print(int('9' * k))
		else:
			min1 = '1' + '0' * (m - k - 1) + '8' + '9' * (k - 1)
			max1 = '9' * k + '0' * (m - k)
			print(int(min1), end=' ')
			print(int(max1))
	elif k == 0:
		print(int('1' + '0' * (m - 2) + str(s - 1)), end=' ')
		print(int(str(s) + '0' * (m - 1)))
	elif k == m - 1:
		min2 = str(t) + '9' * k
		max2 = '9' * k + str(t)
		print(int(min2), end=' ')
		print(int(max2))
	else:
		max3 = '9' * k + str(t) + '0' * (m - k - 1)
		min3 = '1' + '0' * (m - k - 2) + str(t - 1) + '9' * k
		print(int(min3), end=' ')
		print(int(max3))


hello = list(map(int, input().split()))
m = hello[0]
s = hello[1]
a = ''
b = ''
new = '1'
done = False
if s == 0:
	print('0 0' if m == 1 else '-1 -1')
	done = True
if not done:
	for i in range(m):
		b += str(min(s, 9))
		s -= min(s, 9)
	if s > 0:
		print('-1 -1')
		done = True
	if not done:
		for i in range(m - 1, -1, -1):
			a += b[i]
		if a[0] == '0':
			_ = 0
			while a[_] == '0':
				_ += 1
			for i in range(1, len(a)):
				if i == _:
					new += str(int(a[i]) - 1)
				else:
					new += a[i]
		else:
			new = ''
			new += a
		print(new, b)


(d, s) = [int(x) for x in input().split()]
init_d = d
dic = {}

def f(d, s, dic):
	if (d, s) in dic:
		return dic[d, s]
	if d == 1 and 0 <= s <= 9:
		dic[d, s] = (s, s)
		return (s, s)
	if d == 1 and (s < 0 or s > 9):
		dic[d, s] = (-1, -1)
		return (-1, -1)
	mini = float('inf')
	maxi = float('-inf')
	start = 1 if init_d == d else 0
	for v in range(start, 10):
		(a, b) = f(d - 1, s - v, dic)
		if a != -1:
			mini = min(v * 10 ** (d - 1) + a, mini)
			break
	for v in range(9, start - 1, -1):
		(a, b) = f(d - 1, s - v, dic)
		if b != -1:
			maxi = max(v * 10 ** (d - 1) + b, maxi)
			break
	if mini == float('inf'):
		mini = -1
	if maxi == float('-inf'):
		maxi = -1
	dic[d, s] = (maxi, mini)
	return (mini, maxi)
(a, b) = f(d, s, dic)
print(a, b)


def find_max_min(m, s):
	if m == 1:
		if s < 10:
			return [str(s), str(s)]
		else:
			return ['-1', '-1']
	if m > 1:
		if s < 10:
			mini = '1' + '0' * (m - 2) + '{}'.format(s - 1)
			maxm = '{}'.format(s) + '0' * (m - 1)
			return [mini, maxm]
		if s >= 10:
			(mini, maxm) = find_max_min(m - 1, s - 9)
			return [mini + '9', '9' + maxm]
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	x = find_max_min(m, s)
	if x[0][0] == '-' or s == 0:
		print('-1 -1')
	else:
		print('{} {}'.format(x[0], x[1]))


(m, n) = list(map(int, input().split()))
s1 = n
s2 = n
l = 9
m1 = [0] * m
m2 = [0] * m
if n > int(9 * m) or (n == 0 and m != 1):
	print(-1, -1)
else:
	for i in range(m):
		if s1 >= 9:
			m2[i] = 9
			s1 -= 9
		else:
			m2[i] = s1
			break
	for j in range(m - 1, -1, -1):
		if s2 > 9:
			m1[j] = 9
			s2 -= 9
		elif j != 0 and s2 == 1:
			m1[0] = s2
			break
		elif j == 0:
			m1[0] = s2
		else:
			m1[j] = s2 - 1
			s2 -= m1[j]
	for p in m1:
		print(p, end='')
	print(' ', end='')
	for q in m2:
		print(q, end='')


(x, y) = input().split()
x = int(x)
y = int(y)
k = 1
if y > x * 9:
	print('-1 -1')
elif x == 1 and y < 10 and (y != 0):
	print('%d %d' % (y, y))
elif y == 0 and x != 1:
	print('-1 -1')
elif y == 0 and x == 1:
	print('0 0')
else:
	s = y // 9
	t = y % 9
	if t != 0 and s != 0:
		Max = '9'
		for i in range(s - 1):
			Max = Max + '9'
		Max = Max + '%d' % t
		for i in range(x - s - 1):
			Max = Max + '0'
		if 1 + s == x:
			Min = str(t)
			for i in range(x - 1):
				Min = Min + '9'
		if 1 + s < x:
			Min = '1'
			for i in range(x - 2 - s):
				Min = Min + '0'
			Min = Min + '%d' % (t - 1)
			for i in range(s):
				Min = Min + '9'
		print(Min, Max)
		while k == 1:
			break
	if t == 0:
		Max = '9'
		for i in range(s - 1):
			Max = Max + '9'
		for i in range(x - s):
			Max = Max + '0'
		if s != x:
			Min = '1'
			for i in range(x - s - 1):
				Min = Min + '0'
			Min = Min + '8'
			for i in range(s - 1):
				Min = Min + '9'
		if s == x:
			Min = Max
		print(Min, Max)
		while k == 1:
			break
	elif s == 0:
		Max = str(t)
		for i in range(x - 1):
			Max = Max + '0'
		Min = '1'
		for i in range(x - 2):
			Min = Min + '0'
		Min = Min + '%d' % (t - 1)
		print(Min, Max)


n_m = input().split()
(n, m) = (int(n_m[0]), int(n_m[1]))
if m == 0:
	if n == 1:
		print('0', '0')
	else:
		print('-1', '-1')
elif n * 9 < m:
	print('-1', '-1')
else:
	if m < 10:
		maximum = [m] + [0] * (n - 1)
		if n == 1:
			minimum = [m]
		else:
			minimum = [1] + [0] * (n - 2) + [m - 1]
	else:
		(m1, m2) = (m, m)
		(maximum, minimum) = ([], [])
		for i in range(n - 1):
			if m1 <= 9:
				break
			m1 -= 9
			maximum += [9]
		maximum += [m1] + (n - len(maximum) - 1) * [0]
		if m > (n - 1) * 9:
			for j in range(n):
				if m2 <= 9:
					break
				m2 -= 9
				minimum += [9]
			minimum += [m2]
			minimum.reverse()
		else:
			m2 -= 1
			for j in range(n - 1):
				if m2 <= 9:
					break
				m2 -= 9
				minimum += [9]
			minimum += [m2, 1]
			minimum.reverse()
			minimum[1:1] = [0] * (n - len(minimum))
	for k in range(n):
		(maximum[k], minimum[k]) = (str(maximum[k]), str(minimum[k]))
	print(''.join(minimum), ''.join(maximum))


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
(a, b) = [int(i) for i in input().split()]
if a == 1 and b == 0:
	print(0, 0)
elif b == 0:
	print(-1, -1)
else:
	s = ''
	pf = -1
	sum1 = b
	for i in range(0, a):
		if sum1 > 9:
			s = s + str(9)
			sum1 = sum1 - 9
		elif sum1 > 0:
			s = s + str(sum1)
			pf = i
			sum1 = 0
		else:
			s = s + '0'
	if sum1 == 0:
		lst = list(s)
		if pf != -1:
			lst[pf] = str(int(lst[pf]) - 1)
			lst[-1] = str(int(lst[-1]) + 1)
		print(''.join(lst[::-1]), s)
	else:
		print(-1, -1)


def find_min_max(length, summ):
	length = int(length)
	summ = int(summ)
	if summ == 0 and length != 1:
		print('-1 -1')
		return
	if summ == 0 and length == 1:
		print('0 0')
		return
	max = [0 for x in range(length)]
	count = summ // 9
	if count == length and summ % 9:
		print('-1 -1')
		return
	if count > length:
		print('-1 -1')
		return
	for i in range(count):
		max[i] = 9
	if count < length:
		max[count] = summ % 9
	min = [0 for x in range(length)]
	min[0] = 1
	count = (summ - 1) // 9
	for i in range(count):
		min[length - i - 1] += 9
	min[length - count - 1] += (summ - 1) % 9
	for i in min:
		print(i, end='')
	print(' ', end='')
	for i in max:
		print(i, end='')
data = input()
find_min_max(*data.split(' '))


def printListNum(arr):
	for i in arr:
		print(i, end='')
	print(' ', end='')

def magic():
	(m, s) = [int(x) for x in input().split()]
	if m > 1 and s == 0 or m * 9 < s:
		print('-1 -1')
		return
	lsMax = [0] * m
	for i in range(m):
		if s > 9:
			lsMax[i] = 9
			s -= 9
		else:
			lsMax[i] = s
			s = 0
	lsMin = [x for x in lsMax[::-1]]
	if lsMin[0] == 0:
		for i in range(1, m):
			if lsMin[i] > 0:
				lsMin[0] = 1
				lsMin[i] -= 1
				break
	printListNum(lsMin)
	printListNum(lsMax)
magic()


a = list(map(int, input().split()))
m = a[0]
s = a[1]
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	k = s // 9
	if k > m or (k == m and k * 9 < s):
		print(-1, -1)
	elif k == m:
		print('9' * m, '9' * m)
	elif k == m - 1:
		if k * 9 == s:
			print('18' + '9' * (k - 1), '9' * k + '0')
		else:
			print(str(s - k * 9) + '9' * k, '9' * k + str(s - k * 9))
	elif k * 9 == s:
		print('1' + '0' * (m - k - 1) + '8' + '9' * (k - 1), '9' * k + '0' * (m - k))
	else:
		print('1' + '0' * (m - k - 2) + str(s - k * 9 - 1) + '9' * k, '9' * k + str(s - k * 9) + '0' * (m - k - 1))


(m, s) = map(int, input().split())
if 9 * m < s or (s == 0 and m > 1):
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	mx = []
	i = 9
	sm = s
	signs = 0
	while s:
		while s - i >= 0:
			mx.append(i)
			signs += 1
			s -= i
		i -= 1
	while signs < m:
		mx.append(0)
		signs += 1
	mn = []
	i = 9
	signs = 0
	while sm:
		while sm - i >= 0:
			mn.append(i)
			signs += 1
			sm -= i
		i -= 1
	if m - signs:
		mn[-1] -= 1
		while m - signs > 1:
			mn.append(0)
			signs += 1
		mn.append(1)
	for i in range(len(mn) - 1, -1, -1):
		print(mn[i], end='')
	print(' ', end='')
	for i in mx:
		print(i, end='')


(m, s) = [int(i) for i in input().split()]
if s > 9 * m or (s < 1 and m > 1):
	print('-1', '-1')
else:
	t = s
	u = s
	num = ''
	num_k = ''
	for i in range(m):
		if t >= 9:
			t -= 9
			num += str(9) + ' '
			num_k += str(9)
		else:
			num += str(t) + ' '
			num_k += str(t)
			t = 0
	num_l = num.split()
	if int(num_l[m - 1]) == 0 and m > 1:
		num_l[m - 1] = 1
		for i in range(m - 2, -1, -1):
			if int(num_l[i]) != 0:
				num_l[i] = int(num_l[i]) - 1
				break
	for i in range(m - 1, -1, -1):
		print(num_l[i], end='')
	print(' ' + num_k)
	print()


(m, s) = [int(i) for i in input().split()]
if s > 9 * m:
	print('-1', '-1')
elif s == 0 and m != 1:
	print('-1', '-1')
else:
	M = [0] * m
	Mmax = [0] * m
	Mmin = [0] * m
	a9 = int(s / 9)
	for i in range(a9):
		M[i] = 9
	b = s - 9 * a9
	if b != 0:
		M[a9] = b
	for i in range(m):
		Mmax[i] = str(M[i])
	Nmax = ''.join(Mmax)
	M.sort()
	if M[0] == 0:
		for i in range(m):
			if M[i] != 0:
				M[0] = 1
				M[i] -= 1
				break
	for i in range(m):
		Mmin[i] = str(M[i])
	Nmin = ''.join(Mmin)
	print(Nmin, Nmax)


s = input().split()
a = int(s[0])
b = int(s[1])
b1 = b
b2 = b
output1 = ''
if b1 > 1:
	b1 = b1 - 1
	for i in range(a):
		if b1 > 9:
			b1 = b1 - 9
			output1 = output1 + '9'
		elif b1 <= 9:
			output1 = output1 + str(b1)
			b1 = 0
	output1 = str(int(output1) + 1)
elif b1 == 0:
	output1 = '1-'
else:
	output1 = (a - 1) * '0' + '1'
output1 = output1[::-1]
output2 = ''
if b2 > 0:
	for i in range(a):
		if b2 > 9:
			b2 = b2 - 9
			output2 = output2 + '9'
		elif b2 <= 9:
			output2 = output2 + str(b2)
			b2 = 0
else:
	output2 = '-1'
if b > 9 * a:
	output1 = output2 = -1
if a == 1 and b == 0:
	output1 = output2 = 0
print('%s %s' % (output1, output2))


def ans1(a, b):
	if b == 0 and a != 1 or b > 9 * a:
		return -1
	p = ''
	while b > 9:
		p = p + '9'
		b = b - 9
		a = a - 1
	if a == 0:
		return p
	else:
		if a >= 2:
			p = p + str(b - 1)
			a = a - 1
			p = p + '0' * (a - 1)
			p = p + '1'
		else:
			p = p + str(b)
		return p

def ans2(a, b):
	if b == 0 and a != 1 or b > 9 * a:
		return -1
	p = ''
	while b >= 9:
		p = p + '9'
		b = b - 9
		a = a - 1
	if a == 0:
		return p
	else:
		p = p + str(b)
		a = a - 1
		p = p + '0' * a
		return p
(a, b) = list(map(int, input().split()))
x = ans1(a, b)
if x != -1:
	x = x[::-1]
y = ans2(a, b)
print(x, y)


st = input()
st = [int(i) for i in st.strip().split()]
(ln, sm) = (st[0], st[1])
summa = sm
mn = []
while len(mn) < ln:
	if summa - 9 >= 0:
		mn.append(9)
		summa = summa - 9
	else:
		mn.append(summa)
		summa = 0
if sum(mn) == sm and len(mn) == ln:
	big = [str(j) for j in mn] if mn[0] != 0 or len(mn) == 1 else ['-1']
	if big[0] == '-1':
		little = ['-1']
	else:
		little = mn[::-1]
		if little[0] == 0:
			for i in range(1, len(little)):
				if little[i] != 0:
					little[0] = 1
					little[i] = little[i] - 1
					break
		little = [str(j) for j in little]
	print('{0} {1}'.format(''.join(little), ''.join(big)))
else:
	print('-1 -1')


(m, s) = map(int, input().split())

def solve(m, s):
	if m > 1 and s == 0:
		return (-1, -1)
	if m == 1 and s == 0:
		return (0, 0)
	if m == 0 and s == 0:
		return (-1, -1)
	if s > m * 9:
		return (-1, -1)
	sorted_nums = [9] * (s // 9)
	if s % 9:
		sorted_nums.append(s % 9)
	max_val = sorted_nums + [0] * (m - len(sorted_nums))
	if len(sorted_nums) == m:
		min_val = sorted_nums[::-1]
	else:
		sorted_nums[-1] = sorted_nums[-1] - 1
		min_val = [1] + [0] * (m - len(sorted_nums) - 1) + sorted_nums[::-1]
	max_val = int(''.join(map(str, max_val)))
	min_val = int(''.join(map(str, min_val)))
	return (min_val, max_val)
print(*solve(m, s))


def smallest(m, s):
	if m == 1 and s == 0:
		return 0
	x = 10 ** (m - 1)
	y = str(x)
	z = []
	for i in y:
		z.append(int(i))
	i = m - 1
	while i >= 0:
		if z[i] == 9:
			i -= 1
		if sum(z) == s:
			a = ''
			for i in range(len(z)):
				a += str(z[i])
			return a
		z[i] += 1
	return -1

def largest(m, s):
	if m == 1 and s == 0:
		return 0
	x = 10 ** (m - 1)
	y = str(x)
	z = []
	for i in y:
		z.append(int(i))
	i = 0
	while i < m:
		if sum(z) == s:
			a = ''
			for i in range(len(z)):
				a += str(z[i])
			return a
		z[i] += 1
		if z[i] == 9:
			i += 1
	if sum(z) == s:
		a = ''
		for i in range(len(z)):
			a += str(z[i])
		return a
	return -1
(m, s) = map(int, input().split())
print(smallest(m, s), largest(m, s))


import math
give = input()
given = give.split()
length = int(given[0])
summation = int(given[1])
if summation == 0 and length >= 2:
	print('{} {}'.format(-1, -1))
elif summation == 0 and length == 1:
	print('{} {}'.format(0, 0))
elif summation == 0 and length == 0:
	print('{} {}'.format(-1, -1))
elif summation > 9 * length:
	print('{} {}'.format(-1, -1))
else:
	nine = math.floor(summation / 9)
	if nine == length:
		maximum = '9' * length
	else:
		maximum_1 = '9' * nine
		maximum_res = summation - 9 * nine
		maximum = maximum_1 + str(maximum_res)
		if len(maximum) < length:
			maximum = maximum + '0' * (length - len(maximum))
	for i in range(1, 10):
		if summation - i <= (length - 1) * 9:
			smallest = str(i)
			break
	summation = summation - i
	length = length - 1
	if length == 0:
		print('{} {}'.format(smallest, maximum))
	else:
		for i in range(10):
			while summation <= length * 9:
				smallest = smallest + str(i)
				summation = summation - i
				length = length - 1
				if summation == 0:
					break
			if summation > 0:
				summation = summation + i
				length = length + 1
				smallest = smallest[:len(smallest) - 1]
			if summation == 0:
				break
		smallest = smallest + '0' * length
		print('{} {}'.format(smallest, maximum))


(n, m) = map(int, input().split())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
a[0] = 1
s = m - 1
for i in range(n):
	if s >= 9:
		a[n - i - 1] += 9
		s -= 9
	else:
		a[n - i - 1] += s
		s = 0
a = [str(i) for i in a]
if s != 0 or any((int(i) < 0 or int(i) > 9 for i in a)):
	print(-1, end=' ')
else:
	print(''.join(a), end=' ')
s = m
for i in range(n):
	if s >= 9:
		b[i] += 9
		s -= 9
	else:
		b[i] += s
		s = 0
b = [str(i) for i in b]
if s != 0 or any((int(i) < 0 or int(i) > 9 for i in a)):
	print(-1)
else:
	print(''.join(b))


(m, s) = map(int, input().split())
if 9 * m >= s:
	n = m
	a = 0
	x = 0
	min_num = []
	max_num = []
	while x < m:
		min_num.append(0)
		max_num.append(0)
		for i in range(10):
			j = 9 - i
			if j + 9 * (n - 1) + sum(min_num) - min_num[a] >= s:
				if a == 0 and j == 0 and (s != 0):
					min_num[0] = 1
				else:
					min_num[a] = j
			if j + 9 * (n - 1) + sum(max_num) - max_num[a] >= s:
				if j == 0 and a == m - 1 and (s != 0):
					max_num[a] = 1
				else:
					max_num[a] = j
		a = a + 1
		n = n - 1
		x = x + 1
	small = 0
	big = 0
	if (min_num[0] == 0 or max_num[-1] == 0) and m > 1:
		print('-1 -1')
	elif sum(min_num) != s or sum(max_num) != s:
		print('-1 -1')
	else:
		for i in range(m):
			small = small + min_num[i] * 10 ** (m - i - 1)
			big = big + max_num[i] * 10 ** i
		print(small, big)
else:
	print('-1 -1')


(m, s) = (int(x) for x in input().split(' '))
max = -1
min = -1
if s > 0:
	new_s = s - 1
	min = 10 ** (m - 1)
	for i in range(m - 1):
		if new_s > 9:
			new_s -= 9
			min += 10 ** i * 9
		else:
			min += 10 ** i * new_s
			new_s = 0
	if new_s > 0:
		if new_s < 9:
			min += new_s * 10 ** (m - 1)
		else:
			min = -1
	new_s = s
	if new_s < 9:
		max = new_s * 10 ** (m - 1)
		new_s = 0
	else:
		max = 9 * 10 ** (m - 1)
		new_s -= 9
		for i in reversed(range(m - 1)):
			if new_s > 9:
				new_s -= 9
				max += 10 ** i * 9
			else:
				max += 10 ** i * new_s
				new_s = 0
		if new_s > 0:
			max = -1
elif m == 1:
	min = 0
	max = 0
print(min, max)


t = 1
for i in range(t):
	(m, s) = [int(x) for x in input().split()]
	nines = s // 9
	if m == 1 and s == 0:
		print(0, 0)
		continue
	if nines > m or s == 0 or m * 9 < s:
		print('-1 -1')
		continue
	if s < 10:
		if m == 1:
			print(s, s)
		else:
			mn = '1' + '0' * (m - 2) + str(s - 1)
			mx = str(s) + '0' * (m - 1)
			print(mn, mx)
		continue
	if m * 9 == s:
		print('9' * m, '9' * m)
		continue
	rem = s % 9
	if nines + 1 == m and rem != 0:
		mn = str(rem) + '9' * nines
	elif rem == 0:
		mn = '1' + '0' * (m - nines - 1) + '8' + '9' * (nines - 1)
	else:
		mn = '1' + '0' * (m - nines - 2) + str(rem - 1) + '9' * nines
	mx = (nines * '9' + str(rem) + '0' * 101)[:m]
	print(mn, mx)


def findMin(m, s):
	vals = [0] * m
	for index in range(m - 1, -1, -1):
		if s <= 9:
			if s > 0:
				vals[index] = s - 1
				vals[0] = vals[0] + 1
			else:
				vals[index] = max(0, vals[index])
			s = 0
		else:
			vals[index] = 9
			s = s - 9
	vals = [str(x) for x in vals]
	return vals

def findMax(m, s):
	vals = [0] * m
	for index in range(0, m):
		if s <= 9:
			vals[index] = s
			s = 0
		else:
			vals[index] = 9
			s = s - 9
	vals = [str(x) for x in vals]
	return vals
(m, s) = [int(x) for x in input().split()]
if m * 9 < s:
	print('-1 -1')
elif m > 1 and s == 0:
	print('-1 -1')
else:
	min_val = ''.join(findMin(m, s))
	max_val = ''.join(findMax(m, s))
	print('{} {}'.format(int(min_val), int(max_val)))


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit()
if 9 * m < s:
	print(-1, -1)
	exit()
if s % 9:
	a = '9' * (s // 9) + str(s % 9) + '0' * (m - s // 9 - 1)
else:
	a = '9' * (s // 9) + '0' * (m - s // 9)
l = a
while l[-1] == '0':
	l = l[:-1]
if len(l) == m:
	print(l[::-1], a)
else:
	p = str(int(l[-1]) - 1)
	l = l[:-1]
	print('1' + '0' * (m - len(l) - 2) + p + l[::-1], a)


m = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(m, s) = f()
s1 = s
l1 = [0] * m
l2 = [0] * m
for i in range(m):
	l1[i] = min(9, s)
	s -= l1[i]
s1 -= 1
for i in range(m - 1, -1, -1):
	l2[i] = min(9, s1)
	s1 -= l2[i]
if l2[0] == 0:
	l2[0] = 1
else:
	l2[0] += 1
if m == 1 and s == 0:
	print(''.join((str(i) for i in l2)), end=' ')
	print(''.join((str(i) for i in l1)))
	exit(0)
elif m == 1 and s != 0:
	print(-1, -1)
	exit(0)
if all((i <= 0 for i in l1)) or s != 0:
	print(-1, -1)
else:
	print(''.join((str(i) for i in l2)), end=' ')
	print(''.join((str(i) for i in l1)))


A = input().split()
m = int(A[0])
s = int(A[1])
if m == 1:
	if s >= 10:
		print(-1, -1)
	else:
		print(s, s)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	k = s // 9
	l = s % 9
	q = (s - 1) % 9
	a = 0
	b = 0
	if l != 0:
		if 9 * m > s > 9 * (m - 1):
			for i in range(m - 1):
				a = a + 9 * 10 ** i
				b = b + 9 * 10 ** (m - 1 - i)
			a = a + l * 10 ** (m - 1)
			b = b + l
		if s < 9 * (m - 1):
			for i in range(k):
				a = a + 9 * 10 ** i
				b = b + 9 * 10 ** (m - 1 - i)
			a = a + q * 10 ** k + 10 ** (m - 1)
			b = b + (q + 1) * 10 ** (m - k - 1)
	if l == 0:
		for i in range(k - 1):
			a = a + 9 * 10 ** i
			b = b + 9 * 10 ** (m - 1 - i)
		a = a + 8 * 10 ** (k - 1) + 10 ** (m - 1)
		b = b + 9 * 10 ** (m - k)
	print(a, b)


a = input().split()
m = int(a[0])
s = int(a[1])
if s == 0 and m != 1 or 9 * m < s:
	max_ = '-1'
	min_ = '-1'
elif s == 0 and m == 1:
	max_ = '0'
	min_ = '0'
elif s < m and s != 0:
	if s <= 9:
		max_ = a[1] + '0' * (m - 1)
	else:
		l = s // 9
		k = s % 9
		max_ = '9' * l + str(k) + '0' * (m - l - 1)
	min_ = '1' + '0' * (m - s) + '1' * (s - 1)
	l = (s - 1) // 9
	k = (s - 1) % 9
	min_ = '1' + '0' * (m - l - 2) + str(k) + '9' * l
elif 9 * (m - 1) < s and 9 * m > s:
	l = str(s % 9)
	max_ = '9' * (m - 1) + l
	min_ = l + '9' * (m - 1)
elif 9 * m == s:
	max_ = '9' * m
	min_ = max_
else:
	l = s // 9
	k = s % 9
	max_ = '9' * l + str(k) + '0' * (m - l - 1)
	if k != 0:
		min_ = '1' + '0' * (m - l - 2) + str(k - 1) + '9' * l
	else:
		min_ = '1' + '0' * (m - l - 1) + '8' + '9' * (l - 1)
print(min_ + ' ' + max_)


(m, s) = [int(x) for x in input().split()]
ans1 = []
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif 9 * m < s:
	print(-1, -1)
else:
	for i in range(m - 1):
		ans1.insert(0, max(min(9, s - sum(ans1) - 1), 0))
	ans1.insert(0, min(9, s - sum(ans1)))
	ans2 = []
	for i in range(m):
		ans2.append(min(9, s - sum(ans2)))
	ans11 = ''
	for v in ans1:
		ans11 += str(v)
	ans22 = ''
	for v in ans2:
		ans22 += str(v)
	print(ans11, ans22)


def min_n(m, s, n):
	n += pow(10, m - 1)
	s -= 1
	i = 0
	while s > 0:
		if s > 9:
			n += 9 * pow(10, i)
			s -= 9
			i += 1
		else:
			n += s * pow(10, i)
			s -= s * pow(10, i)
			i += 1
	return n

def max_n(m, s, n):
	i = m - 1
	while s > 0:
		if s > 9:
			n += 9 * pow(10, i)
			s -= 9
			i -= 1
		else:
			n += s * pow(10, i)
			s = 0
			i -= 1
	return n
n = 0
(m, s) = input().split()
m = int(m)
s = int(s)
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	n1 = n
	print(min_n(m, s, n), max_n(m, s, n1))


l = [int(i) for i in input().split()]
result = []
refer = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
if l[0] * 9 < l[1]:
	print(-1, -1)
elif l[0] != 1 and l[1] == 0:
	print(-1, -1)
else:
	for i in range(10):
		while l[1] >= refer[-(i + 1)]:
			l[1] = l[1] - refer[-(i + 1)]
			result.append(refer[-(i + 1)])
			if len(result) > 2:
				if result[-2] == 0:
					break
	a = str(result[0])
	if len(result) - 2 < l[0]:
		b = '1'
		for i in range(1, len(result) - 1):
			a = a + str(result[i])
		a = a.ljust(l[0], '0')
		b = b.ljust(l[0] - (len(result) - 2), '0')
		result[-3] = result[-3] - 1
		for i in range(len(result) - 2):
			b += str(result[-(i + 3)])
		print(b, a)
	else:
		b = str(result[-3])
		for i in range(1, len(result) - 2):
			a = a + str(result[i])
		for i in range(1, len(result) - 2):
			b = b + str(result[-(i + 3)])
		print(b, a)


(m, s) = map(int, input().split())
lmin = [0] * (m - 1)
lmin.insert(0, 1)
sum1 = sum(lmin)
lmax = [9] * m
sum2 = sum(lmax)
x = ''
y = ''
flag = 1
if m == 0:
	print(-1, -1)
elif m == 1 and (s >= 0 and s <= 9):
	print(s, s)
elif m > 1 and (s >= 1 and s <= m * 9):
	if sum1 == s:
		for i in lmin:
			x = x + str(i)
	else:
		j = m - 1
		while j >= 0:
			if sum1 + 9 >= s:
				if j == 0:
					a = s - sum1 + 1
					sum1 = sum1 + a - 1
				else:
					a = s - sum1
					sum1 = sum1 + a
				lmin[j] = a
				break
			else:
				sum1 = sum1 + 9
				lmin[j] = 9
				j = j - 1
		if sum(lmin) == s:
			for i in lmin:
				x = x + str(i)
		else:
			flag = 0
			print(-1, -1)
	if flag == 1:
		if sum2 == s:
			for i in lmax:
				y = y + str(i)
		else:
			j = m - 1
			while j >= 0:
				if sum2 - 9 <= s:
					a = 9 - (sum2 - s)
					lmax[j] = a
					sum2 = sum2 + a - 9
					break
				else:
					sum2 = sum2 - 9
					lmax[j] = 0
					j = j - 1
			if sum2 == s:
				for i in lmax:
					y = y + str(i)
			else:
				flag = 0
				print(-1, -1)
	if flag == 1:
		print(x, y)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
mini = 0
maxi = 0
ost = s % 9
divi = s // 9
if divi == m - 1:
	mini = str(ost) + '9' * divi
	maxi = '9' * divi + str(ost)
	print(mini, maxi, end=' ')
elif m > 1 and s == 9:
	mini = '1' + '0' * (m - 2) + str(int(s) - 1)
	maxi = str(s) + '0' * (m - 1)
	print(mini, maxi, end=' ')
elif divi == 0 and ost != 0:
	mini = '1' + '0' * (m - 2) + str(ost - 1)
	maxi = str(ost) + '0' * (m - 1)
	print(mini, maxi, end=' ')
elif s == 1:
	mini = str(s) + '0' * (m - 1)
	print(mini, mini, end=' ')
elif s < 9 * (m - 1) and s != 0:
	if ost > 1:
		mini = '1' + '0' * (m - divi - 2) + str((ost - 1 + 9) % 9) + '9' * divi
		maxi = '9' * divi + str(ost) + '0' * (m - divi - 1)
		print(mini, maxi, end=' ')
	elif ost == 0:
		mini = '1' + '0' * (m - divi - 1) + str((ost - 1 + 9) % 9) + '9' * (divi - 1)
		maxi = '9' * divi + str(ost) + '0' * (m - divi - 1)
		print(mini, maxi, end=' ')
	else:
		mini = str(ost) + '0' * (m - divi - 1) + '9' * divi
		maxi = '9' * divi + str(ost) + '0' * (m - divi - 1)
		print(mini, maxi, end=' ')
elif int(m) * 9 == int(s):
	print('9' * m, '9' * m, end=' ')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
a = [0 for i in range(m)]
pt = s
for x in range(m):
	if s >= 10:
		a[x] = 9
		s -= 9
	elif s == 0:
		break
	else:
		a[x] = s
		s = 0
(dn, an) = ([int(p) for p in a], [int(p) for p in a])
dn.sort(reverse=True)
an.sort()
if an[0] == 0:
	for q in range(1, len(an)):
		if an[q] != 0:
			an[0] += 1
			an[q] -= 1
			break
dn.sort(reverse=True)
if sum(an) == sum(dn) == pt != 0 or (m == 1 and pt == 0):
	for t in an:
		print(t, end='')
	print(' ', end='')
	for t in dn:
		print(t, end='')
else:
	print('-1 -1')


def sumDigits(S):
	return sum((int(ch) for ch in S))

def soln(m, s):
	sOrig = s
	maxStr = []
	for _ in range(m):
		curr = min(s, 9)
		s -= curr
		maxStr.append(str(curr))
	maxVal = int(''.join(maxStr))
	if len(str(maxVal)) != m or s != 0:
		return '-1 -1'
	minStr = maxStr[::-1]
	if minStr[0] == '0':
		for (i, ch) in enumerate(minStr):
			if ch != '0':
				minStr[0] = '1'
				minStr[i] = str(int(ch) - 1)
				break
	minVal = int(''.join(minStr))
	if len(str(minVal)) != m or sumDigits(minStr) != sOrig:
		return '-1 -1'
	return f'{minVal} {maxVal}'

def main():
	(m, s) = [int(x) for x in input().split(' ')]
	result = soln(m, s)
	print(result)

def randomTest():
	for m in range(1, 101):
		for s in range(901):
			soln(m, s)
main()


def main():
	import sys
	(a, b) = map(int, sys.stdin.readline().split())
	if not a:
		maxim = '-1'
		minim = '-1'
	elif not b:
		if a == 1:
			maxim = '0'
			minim = '0'
		else:
			maxim = '-1'
			minim = '-1'
	else:
		maxim = 0
		n = b
		while n:
			if 9 > n:
				maxim = maxim * 10 + n
				n = 0
			else:
				n -= 9
				maxim = maxim * 10 + 9
		s = str(maxim)
		diff = a - len(s)
		if diff < 0:
			maxim = '-1'
		elif diff > 0:
			maxim = s + '0' * diff
		else:
			maxim = s
		if diff:
			if diff < 0:
				minim = '-1'
			else:
				s = maxim[::-1]
				for i in range(len(s)):
					if int(s[i]):
						break
				minim = '1' + '0' * (i - 1) + str(int(s[i]) - 1) + s[i + 1:]
		else:
			minim = maxim[::-1]
	sys.stdout.write(minim + ' ' + maxim + '\n')
main()


x = input().split()
m = int(x[0])
s = int(x[1])
if s > 9 * m:
	print('-1 -1')
elif s == 0 and m > 1:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	a = s // 9
	q = '9' * a + str(s - 9 * a) * min(1, m - a) + '0' * (m - a - 1)
	if s > (m - 1) * 9:
		p = str(s - a * 9) * (m - a) + '9' * a
	elif s % 9 == 0:
		p = '1' + '0' * (m - a - 1) + '8' + '9' * (a - 1)
	else:
		p = '1' + '0' * (m - a - 2) + str(s - a * 9 - 1) + '9' * a
	print(p, q)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0' + ' ' + '0')
	exit(0)
if m == 0 or s > 9 * m or (s == 0 and m != 1):
	print('-1' + ' ' + '-1')
	exit(0)
sumV = 0
for i in range(m):
	temp = 1 if i == 0 else 0
	while s - sumV - temp > 9 * (m - (i + 1)) and temp < 9:
		temp += 1
	sumV += temp
	print(temp, end='')
sumV = 0
print(' ', end='')
for i in range(m):
	temp = 9
	while sumV + temp > s and temp > 0:
		temp -= 1
	sumV += temp
	print(temp, end='')


(m, s) = map(int, input().split())
t = s
x = ['0'] * m
y = ['0'] * m
if s == 0 and m > 1:
	print(-1, -1)
elif s / m > 9:
	print(-1, -1)
else:
	i = 0
	while 1:
		p = s - 9
		if p >= 0:
			x[i] = str(9)
			i += 1
			s -= 9
			if i >= m:
				break
		else:
			x[i] = str(p + 9)
			break
	x = ''.join(x)
	i = 1
	d = 1
	k = 0
	s = t
	while 1:
		if d == m:
			y[k] = str(s)
			break
		q = (s - i) / (m - d)
		if q <= 9:
			y[k] = str(i)
			s = s - i
			i = 0
			d += 1
			k += 1
			if d == m:
				y[k] = str(s)
				break
		else:
			i += 1
	y = ''.join(y)
	print(y, x)


n = input().split()
min = ''
max = ''
if int(n[0]) == 1 and int(n[1]) == 0:
	print(0, 0)
elif int(n[1]) == 0 or int(n[0]) * 9 < int(n[1]):
	print(-1, -1)
elif int(n[1]) == 9 * int(n[0]):
	print('9' * int(n[0]), '9' * int(n[0]))
else:
	a = int(n[1]) // 9
	b = int(n[1]) - 9 * a
	c = int(n[0]) - a - 1
	max = '9' * a + str(b)
	for i in range(c):
		max = max + '0'
	d = (int(n[1]) - 1) // 9
	e = int(n[1]) - 9 * d - 1
	f = int(n[0]) - d - 2
	if f >= 0:
		for i in range(f):
			min = min + '0'
		min = '1' + min + str(e) + '9' * d
	else:
		e = 1 + e
		min = str(e) + '9' * d
	print(min, max)


(m, s) = map(int, input().split())
if s <= 9 * m:
	if m > 1 and s == 0:
		print(-1, -1)
	elif m == 1:
		print(s, s)
	elif s == 1:
		val = pow(10, m - 1)
		print(val, val)
	else:
		li = [0] * m
		li[0] = 1
		li[m - 1] = s - 1
		i = m - 1
		while i > 0:
			if li[i] > 9:
				li[i - 1] = li[i - 1] + (li[i] - 9)
				li[i] = 9
			i = i - 1
		min = int(''.join((str(n) for n in li)))
		li = [0] * m
		li[0] = s
		i = 0
		while i < m - 1:
			if li[i] > 9:
				li[i + 1] = li[i + 1] + (li[i] - 9)
				li[i] = 9
			i = i + 1
		max = int(''.join((str(n) for n in li)))
		print(min, max)
else:
	print(-1, -1)


line = input()
(m, s) = [int(i) for i in line.split()]
s_max = s
s_min = s
if m * 9 < s:
	print(-1, -1)
elif s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	min = ''
	max = ''
	for i in range(m):
		if s_max - 9 <= 0:
			max += str(s_max)
			s_max = 0
		else:
			max += '9'
			s_max -= 9
		if s_min == 1:
			if i == m - 1:
				min = '1' + min
			else:
				min = '0' + min
		elif s_min - 9 <= 0:
			if m - i == 1:
				min = str(s_min) + min
			else:
				min = str(s_min - 1) + min
				s_min = 1
		else:
			min = '9' + min
			s_min -= 9
	print(min, max)


(n, s) = map(int, input().split())
(S1, S2) = ('', '')
s1 = s2 = s
if 9 * n < s or (s == 0 and n != 1):
	print('-1 -1')
elif n == 1 and s == 0:
	print('0 0')
else:
	for i in range(n):
		if 9 * (n - i) == s1:
			S1 += '9'
			s1 -= 9
		elif s1 + 9 >= 9 * (n - i) > s1:
			X = s1 // 9
			Y = s1 - 9 * X
			S1 += str(Y)
			s1 -= Y
		elif i == 0:
			S1 += '1'
			s1 -= 1
		else:
			S1 += '0'
		if s2 >= 9:
			S2 += '9'
			s2 -= 9
		else:
			S2 += str(s2)
			s2 = 0
print(S1 + ' ' + S2)


(m, s) = [int(i) for i in input().split()]
minS = [0 for i in range(m)]
maxS = [0 for i in range(m)]
(smin, smax) = (s, s)
if m == 1 and s < 10:
	print(s, s)
elif s == 0 or s > 9 * m:
	print('-1 -1')
elif s == 9 * m:
	print('9' * m + ' ' + '9' * m)
else:
	minS[0] = 1
	smin -= 1
	maxS[:smax // 9] = [9 for i in range(smax // 9)]
	if smax % 9 != 0:
		maxS[smax // 9] += smax % 9
	if smin // 9 != 0:
		minS[-(smin // 9):] = [9 for i in range(smin // 9)]
	if smin % 9 != 0:
		minS[m - smin // 9 - 1] += smin % 9
	print(''.join([str(i) for i in minS]), ''.join([str(i) for i in maxS]))


def Main():
	(m, s) = map(int, input().split())
	nnines = s // 9
	remd = s % 9
	ans1 = ''
	ans2 = ''
	if s == 0:
		if m > 1:
			print('-1 -1')
		else:
			print('0 0')
	elif m * 9 < s:
		print('-1 -1')
	elif nnines == m:
		ans1 += '9' * m
		print(ans1 + ' ' + ans1)
	elif nnines == m - 1:
		if remd == 0:
			ans1 += '18' + (nnines - 1) * '9'
		else:
			ans1 += str(remd) + nnines * '9'
		ans2 += nnines * '9' + str(remd) + (m - nnines - 1) * '0'
		print(ans1 + ' ' + ans2)
	else:
		if remd == 0:
			ans1 += '1' + (m - nnines - 1) * '0' + '8' + (nnines - 1) * '9'
		else:
			ans1 += '1' + (m - nnines - 2) * '0' + str(remd - 1) + nnines * '9'
		ans2 += nnines * '9' + str(remd) + (m - nnines - 1) * '0'
		print(ans1 + ' ' + ans2)
Main()


(m, s) = map(int, input().split())
print([f'{int(10 ** (m - 1) + ((s - 1) % 9 + 1) * 10 ** ((s - 1) // 9) - 1)} {int(10 ** m - 10 ** (m - (s - 1) // 9 - 1) * (9 - (s - 1) % 9))}', '-1 -1'][s > 9 * m or (s < 1 and m != 1)])


def abc():
	(m, s) = input().split()
	(m, s) = (int(m), int(s))
	if s == 0:
		if m == 1:
			print(0, 0)
			return
		else:
			print(-1, -1)
			return
	maxi = []
	mini = []
	for i in range(m):
		t = min(9, s)
		maxi.append(t)
		s -= t
	if s > 0:
		print(-1, -1)
		return
	mini = maxi[::-1]
	for k in range(len(mini)):
		if mini[k] != 0:
			break
	mini[0] += 1
	mini[k] -= 1
	for i in mini:
		print(i, end='')
	print('', end=' ')
	for j in maxi:
		print(j, end='')
	return
abc()


(m, s) = [int(i) for i in input().split()]
if m == 1 and s == 0:
	print(0, 0)
elif 9 * m < s or 1 > s:
	print('-1 -1')
else:
	mx = ''
	while len(mx) < m and sum([int(i) for i in mx]) + 9 <= s:
		mx += '9'
	if sum([int(i) for i in mx]) != s:
		mx += str(s - sum([int(i) for i in mx]))
	while len(mx) < m:
		mx += '0'
	mn = list(mx[::-1])
	if mn[0] == '0':
		mn[0] = '1'
		for i in range(1, len(mn)):
			if mn[i] != '0':
				mn[i] = str(int(mn[i]) - 1)
				break
	print(''.join(mn), mx)


(n, sm) = map(int, input().split())
if sm == 0 and n == 1:
	print(0, 0)
elif sm == 0 or sm > n * 9:
	print(-1, -1)
else:
	big = '9' * (sm // 9)
	if sm % 9 > 0:
		big += str(sm % 9)
	zeroes = n - len(big)
	big += '0' * zeroes
	if zeroes == 0:
		small = big[::-1]
	else:
		sm -= 1
		n -= 1
		biggy = '9' * (sm // 9)
		if sm % 9 > 0:
			biggy += str(sm % 9)
		zero = n - len(biggy)
		biggy += '0' * zero
		small = '1' + biggy[::-1]
	print(small, big)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s < 1 or s > 9 * m:
	print('-1 -1')
else:
	d = {}
	for i in range(9, -1, -1):
		d[i] = s // i
		s = s % i
		if s == 0:
			break
	big = ''
	for i in d:
		if d[i] == 0:
			continue
		else:
			big += str(i) * d[i]
	big += str(0) * (m - len(big))
	if big[m - 1] != '0':
		print(big[::-1] + ' ' + big)
	else:
		f = 0
		for i in big[::-1]:
			if i == '0':
				f += 1
			else:
				break
		small = str(int(big) - int('9' * f))
		if int(small) == 1:
			small = (m - 1) * '0' + small
		print(small[::-1] + ' ' + big)


(n, m) = map(int, input().split())
if m == 0 and n != 1 or m > 9 * n:
	print('-1 -1')
elif m == 0 and n == 1:
	print('0 0')
else:
	ans_max = ''
	while m:
		if m >= 9:
			m -= 9
			ans_max += '9'
		else:
			ans_max += str(m)
			m = 0
	ans_max += '0' * (n - len(ans_max))
	ans_min = ''
	if ans_max[n - 1] == '0':
		ans_min += '1'
		a = ans_max[::-1]
		for i in range(1, len(a)):
			if a[i] == '0':
				ans_min += '0'
			else:
				ans_min += str(int(a[i]) - 1)
				break
		for j in range(i + 1, n):
			ans_min += a[j]
	else:
		ans_min = ans_max[::-1]
	print(ans_min, ans_max)


[m, s] = [int(x) for x in input().split()]
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or m * 9 < s:
	print('-1 -1')
else:
	mi = ''
	sm = 0
	for i in range(0, m):
		b = 0
		if i == 0:
			b = 1
		for dig in range(b, 10):
			if sm + dig + 9 * (m - 1 - i) >= s:
				mi += str(dig)
				sm += dig
				break
	ma = ''
	sm = 0
	for i in range(0, m):
		b = 0
		for dig in range(10):
			dig1 = 9 - dig
			if sm + dig1 <= s:
				ma += str(dig1)
				sm += dig1
				break
	print(mi, ma)


(m, s) = map(int, input().split())
minres = []
maxres = []
if s == 0 and m > 1:
	maxres = ['-1']
	minres = ['-1']
if m and s:
	if s <= 9:
		maxres = [str(s)] + (m - 1) * ['0']
	elif 9 * m > s:
		maxres = ['9'] * (s // 9) + [str(s % 9)] + (m - (s // 9 + 1)) * ['0']
	elif 9 * m == s:
		maxres = ['9'] * (s // 9)
	else:
		maxres = ['-1']
currentsum = 0
if m and s:
	minres = ['0'] * m
	for i in range(m):
		if s - currentsum <= 9 and i == m - 1:
			minres[i] = str(s - currentsum)
		elif s - currentsum <= 9 and i != m - 1:
			minres[i] = str(s - currentsum - 1)
			minres[m - 1] = '1'
			break
		elif s - currentsum > 9:
			minres[i] = '9'
			currentsum += 9
	minres.reverse()
if 9 * m < s:
	minres = ['-1']
if s == 0 and m == 1:
	maxres = ['0']
	minres = ['0']
print(''.join(minres), end=' ')
print(''.join(maxres))


(m, s) = map(int, input().split())
a = [[]] * (m + 1)
b = [[]] * (m + 1)
for i in range(m + 1):
	a[i] = ['-1'] * (s + 1)
	b[i] = ['-1'] * (s + 1)
for j in range(1, min(s, 9) + 1):
	a[1][j] = str(j)
	b[1][j] = str(j)
for i in range(2, m + 1):
	a1 = a[i - 1]
	b1 = b[i - 1]
	for j1 in range(s + 1):
		if a1[j1] != '-1':
			for d in range(10):
				j = j1 + d
				if j > s:
					break
				new_val = a1[j1] + str(d)
				if a[i][j] == '-1' or new_val < a[i][j]:
					a[i][j] = new_val
		if b1[j1] != '-1':
			for d in range(10):
				j = j1 + d
				if j > s:
					break
				new_val = b1[j1] + str(d)
				if b[i][j] == '-1' or new_val > b[i][j]:
					b[i][j] = new_val
a[1][0] = '0'
b[1][0] = '0'
print(a[m][s], b[m][s])


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print('0 0')
	exit()
if s > 9 * m or s < 1:
	print('-1 -1')
	exit()
ans = ''
for _ in range(0, m):
	x = min(9, s)
	ans += str(x)
	s -= x
ans1 = list(ans)
ans1.reverse()
for x in range(0, m):
	if ans1[x] != '0':
		ans1[0] = str(int(ans1[0]) + 1)
		ans1[x] = str(int(ans1[x]) - 1)
		break
print(''.join(ans1) + ' ' + ans)


(m, n) = [int(i) for i in input().split()]
if m == 1 and n == 0:
	print('0 0')
elif n == 0 or m * 9 < n:
	print('-1 -1')
else:
	a = (n - 1) // 9
	b = str((n - 1) % 9)
	d = str(int(b) + 1)
	if a + 1 == m:
		list_min = [d]
		for i in range(m - 1):
			list_min.append('9')
		else:
			c = 0
		p = ''.join(list_min)
		list_min.reverse()
		q = ''.join(list_min)
	else:
		list_min = ['1']
		if m == 1:
			p = q = n
		elif m == 2:
			p = 10 + n - 1
			q = 10 * n
		else:
			for i in range(m - a - 2):
				list_min.append('0')
			else:
				c = 0
			list_min.append(b)
			for i in range(a):
				list_min.append('9')
			p = ''.join(list_min)
			list_min.reverse()
			q = int(''.join(list_min))
			q = q - 1 + 10 ** (m - a - 1)
	print(p, q)


m = list(map(int, input().split()))
n = m[0]
s = m[1]
if 9 * n < s or (n > 1 and s == 0):
	print('-1 -1')
	exit()
num = []
while s > 0:
	if s <= 9:
		num.append(str(s))
		s = 0
	else:
		num.append(str(9))
		s = s - 9
while len(num) != n:
	num.append(str(0))
s1 = num[::-1]
if n > 1:
	i = 0
	if s1[i] == '0':
		while s1[i] == '0' and i < n:
			i = i + 1
		s1[i] = chr(ord(s1[i]) - 1)
		s1[0] = '1'
a = ''
b = ''
for ele in s1:
	a = a + ele
for ele in num:
	b = b + ele
print(a, ' ', b)


input2 = input().split()
(m, s) = (int(input2[0]), int(input2[1]))

def digitsum(m, s):
	if m == 1 and s == 0:
		print(0, 0)
		return
	if s > 9 * m or s < 1:
		print(-1, -1)
		return
	n9 = s // 9
	r9 = s % 9
	if n9 == 0:
		print(10 ** (m - 1) + r9 - 1)
		print(r9 * 10 ** (m - 1))
		return
	if r9 == 0:
		minn = 10 ** (m - 1)
		for i in range(n9):
			if i == n9 - 1:
				minn += 8 * 10 ** i
				continue
			minn += 9 * 10 ** i
	elif n9 == m - 1:
		minn = r9 * 10 ** (m - 1)
		for i in range(n9):
			minn += 9 * 10 ** i
	else:
		minn = 10 ** (m - 1)
		for i in range(n9):
			minn += 9 * 10 ** i
		minn += (r9 - 1) * 10 ** n9
	maxn = 0
	for i in range(n9):
		maxn += 9 * 10 ** (m - 1 - i)
	if m > n9:
		maxn += r9 * 10 ** (m - 1 - n9)
	print(minn)
	print(maxn)
	return
digitsum(m, s)


(m, s) = map(int, input().split())
if s == 0 and m > 1:
	print(-1, -1)
elif s > m * 9:
	print(-1, -1)
elif s % 9 == 0 and m > 1:
	x = '9' * (s // 9)
	if m - s // 9 >= 1:
		d = '8'
		x = '1'
		y = '9' * (s // 9 - 1)
		z = m - (s // 9 + 1)
		min = x + '0' * z + d + y
		max = '9' * (s // 9) + '0' * (m - s // 9)
		print(min, max)
	elif m == s // 9:
		print(x, x)
else:
	x = s // 9
	a = '9' * x
	r = s - 9 * x
	if m - x > 1:
		b = '1'
		z = m - x - 2
		c = '0' * z
		d = b + c + str(r - 1)
		min = d + a
		p = str(r)
		d = a + p
		z = m - x - 1
		c = '0' * z
		max = d + c
	elif m - x == 1:
		b = str(r)
		min = b + a
		max = a + b
	elif m - x == 0:
		min = a
		max = a
	print(min, max)


def find_length_sum_digits(m, s):
	if m * 9 < s or (s == 0 and m != 1):
		return '-1 -1'
	digits = []
	length = m - 1
	while length != 0:
		for i in range(9, -1, -1):
			if 1 <= s - i <= 9 * length:
				s -= i
				digits.insert(0, str(i))
				break
		length -= 1
	digits.insert(0, str(s))
	min_n = ''.join(digits)
	try:
		first_zero_index = min_n.index('0')
		last_zero_index = min_n.rindex('0')
		max_n = (min_n[first_zero_index:last_zero_index + 1] + min_n[:first_zero_index] + min_n[last_zero_index + 1:])[::-1]
	except ValueError:
		max_n = min_n[::-1]
	max_n = [int(e) for e in list(max_n)]
	for i in range(1, len(max_n)):
		max_add = min(9 - max_n[i - 1], max_n[i])
		max_n[i - 1] += max_add
		max_n[i] -= max_add
	return min_n + ' ' + ''.join([str(e) for e in max_n])
(m, s) = [int(e) for e in input().split()]
print(find_length_sum_digits(m, s))


(n, s) = map(int, input().split())
if n == 1 and s < 10:
	print(s, s)
elif n == 1 or n * 9 < s or s == 0:
	print(-1, -1)
else:
	(t, r) = (s, [])
	for _ in range(n):
		r += [min(9, t)]
		t -= min(9, t)
	a = ''.join(map(str, r))
	r = r[::-1]
	if r[0] == 0:
		i = 1
		while r[i] == 0:
			i += 1
		r[0] += 1
		r[i] -= 1
	while r[0] > 1 and r[1] < 9:
		(r[0], r[1]) = (r[0] - 1, r[1] + 1)
	for i in range(1, n - 1):
		while r[i] > 0 and r[i + 1] < 9:
			(r[i], r[i + 1]) = (r[i] - 1, r[i + 1] + 1)
	print(''.join(map(str, r)) + ' ' + a)


(n, k) = map(int, input().split())
if n == 1 and k == 0:
	print(0, 0)
elif k > n * 9 or n < 1 or k < 1:
	print('-1 -1')
else:
	a = k // 9
	b = k % 9
	biggest = str(9) * a + str(b) + str(0) * (n - a - 1)
	smallest = str(1) + str(0) * (n - a - 2) + str(b - 1) + str(9) * a
	if b == 0:
		biggest = str(9) * a + str(0) * (n - a)
		smallest = str(1) + str(0) * (n - a - 1) + str(8) + str(9) * (a - 1)
	if biggest.count('0') == 0:
		smallest = biggest[::-1]
	print(smallest, biggest)


line = input().split()
m = int(line[0])
S = int(line[1])
if S == m * 9:
	print('9' * m + ' ' + '9' * m)
elif int(line[1]) <= 0 or int(line[1]) > 9 * m:
	if m == 1 and S == 0:
		print('0 0')
	else:
		print('-1 -1')
elif m == 1:
	print('{} {}'.format(S, S))
elif S <= 9:
	x = '{}'.format(S) + '0' * (m - 1)
	y = '1' + '0' * (m - 2) + '{}'.format(S - 1)
	print('{} {}'.format(y, x))
else:
	xx = int(S / 9)
	yu = S % 9
	x = '9' * xx + '%.d' % yu + '0' * (m - xx - 1)
	yu = S % 9
	if yu >= 1 and xx == m - 1:
		y = '%.d' % yu + '9' * xx
	else:
		y = '1' + '0' * (m - xx - 2) + '%.d' % (yu - 1) + '9' * xx
		if yu == 0:
			y = '1' + '0' * (m - xx - 1) + '8' + '9' * (xx - 1)
	print('{} {}'.format(y, x))


(m, s) = map(int, input().split())
sum = s
mus = m
sum_m = s
ans_min = ''
ans_max = ''
while mus != 0:
	min_d = 0
	if ans_min == '':
		min_d = 1
	ost = max(sum_m - 9 * (mus - 1), 0)
	cur_d = max(min_d, ost)
	ans_min += str(cur_d)
	sum_m -= cur_d
	if sum >= 9:
		ans_max += '9'
		sum -= 9
		mus -= 1
	else:
		ans_max += str(sum)
		sum = 0
		mus -= 1
if m == 1 and s == 0:
	print(0, 0)
elif sum != 0 or sum_m != 0:
	print(-1, -1)
else:
	print(ans_min, ans_max)


def c489(x, y):
	if y == 0:
		if x == 1:
			return (0, 0)
		else:
			return (-1, -1)
	if y > 9 * x:
		return (-1, -1)
	m = y // 9
	n = y - 9 * m
	if m == x:
		return (int('9' * x), int('9' * x))
	s1 = '9' * m + str(n) + '0' * (x - m - 1)
	if n > 0:
		if x - m - 1 == 0:
			s2 = str(n) + '9' * m
		else:
			s2 = '1' + '0' * (x - m - 2) + str(n - 1) + '9' * m
	else:
		s2 = '1' + '0' * (x - m - 1) + '8' + '9' * (m - 1)
	return (int(s2), int(s1))
(a, b) = input().split()
(m, n) = c489(int(a), int(b))
print(m, n)


(m, s) = map(int, input().split())
if s / m > 9:
	maxim = -1
elif s == 0 and m > 1:
	maxim = -1
else:
	maxim = ''
	s_dup = s
	while s_dup > 0:
		if s_dup >= 9:
			s_dup -= 9
			maxim += '9'
		else:
			maxim += str(s_dup)
			s_dup = 0
	while len(maxim) < m:
		maxim += '0'
if s == 0 and m > 1:
	minim_ans = -1
elif s / m > 9:
	minim_ans = -1
elif s == 0:
	minim_ans = 0
else:
	first_digit = s - (m - 1) * 9
	if first_digit <= 0:
		first_digit = 1
	minim = [first_digit]
	s_dup = s - first_digit
	while s_dup > 0:
		if s_dup >= 9:
			s_dup -= 9
			minim.append(9)
		else:
			minim.insert(1, s_dup)
			s_dup = 0
	while len(minim) < m:
		minim.insert(1, 0)
	minim_ans = ''
	for i in minim:
		minim_ans += str(i)
print(minim_ans, maxim)


def get_min(sm, ln):
	if sm == 0:
		return '-1' if ln > 1 else '0'
	if sm < 10 and ln == 1:
		return str(sm)
	elif sm < 10 and ln > 1:
		return '1%s%s' % ('0' * (ln - 2), sm - 1)
	else:
		return '%s%s' % (get_min(sm - 9, ln - 1), 9)

def get_max(sm, ln):
	if sm == 0:
		return -1 if ln > 1 else '0'
	if sm < 10 and ln == 1:
		return str(sm)
	elif sm < 10 and ln > 1:
		return '%s%s' % (sm, (ln - 1) * '0')
	else:
		return '%s%s' % (9, get_max(sm - 9, ln - 1))
(l, s) = map(int, input('').split(' '))
if s > l * 9:
	print('-1 -1')
else:
	print(get_min(s, l), get_max(s, l))


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
else:
	(nines, mod) = divmod(s - 1, 9)
	min_number = ''
	if nines < m - 1:
		min_number = '1' + '0' * (m - nines - 2) + str(mod) + '9' * nines
	else:
		min_number = str(mod + 1) + '9' * nines
	(nines, mod) = divmod(s, 9)
	max_number = ''
	if mod:
		max_number = '9' * nines + str(mod) + '0' * (m - nines - 1)
	else:
		max_number = '9' * nines + '0' * (m - nines)
	print(min_number, max_number)


[m, s] = [int(x) for x in input().split(' ')]
if m == 1 and s == 0:
	print(0, 0)
elif 9 * m < s or s < 1:
	print('-1 -1')
else:
	smallest = [1] + [0] * (m - 1)
	largest = [9] * m
	d = s - sum(smallest)
	i = -1
	while d > 9:
		d -= 9
		smallest[i] = 9
		i -= 1
	if d > 0:
		smallest[i] += d
	d = sum(largest) - s
	i = -1
	while d > 9:
		d -= 9
		largest[i] = 0
		i -= 1
	if d > 0:
		largest[i] -= d
	print(''.join([str(x) for x in smallest]), ''.join([str(x) for x in largest]))


(m, s) = map(int, input().split())
num_min = [1]
num_max = [9]
for i in range(m - 1):
	num_min.append(0)
	num_max.append(9)
if s > 0:
	i = 0
	while i < m:
		if sum(num_min) < s:
			while sum(num_min) < s and i < m:
				if s - sum(num_min) >= 9:
					num_min[-1 - i] = 9
					i += 1
				else:
					num_min[-1 - i] = num_min[-1 - i] + (s - sum(num_min))
					i += 1
		elif sum(num_min) == s:
			break
	i = 0
	while i < m:
		if sum(num_max) > s:
			while sum(num_max) > s and i < m:
				if abs(s - sum(num_max)) >= 9:
					num_max[-1 - i] = 0
					i += 1
				else:
					num_max[-1 - i] = num_max[-1 - i] - abs(s - sum(num_max))
					i += 1
		elif sum(num_max) == s:
			break
		if i < m:
			i += 1
if s - sum(num_min) == 0 and s - sum(num_max) == 0:
	print(*num_min, ' ', *num_max, sep='')
elif s == 0 and m == 1:
	print('0 0')
else:
	print('-1 -1')


n = list(map(int, input().split()))
m = int(n[0])
s = int(n[1])
del n
if s != 0 and m * 9 >= s:
	snumbers = ['9'] * ((s - 1) // 9)
	if m - (s - 1) // 9 == 1:
		if s % 9 == 0:
			snumbers.append(str('9'))
		else:
			snumbers.append(str(s % 9))
	elif m - (s - 1) // 9 > 1:
		snumbers.append(str((s - 1) % 9))
		snumbers = snumbers + ['0'] * (m - (s - 1) // 9 - 2) + ['1']
	snumbers = ''.join(reversed(snumbers))
	lnumbers = ['9'] * (s // 9)
	if m - s // 9 >= 1:
		lnumbers.append(str(s % 9))
		lnumbers = ''.join(lnumbers) + ''.join(['0'] * (m - s // 9 - 1))
	else:
		lnumbers = ''.join(lnumbers)
	print(snumbers + ' ' + lnumbers)
elif m == 1 and s == 0:
	print('0 0')
else:
	print('-1 -1')


X = input().split(' ')
a = int(X[0])
b = int(X[1])
Y = []
Z = []
if b == 0:
	if a == 1:
		print('0 0')
	else:
		print('-1 -1')
if b > 9 * a or b < 0:
	print('-1 -1')
elif b != 0:
	if b < 9 * (a - 1) and b != 0:
		b = b - 1
		counter = 1
		while counter * 9 <= b:
			Y.append(9)
			counter = counter + 1
		Y.append(b - (counter - 1) * 9)
		while len(Y) < a - 1:
			Y.append(0)
		Y.reverse()
		Y = [1] + Y
		for i in range(len(Y)):
			print(Y[i], end='')
		b = b + 1
	elif b >= 9 * (a - 1) and b != 0:
		counter = 1
		while counter * 9 <= b:
			Y.append(9)
			counter = counter + 1
		if b > (counter - 1) * 9:
			Y.append(b - (counter - 1) * 9)
		while len(Y) < a:
			Z.append(0)
		Y.reverse()
		for i in range(len(Y)):
			print(Y[i], end='')
	print(' ', end='')
	if b != 0:
		counter = 1
		while counter * 9 <= b:
			Z.append(9)
			counter = counter + 1
		if b > (counter - 1) * 9:
			Z.append(b - (counter - 1) * 9)
		while len(Z) < a:
			Z.append(0)
		for i in range(len(Z)):
			print(Z[i], end='')


(m, s) = (int(x) for x in input().split())
if m == 1 and s == 0:
	print(0, 0)
	exit()
if s < 1 or s > m * 9:
	print(-1, -1)
	exit()
s1 = s
for i in range(m):
	d = max(s1 - (m - i - 1) * 9, 1 if i == 0 else 0)
	s1 -= d
	print(d, end='')
print(' ', end='')
s2 = s
for i in range(m):
	d = min(s2, 9)
	s2 -= d
	print(d, end='')
print()


ms = input().split()
ms = [int(i) for i in ms]
m = ms[0]
s = ms[1]
if s > 9 * m or (s == 0 and m != 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	numbers = []
	for i in range(m):
		if s > 9:
			numbers.append('9')
			s -= 9
		else:
			numbers.append(str(s))
			s = 0
	max1 = ''.join(numbers)
	zeros = 0
	while '0' in numbers:
		zeros += 1
		numbers.remove('0')
	numbers.sort()
	if zeros != 0:
		numbers[0] = str(int(numbers[0]) - 1)
		numbers.insert(0, '1')
	for i in range(zeros - 1):
		numbers.insert(1, '0')
	min1 = ''.join(numbers)
	print(min1, max1)


(m, s) = map(int, input().split())
if s == 0 and m > 1 or 9 * m < s:
	print('-1 -1')
else:
	mayor = ''
	for i in range(m):
		if s >= 9:
			mayor += '9'
			s -= 9
		else:
			mayor += str(s)
			s -= s
	menor = ''
	temp = 0
	for i in range(m):
		d = mayor[-(i + 1)]
		if i == 0 and d == '0':
			if m == 1:
				menor += d
			else:
				menor += '1'
				temp = 1
		elif d != '0' and temp != 0:
			menor += str(int(d) - 1)
			temp = 0
		else:
			menor += d
	print(menor, mayor)


(m, s) = map(int, input().split())
(mx, mn) = ('', '')
if m == 1 and (not s):
	print(0, 0)
	exit()
if not s or 9 * m < s:
	print(-1, -1)
	exit()
curs = s
for i in range(m):
	l = curs - (m - i - 1) * 9
	if l <= 0:
		if i == 0:
			mn += '1'
			curs -= 1
		else:
			mn += '0'
	elif l >= 0:
		mn += str(l)
		curs -= l
print(mn, end=' ')
curs = s
for i in range(m):
	if curs - 9 >= 0:
		mx += '9'
		curs -= 9
	elif curs > 0:
		mx += str(curs)
		curs = 0
	else:
		mx += '0'
print(mx)


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print('0 0')
elif 9 * n < s or s == 0:
	print('-1 -1')
else:
	x1 = 10 ** (n - 1)
	for i in range(s - 1):
		x1 += 10 ** (i // 9)
	x2 = 0
	for i in range(s):
		x2 += 10 ** (n - 1 - i // 9)
	print(x1, x2)


def min_d(a, b):
	z = [1] + [0] * (a - 1)
	dv = (b - 1) // 9
	md = (b - 1) % 9
	j = 0
	for i in range(dv):
		j -= 1
		z[j] = 9
	z[j - 1] += md
	return z

def max_d(a, b):
	y = [9] * a
	dv = (9 * a - b) // 9
	md = (9 * a - b) % 9
	j = 0
	for i in range(dv):
		j -= 1
		y[j] = 0
	y[j - 1] -= md
	return y
(m, s) = map(int, input().strip().split(' '))
if m == 1 and 0 <= s < 10:
	print(s, s)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	x = min_d(m, s)
	w = max_d(m, s)
	print(''.join([str(i) for i in x]), ''.join([str(j) for j in w]))


(m, s) = map(int, input().split())
if s > 9 * m or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0:
	print('0 0')
else:
	mayor = []
	menor = []
	smenor = s
	for i in range(1, 10):
		if smenor - i <= (m - 1) * 9:
			smenor -= i
			menor.append(str(i))
			break
	for j in range(m - 1):
		for i in range(10):
			if smenor - i <= (m - j - 2) * 9:
				smenor -= i
				menor.append(str(i))
				break
	smayor = s
	for i in range(9, 0, -1):
		if i <= smayor:
			smayor -= i
			mayor.append(str(i))
			break
	for j in range(m - 1):
		for i in range(9, -1, -1):
			if i <= smayor:
				smayor -= i
				mayor.append(str(i))
				break
	print(''.join(menor), ''.join(mayor))


line = [int(k) for k in input().split()]
length = line[0]
dsum = line[1]
maximum = []
minimum = []
if (length == 1) & (dsum == 0):
	print('0 0')
elif (dsum < 1) | (dsum > 9 * length):
	print('-1 -1')
else:
	a = dsum // 9
	b = (dsum - 1) // 9
	for i in range(a):
		maximum.append('9')
	if a < length:
		maximum.append(str(dsum % 9))
	if length - a - 1 > 0:
		for i in range(length - a - 1):
			maximum.append('0')
	for i in range(b):
		minimum.insert(0, '9')
	if length == b:
		minimum.insert(0, '1')
	if length == b + 1:
		minimum.insert(0, str((dsum - 1) % 9 + 1))
	elif length == b + 2:
		minimum.insert(0, str((dsum - 1) % 9))
		minimum.insert(0, '1')
	else:
		minimum.insert(0, str((dsum - 1) % 9))
		for i in range(length - b - 2):
			minimum.insert(0, '0')
		minimum.insert(0, '1')
	print(''.join(minimum), ''.join(maximum))


from sys import stdin, stdout
read = lambda : map(int, stdin.readline().split())
I = lambda : stdin.readline()
(m, s) = read()
if s == 0 and m > 1 or s > 9 * m:
	print(-1, -1)
	exit()
ans1 = ['0' for i in range(m)]
ans2 = ['0' for i in range(m)]
(s1, s2) = (s - 1, s)
for i in range(m - 1, 0, -1):
	if s1 > 9:
		s1 -= 9
		ans1[i] = '9'
	elif s1 > 0:
		ans1[i] = str(s1)
		s1 = 0
ans1[0] = str(s1 + 1)
i = 0
while s2 > 0 and i < m:
	if s2 > 9:
		ans2[i] = '9'
		s2 -= 9
	else:
		ans2[i] = str(s2)
		s2 = 0
	i += 1
f1 = lambda l: ''.join(l)
print(f1(ans1), f1(ans2))


(m, s) = [int(i) for i in input().split()]
if s > 9 * m or (s < 1 and m > 1):
	print(-1, -1)
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
min1 = []
max1 = []
k = s
for i in range(m):
	if k - (i + 1) * 9 > 0:
		min1.append(9)
	else:
		min1.append(max(0, k - i * 9))
		if i < m - 1 and min1[i] > 0:
			min1[i] -= 1
		if i == m - 1 and min1[i] == 0:
			min1[i] += 1
for i in range(len(min1) - 1, -1, -1):
	print(min1[i], end='')
print(' ', end='')
for i in range(m):
	max1.append(9)
	if k - i * 9 < 9:
		max1[i] = k - i * 9
	if k - i * 9 <= 0:
		max1[i] = 0
for i in range(len(max1)):
	print(max1[i], end='')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

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

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
(lens, sum_needed) = read_ints()
if lens == 1 and sum_needed == 0:
	print(0, 0)
elif 9 * lens < sum_needed or sum_needed == 0:
	print(-1, -1)
else:
	answer = 10 ** (lens - 1)
	for i in range(sum_needed - 1):
		answer += 10 ** (i // 9)
	print(answer, end=' ')
	answer = 0
	for i in range(sum_needed):
		answer += 10 ** (lens - 1 - i // 9)
	print(answer, end=' ')


import math
a = input()
a = a.split(' ')
(n, m) = (int(a[0]), int(a[1]))
L = []
H = []
Mmax = n * 9
Mmin = n
low = -1
high = -1
if m == 0 and n > 1:
	low = low
	high = high
elif m == 0 and n == 1:
	low = 0
	high = 0
elif Mmax < m:
	low = low
	high = high
else:
	q = 0
	l = math.ceil(m / 9)
	r = m % 9
	if n != l:
		L.append(1)
		en = (m - 1) // 9
		re = (m - 1) % 9
		for i in range(n - 1 - math.ceil((m - 1) / 9)):
			L.append(0)
		if re != 0:
			L.append(re)
		if en != 0:
			for i in range(en):
				L.append(9)
	elif n == l:
		en = m // 9
		re = m % 9
		if re != 0:
			L.append(re)
		if en != 0:
			for i in range(en):
				L.append(9)
	h = m // 9
	for i in range(h):
		H.append(9)
	H.append(m % 9)
	for i in range(n - h - 1):
		H.append(0)
	high = str(H[0])
	low = str(L[0])
	for i in range(n - 1):
		high = high + str(H[i + 1])
		low = low + str(L[i + 1])
sol = str(low) + ' ' + str(high)
print(sol)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(m, s) = ilele()
if m == 1 and s == 0:
	print(0, 0)
	exit(0)
if s <= 0 or s > 9 * m:
	print(-1, -1)
	exit(0)
s1 = ''
s2 = '1' + '0' * (m - 1)
tot = 0
for i in range(m):
	if tot + 9 <= s:
		s1 += '9'
		tot += 9
	else:
		req = s - tot
		s1 += str(req)
		tot += req
tot = 1
s2 = [*s2]
for i in range(m - 1, -1, -1):
	if tot + 9 <= s:
		s2[i] = '9'
		tot += 9
	else:
		req = s - tot
		if i == 0:
			if req != 0:
				s2[i] = str(req + 1)
		else:
			s2[i] = str(req)
			tot += req
print(''.join(s2), s1)


(n, m) = map(int, input().split())
a = m
z = [0 for i in range(n)]
x = [0 for i in range(n)]
if n == 1 and m == 0:
	print(0, 0)
	exit()
if m == 0:
	print(-1, -1)
	exit()
if m > n * 9:
	print(-1, -1)
	exit()
for i in range(n):
	z[i] += min(9, m)
	m -= z[i]
	if m == 0:
		break
m = a
for i in range(n - 1, -1, -1):
	x[i] += min(9, m)
	m -= x[i]
	if m == 0:
		x[i] -= 1
		x[0] += 1
		break
print(*x, sep='', end=' ')
print(*z, sep='')


(s, m) = [int(i) for i in input().split()]
if m == 0 and s != 1 or 9 * s < m:
	print(-1, -1)
elif m == 0 and s == 1:
	print(0, 0)
else:
	a = m // 9
	b = m % 9
	if b == 0:
		nmax = ''.join(['9' * a, '0' * (s - a)])
		nmin = ''.join(['1' * bool(s - a > 0), '0' * max(s - a - 1, 0), '8' * bool(s - a > 0), '9' * (a - 1) * bool(s - a > 0), '9' * a * bool(s - a == 0)])
	else:
		nmax = ''.join(['9' * a, str(b), '0' * (s - a - 1)])
		nmin = ''.join(['1' * bool(s - a - 1 > 0), '0' * max(s - a - 2, 0), str((b - 1) * bool(s - a - 1 > 0) + b * bool(s - a - 1 == 0)), '9' * a])
	print(nmin, nmax)


import math
(n, s) = map(int, input().split())
count = {}
total = 0
if n == 1 and s == 0:
	print(0, 0)
	exit(0)
s1 = s
for i in range(9, 0, -1):
	count[i] = s // i
	total += count[i]
	s = s % i
if total > n or s1 == 0:
	print(-1, -1)
	exit(0)
m = n
M = ''
for i in range(9, 0, -1):
	m -= count[i]
	M += str(i) * count[i]
M += '0' * m
if total == n:
	for i in range(1, 10):
		print(str(i) * count[i], end='')
else:
	if count[1] >= 1:
		print(1, end='')
		print('0' * (n - total), end='')
		count[1] -= 1
	else:
		for i in range(2, 10):
			if count[i] != 0:
				count[i] -= 1
				count[i - 1] = count.get(i - 1, 0) + 1
				break
		print(1, end='')
		print('0' * (n - total - 1), end='')
	for i in range(1, 10):
		print(str(i) * count[i], end='')
print(' ', end='')
print(M)


(n, m) = map(int, input().split())
if m == 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	mx = ''
	x = m
	for i in range(n):
		if x >= 9:
			mx += '9'
			x -= 9
		else:
			mx += str(x)
			x = 0
	if x > 0:
		mx = -1
	mi = ''
	x = m - 1
	for i in range(n - 1, -1, -1):
		if x >= 9:
			mi += '9'
			x -= 9
		else:
			mi += str(x)
			x = 0
	mi = list(mi[::-1])
	if mi[0] != '9':
		mi[0] = str(int(mi[0]) + 1)
	else:
		mi = [-1]
	if x > 0:
		mi = [-1]
	print(''.join((str(e) for e in mi)), mx)


(m, s) = map(int, input().split())
if (s == 0 or s > 9 * m) and (not (m == 1 and s == 0)):
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	r = s % 9
	q = int((s - r) / 9)
	if q == m:
		keys = 0
	else:
		keys = 1
	ma = [9] * q + [r] * keys + [0] * (m - q - 1)
	ma = str(ma)
	ma = ma.replace(', ', '')
	ma = ma.replace('[', '')
	ma = ma.replace(']', '')
	ma = int(ma)
	if s - 9 * (m - 1) > 1:
		mi = [s - 9 * (m - 1)] + [9] * (m - 1)
		mi = str(mi)
		mi = mi.replace(', ', '')
		mi = mi.replace('[', '')
		mi = mi.replace(']', '')
		mi = int(mi)
	else:
		r = (s - 1) % 9
		q = int((s - 1 - r) / 9)
		if q == m - 1:
			keys = 0
		else:
			keys = 1
		mi = [1] + [0] * (m - 2 - q) + [r] * keys + [9] * q
		mi = str(mi)
		mi = mi.replace(', ', '')
		mi = mi.replace('[', '')
		mi = mi.replace(']', '')
		mi = int(mi)
	print(mi, ma)


(m, s) = [int(i) for i in input().split()]
if s < 1 and m > 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	n = s // 9
	l = s - 9 * n
	mi = 0
	ma0 = [str(9)] * n
	if l != 0:
		ma0.append(str(l))
		for i in range(m - n - 1):
			ma0.append(str(0))
	else:
		for i in range(m - n):
			ma0.append(str(0))
	ma = ''.join(ma0)
	if l != 0:
		for i in range(n):
			mi += 9 * 10 ** i
		if l != 0 and s > 9 * (m - 1) and (n > 0):
			mi += l * 10 ** n
		elif l != 0 and s < 9 * (m - 1) and (n > 0):
			mi += 10 ** (m - 1) + (l - 1) * 10 ** n
		elif l != 0 and n == 0:
			mi += 10 ** (m - 1) + (l - 1)
	elif l == 0 and s == 9 * m:
		mi += 10 ** m - 1
	else:
		mi += 10 ** (m - 1)
		for i in range(n - 1):
			mi += 9 * 10 ** i
		mi += 8 * 10 ** (n - 1)
	print(int(mi), int(ma))


def f(a, b):
	if b == 1:
		return str(b) + '0' * (a - 1)
	if a == 1:
		return str(b)
	c = min(b - 1, 9)
	return f(a - 1, b - c) + str(c)

def g(a, b):
	if b < 10:
		return str(b) + '0' * (a - 1)
	else:
		return '9' + g(a - 1, b - 9)
a = list(map(int, input().split()))
if a == [1, 0]:
	print(0, 0)
elif 1 <= a[1] <= a[0] * 9:
	print(f(a[0], a[1]), g(a[0], a[1]))
else:
	print(-1, -1)


(m, s) = map(int, input().strip().split())
(s1, s2) = (s, s)
l = [0 for x in range(m)]
l1 = [0 for x in range(m)]
for i in range(m):
	if s <= 0:
		break
	for j in range(9, 0, -1):
		if s >= j:
			l[i] = j
			s -= j
			break
for i in range(m):
	if s1 <= 0:
		break
	if i == 0:
		for j in range(1, 10):
			if s1 >= j and s1 - j <= 9 * (m - i - 1):
				l1[i] = j
				s1 -= j
				break
	else:
		for j in range(10):
			if s1 >= j and s1 - j <= 9 * (m - i - 1):
				l1[i] = j
				s1 -= j
				break
if s2 == 0 and m == 1 or (sum(l) == s2 and s2 > 0):
	lr = ''.join(map(str, l))
	sm = ''.join(map(str, l1))
else:
	(lr, sm) = (-1, -1)
print(sm, lr)


p = input().split()
m = int(p[0])
s = int(p[1])
min = max = 0
if 9 * m < s:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif m != 1 and s == 0:
	print('-1 -1')
else:
	a = s % 9
	b = (s - a) / 9
	for i in range(m):
		if i < b:
			min = min + 9 * 10 ** i
			max = max + 9 * 10 ** (m - i - 1)
		elif i == b:
			max = max + a * 10 ** (m - i - 1)
			if b == m - 1:
				min = min + a * 10 ** i
			elif a >= 1 and b < m - 1:
				min = min + (a - 1) * 10 ** i
			else:
				min = min - 10 ** (i - 1)
		if i == m - 1 and b < m - 1:
			min = min + 10 ** i
	print(min, max)


a = input()
(m, s) = a.split()
m = int(m)
s = int(s)
small = [0] * m
big = [0] * m
t = s // 9
if s % 9 == 0:
	t -= 1
if s > 9 * m or (s == 0 and m > 1):
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	for i in range(t):
		big[i] = 9
	big[t] = s - 9 * t
	if big[t] == 0:
		tt = t - 1
	else:
		tt = t
	for i in range(tt + 1):
		small[m - i - 1] = big[i]
	if small[0] == 0:
		small[0] = 1
		small[m - 1 - tt] -= 1
	smallStr = ''
	bigStr = ''
	for i in range(m):
		smallStr += str(small[i])
		bigStr += str(big[i])
	print(smallStr + ' ' + bigStr)


lenght_and_summ = input()
lenght = int(lenght_and_summ.split()[0])
summ = int(lenght_and_summ.split()[1])
if summ == 0 and lenght > 1 or summ > 9 * lenght:
	print('-1 -1')
	quit()
if summ == 0 and lenght == 1:
	print('0 0')
	quit()
min_str = ''
max_str = ''
b = 0
c = 0
for i in range(lenght):
	a = 0
	while b < summ and a < summ and (a < 9):
		a += 1
		b += 1
	max_str = max_str + ' ' + str(a)
min_str = max_str.split()
min_str.reverse()
min_str_new = list()
if min_str[0] == '0':
	min_str_new.append('1')
	ok = True
	count = 0
	for i in min_str:
		count += 1
		if count == 1:
			continue
		elif i == '0':
			min_str_new.append(i)
		elif i != '0' and ok:
			min_str_new.append(str(int(i) - 1))
			ok = False
		else:
			min_str_new.append(i)
	min_str_last = ''
	for i in min_str_new:
		min_str_last = min_str_last + i
else:
	min_str_last = ''
	for i in min_str:
		min_str_last = min_str_last + i
max_str_last = ''
for i in max_str.split():
	max_str_last = max_str_last + i
print(min_str_last, max_str_last)


def can(m, s):
	return s >= 0 and s <= 9 * m
(m, s) = map(int, input().split())
z = s
l = z
minimize = []
for i in range(m):
	if i == 0:
		for j in range(1, 10):
			if can(m - 1, s - j):
				minimize.append(str(j))
				s -= j
				break
	elif i == m - 1:
		for j in range(0, 10):
			if j == s:
				s -= j
				minimize.append(str(j))
				break
	else:
		for j in range(0, 10):
			if can(m - i - 1, s - j):
				s -= j
				minimize.append(str(j))
				break
maximize = []
for i in range(m):
	if i == 0:
		for j in range(9, 0, -1):
			if can(m - 1, z - j):
				maximize.append(str(j))
				z -= j
				break
	elif i == m - 1:
		for j in range(9, -1, -1):
			if j == z:
				maximize.append(str(j))
				z -= j
				break
	else:
		for j in range(9, -1, -1):
			if can(m - i - 1, z - j):
				z -= j
				maximize.append(str(j))
				break
if l == 0 and m == 1:
	print(0, 0)
elif l == 0 or z != 0 or s != 0:
	print(-1, -1)
else:
	print(''.join(minimize), end=' ')
	print(''.join(maximize))


(m, s) = map(int, input().split())
maxi = []
mini = []
line = []
if s > 9 * m:
	print('-1', '-1')
elif m > 1 and s == 0:
	print('-1', '-1')
elif m == 1:
	print(s, s)
else:
	s_ = s
	while s > 9:
		maxi.append(str(9))
		s -= 9
	else:
		maxi.append(str(s))
	if len(maxi) == m:
		pass
	else:
		x = m - len(maxi)
		for i in range(x):
			maxi.append(str(0))
	if s_ <= 9:
		mini.append(str(1))
		for j in range(m - 2):
			mini.append(str(0))
		mini.append(str(s_ - 1))
	elif s_ > (m - 1) * 9:
		mini.append(str(s_ - (m - 1) * 9))
		for t in range(m - 1):
			mini.append(str(9))
	else:
		s_ -= 10
		while s_ > 9:
			line.append(str(9))
			s_ -= 9
		else:
			line.append(str(s_))
		if len(line) == m - 2:
			pass
		else:
			y = m - 2 - len(line)
			for i in range(y):
				line.append(str(0))
		mini.append(str(1))
		for k in range(m - 2 - 1, -1, -1):
			mini.append(str(line[k]))
		mini.append(str(9))
print(''.join(mini), end=' ')
print(''.join(maxi))


(m, s) = map(int, input().split())
if s == 0:
	print(['-1 -1', '0 0'][not m - 1])
	exit()
if s > m * 9:
	print('-1 -1')
	exit()
ma = ''
mi = ''

def max(i, j):
	global ma
	if i < 1:
		print(ma, end=' ')
		return
	if j > 8:
		ma += '9'
		j -= 9
	else:
		ma += str(j)
		j = 0
	i -= 1
	max(i, j)

def min(i, j):
	global mi
	if i == 1:
		mi += str(j)
		print(mi[::-1])
		return
	if j > 9:
		mi += '9'
		j -= 9
	else:
		mi += str(j - 1)
		j = 1
	i -= 1
	min(i, j)
min(m, s)
max(m, s)


(m, s) = map(int, input().rstrip().split(' '))
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s / m > 9:
	print('-1 -1')
else:
	sum1 = s - 1
	minimum = ''
	maximum = ''
	for i in range(m):
		x = min(9, s)
		s -= x
		maximum += str(x)
	for i in range(m - 1):
		x = min(9, sum1)
		sum1 -= x
		minimum = str(x) + minimum
	minimum = str(sum1 + 1) + minimum
	print(minimum, maximum)


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print(0, 0)
elif 9 * n < s or s == 0:
	print(-1, -1)
else:
	res1 = 10 ** (n - 1)
	for i in range(s - 1):
		res1 += 10 ** (i // 9)
	res2 = 0
	for i in range(s):
		res2 += 10 ** (n - 1 - i // 9)
	print(res1, res2)


(m, s) = map(int, input().split())
low = [0] * m
high = [0] * m
if s <= 0 or s > 9 * m:
	low = high = -1
else:
	t = s - 1
	low[0] = 1
	for i in range(1, m + 1):
		if t > 9:
			low[-i] += 9
			t -= 9
		else:
			low[-i] += t
			t = 0
	low = int(''.join(map(str, low)))
	t = s
	for i in range(m):
		if t > 9:
			high[i] += 9
			t -= 9
		else:
			high[i] += t
			t = 0
	high = int(''.join(map(str, high)))
if m == 1 and s == 0:
	low = high = 0
print(low, high)


(m, s) = map(int, input().split())
total = s
k = m - 1
w = []
for i in range(m):
	if total >= 9:
		total -= 9
		w.append(9)
	elif total <= 0:
		w.append(0)
	else:
		w.append(total)
		total -= total
hh = w
W = hh[::-1]
if m == 1 and s == 0:
	print('0 0')
elif s != sum(w) or s == 0 or len(str(s)) > m or (s > m * 9):
	print('-1 -1')
elif W[0] == 0:
	dd = min((i for i in W if i > 0))
	W[W.index(dd)] = dd - 1
	W[0] = 1
	print(''.join([str(i) for i in W]))
	print(''.join([str(mm) for mm in hh]))
else:
	print(''.join([str(i) for i in W]))
	print(''.join([str(mm) for mm in hh]))


import sys
(s, m) = map(int, input().split())
maxi = ''
sume = 0
for i in range(1, s + 1):
	if m - sume - 9 > s - i:
		maxi += '9'
		sume += 9
	elif i == s:
		maxi += str(m - sume)
		sume += m - sume
	else:
		for j in range(9, -1, -1):
			if j <= m - sume:
				maxi += str(j)
				sume += j
				break
mini = ''
if sume != m or len(maxi) > s:
	print(-1, -1, sep=' ')
	sys.exit()
sume = 0
for i in range(1, s + 1):
	if i == 1:
		if m - sume + 1 <= (s - i) * 9:
			mini += '1'
			sume += 1
			continue
	if m - sume <= (s - i) * 9:
		mini += '0'
		sume += 0
	elif i == s:
		mini += str(m - sume)
		sume += m - sume
	else:
		for j in range(10):
			if m - sume - j <= (s - i) * 9:
				mini += str(j)
				sume += j
				break
if sume != m or len(mini) > s:
	print(-1, -1, sep=' ')
	sys.exit()
print(mini, maxi, sep=' ')


pieces = [int(i) for i in input().split()]
m = pieces[0]
s = pieces[1]
if s == 0 and m == 1:
	print(0, 0)
elif s == 0:
	print(-1, -1)
elif 9 * m < s:
	print(-1, -1)
elif s // 9 == m:
	da = [str(9)] * m
	xiao = [str(9)] * m
	print(''.join(xiao), ''.join(da))
elif m == 1:
	print(s, s)
elif s // 9 == 0:
	da = [str(0)] * (m - 1)
	da.insert(0, str(s))
	xiao = [str(0)] * (m - 2)
	xiao.insert(0, str(1))
	xiao.append(str(s - 1))
	print(''.join(xiao), ''.join(da))
else:
	k = int(m - s // 9)
	da = [str(9)] * (s // 9)
	da.append(str(s % 9))
	for i in range(k - 1):
		da.append(str(0))
	small = []
	for i in da:
		small.append(i)
	small.reverse()
	if small[0] == '0':
		n = small[0]
		small[0] = str(1)
		if int(small[k - 1]) > 0:
			small[k - 1] = str(int(small[k - 1]) - 1)
			print(''.join(small), ''.join(da))
		else:
			small[k] = str(8)
			print(''.join(small), ''.join(da))
	else:
		print(''.join(small), ''.join(da))


(m, s) = map(int, input().split())
ans = []
flag = 0
temp = 0
if s != 0:
	while s >= 0 and (s // 9 < m or (s // 9 == m and s % 9 == 0)) and (temp < m):
		flag = 1
		temp += 1
		if s - 9 > 0:
			ans.append(9)
			s -= 9
		else:
			ans.append(s)
			s = 0
			continue
		if s == 0 and temp < m:
			ans.append(0)
if flag:
	ans1 = ''.join(map(str, ans))
	if ans[-1] == 0:
		for i in range(len(ans)):
			if ans[-1 - i] != 0:
				ans[-1 - i] -= 1
				break
		ans[-1] = 1
	ans2 = ''.join(map(str, ans[::-1]))
	print(ans2, ans1)
elif flag == 0 and s == 0 and (m == 1):
	print(0, 0)
else:
	print(-1, -1)


ms = input().split(' ')
m = int(ms[0])
s = int(ms[1])
if s == 0 and m > 1 or m == 0 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	(nums1, nums2) = ([], [])
	(min_s, max_s) = (s, s)
	for i in range(m, 0, -1):
		k = 1
		if i != m:
			k = 0
		if min_s > k + 9 * (i - 1):
			k = min_s - 9 * (i - 1)
		nums1.append(str(k))
		min_s -= k
		k = 9
		if k > max_s:
			k = max_s
		nums2.append(str(k))
		max_s -= k
	print(''.join(nums1), ''.join(nums2))


(m, s) = [int(i) for i in input().split()]
if s <= 0 or s > 9 * m:
	if s == 0 and m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	if s % 9 != 0:
		rem = s // 9
		positions_available = m - rem
		if positions_available >= 2:
			tot_remain = s % 9
			s = '1' + '0' * (positions_available - 2) + str(tot_remain - 1) + '9' * rem
			if tot_remain == 1:
				s1 = '9' * rem + '1' + '0' * (positions_available - 1)
			else:
				s1 = '9' * rem + str(tot_remain) + '0' * (positions_available - 1)
		else:
			tot_remain = s % 9
			s = str(tot_remain) + '9' * rem
			s1 = '9' * rem + str(tot_remain)
	else:
		rem = s // 9
		rem -= 1
		positions_available = m - rem
		if positions_available >= 2:
			tot_remain = 9
			s = '1' + '0' * (positions_available - 2) + str(tot_remain - 1) + '9' * rem
			if tot_remain == 1:
				s1 = '9' * rem + '1' + '0' * (positions_available - 2)
			else:
				s1 = '9' * rem + str(tot_remain) + '0' * (positions_available - 1)
		else:
			tot_remain = 9
			s = str(tot_remain) + '9' * rem
			s1 = '9' * rem + str(tot_remain)
	a = int(s)
	b = int(s1)
	print(a, b)


(m, s) = list(map(int, input().split()))
if s == 0:
	if m != 1:
		print(-1, -1)
	else:
		print('0' * m, '0' * m)
elif s <= 9:
	if m == 1:
		print(s, s)
	else:
		maxs = [s] + [0] * (m - 1)
		mins = [1] + [0] * (m - 2) + [s - 1]
		print(''.join(list(map(str, mins))), ''.join(list(map(str, maxs))))
elif m == 1:
	print(-1, -1)
else:
	(maxs, minl) = ([9] * (s // 9) + [s % 9] * (s % 9 > 0), [s % 9] * (s % 9 > 0) + [9] * (s // 9))
	if len(maxs) > m:
		print(-1, -1)
		exit()
	maxs += [0] * (m - len(maxs))
	minl = [0] * (m - len(minl)) + minl
	p = m - len(minl)
	for i in range(len(minl)):
		if minl[i] > 0 and minl[0] == 0:
			(minl[0], minl[i]) = (1, minl[i] - 1)
			break
	print(''.join(list(map(str, minl))), ''.join(list(map(str, maxs))))


(m, s) = map(int, input().split())
(M, S) = (m, s)
if s == 0 and m == 1:
	print(0, 0)
	exit()
if s > 9 * m or s == 0:
	print(-1, -1)
	exit()
mn = [0] * m
mx = [0] * m
mn[0] = 1
s -= 1
i = m - 1
while s >= 10:
	mn[i] = 9
	s -= 9
	i -= 1
mn[i] += s
i = 0
while S >= 10:
	mx[i] = 9
	S -= 9
	i += 1
mx[i] += S
print(int(''.join(map(str, mn))), int(''.join(map(str, mx))))


(m, s) = [int(x) for x in input().split()]
a = int(s / 9)
b = s % 9
if m == 1:
	if s <= 9:
		min_ = s
		max_ = s
	else:
		min_ = -1
		max_ = -1
elif s < 1 or s > 9 * m:
	min_ = -1
	max_ = -1
elif s <= 9:
	min_ = '1' + '0' * (m - 2) + str(s - 1)
	max_ = str(s) + '0' * (m - 1)
elif m == 2:
	min_ = 10 * (s - 9) + 9
	max_ = 90 + s - 9
elif b == 0:
	if m == a:
		min_ = '9' * m
		max_ = '9' * m
	if a == m - 1:
		min_ = '1' + '8' + '9' * (a - 1)
		max_ = '9' * a + '0'
	if a < m - 1:
		min_ = '1' + '0' * (m - a - 1) + '8' + '9' * (a - 1)
		max_ = '9' * a + '0' * (m - a)
else:
	if a == m - 1:
		min_ = str(b) + '9' * a
		max_ = '9' * a + str(b)
	if a < m - 1:
		min_ = '1' + '0' * (m - a - 2) + str(b - 1) + '9' * a
		max_ = '9' * a + str(b) + '0' * (m - a - 1)
print(min_, max_)


(X, Y) = map(int, input().split())
if X == 1 and Y == 0:
	print('0 0')
elif 9 * X < Y or Y == 0:
	print('-1 -1')
else:
	Z = '1' + '0' * (X - 1)
	Z1 = list(Z)
	Z2 = Z1[::-1]
	index = 0
	while sum(map(int, Z1)) != Y:
		if Z1[index] == '9':
			index += 1
		t = Z1.pop(index)
		t = str(int(t) + 1)
		Z1.insert(index, t)
	else:
		Max = ''.join(Z1)
	index = 0
	while sum(map(int, Z2)) != Y:
		if Z2[index] == '9':
			index += 1
		t = Z2.pop(index)
		t = str(int(t) + 1)
		Z2.insert(index, t)
	else:
		Min = ''.join(Z2)[::-1]
	print(Min, Max)


(m, s) = map(int, input().split())
lmin = ['0' for x in range(m)]
lmax = ['0' for x in range(m)]
import sys
if m == 1:
	if s > 9 * m:
		print('-1 -1')
		sys.exit()
	else:
		print(str(s) + ' ' + str(s))
		sys.exit()
elif s == 0 or s > 9 * m:
	print('-1 -1')
	sys.exit()
elif s <= 9:
	lmin[-1] = s - 1
	lmin[0] = 1
	lmax[0] = s
	for i in range(m):
		lmin[i] = str(lmin[i])
		lmax[i] = str(lmax[i])
else:
	for i in range(m):
		lmax[i] = max(min(9, s - 9 * i), 0)
	lmax2 = lmax[:]
	lmax2.reverse()
	lmin = lmax2
	if lmin[0] != 0:
		for i in range(m):
			lmin[i] = str(lmin[i])
			lmax[i] = str(lmax[i])
	else:
		lmin[0] = 1
		for i in range(1, m):
			if lmin[i] != 0:
				lmin[i] -= 1
				break
		for i in range(m):
			lmin[i] = str(lmin[i])
			lmax[i] = str(lmax[i])
print(''.join(lmin) + ' ' + ''.join(lmax))


def check(m, s):
	return s <= m * 9 and s >= 0
(m, s) = [int(i) for i in input().split()]
if m * 9 < s or (s < 1 and m > 1):
	print(-1, -1)
else:
	tmp = s
	for i in range(m):
		for j in range(10):
			if (i > 0 or j > 0 or (m == 1 and j == 0)) and check(m - i - 1, tmp - j):
				print(j, end='')
				tmp -= j
				break
	print()
	for i in range(m):
		if s >= 9:
			print(9, end='')
			s -= 9
		else:
			print(s, end='')
			s = 0


def majmo(x):
	x = str(x)
	sum = 0
	for i in range(len(x)):
		sum += int(x[i])
	return sum
(n, m) = map(int, input().split())
if m != 0 and m <= n * 9:
	if 9 * (n - 1) < m <= 9 * n:
		if n != 1:
			minn = 10 ** (n - 1)
			maxx = 10 ** n - 1
			r = 0
			while majmo(minn) < m:
				minn += 9 * 10 ** r
				r += 1
				if r == n - 1:
					break
			if majmo(minn) < m:
				minn += (m - majmo(minn)) * 10 ** r
			u = 0
			while majmo(maxx) > m:
				maxx -= 9 * 10 ** u
				u += 1
				if u == n - 1:
					break
			if majmo(maxx) < m:
				maxx += (m - majmo(maxx)) * 10 ** (u - 1)
			if m != 0:
				print(minn, maxx)
		else:
			print(m, m)
	else:
		minn = 10 ** (n - 1)
		maxx = 10 ** n - 1
		r = 0
		while majmo(minn) < m:
			minn += 9 * 10 ** r
			r += 1
		if majmo(minn) > m:
			minn -= (majmo(minn) - m) * 10 ** (r - 1)
		u = 0
		while majmo(maxx) > m:
			maxx -= 9 * 10 ** u
			u += 1
		if majmo(maxx) < m:
			maxx += (m - majmo(maxx)) * 10 ** (u - 1)
		if m != 0:
			print(minn, maxx)
elif m == 0 and n == 1:
	print(0, 0)
elif m > n * 9:
	print(-1, -1)
else:
	print(-1, -1)


(m, s) = list(map(int, input().split()))
s1 = s
s_init = s
a_max = []
a_min = m * [0]
p = 1
flag = 0
if s == 0 and m > 1 or s > 9 * m:
	print(-1, -1)
	flag = 1
else:
	while s > 9:
		a_max.append(9)
		s -= 9
	if s <= 9:
		a_max.append(s)
		s -= s
		while len(a_max) != m:
			a_max.append(0)
	if s1 > 9:
		while s1 > 9:
			a_min[-p] = 9
			s1 -= 9
			p += 1
		if s1 <= 9 and p < m:
			a_min[-p] = s1 - 1
			a_min[0] = 1
		elif s1 <= 9 and p == m:
			a_min[0] = s1
	elif s1 <= 9:
		s1 -= 1
		a_min[0] = 1
		for v in range(1, m):
			if v < m - 1:
				a_min[v] = 0
			elif v == m - 1:
				a_min[v] = s1
if m == 1 and s_init <= 9:
	print(s_init, s_init)
elif flag == 0:
	if m != 1 and s_init != 0:
		print(*a_min, sep='')
	print(*a_max, sep='')


(m, s) = [int(i) for i in input().split()]
if s == 0 and m > 1 or s > 9 * m:
	print('-1', '-1')
	exit()
maxn = 0
k = s
for i in range(m):
	if i < m - 1 and k >= 10 or (i == m - 1 and k == 9):
		maxn += 9 * 10 ** i
		k -= 9
	elif i < m - 1:
		maxn += (k - 1) * 10 ** i
		k -= k - 1
	else:
		maxn += k * 10 ** i
print(maxn, end=' ')
minn = 0
for j in range(m - 1, -1, -1):
	if s >= 9:
		minn += 9 * 10 ** j
		s -= 9
	else:
		minn += s * 10 ** j
		s = 0
print(minn, end=' ')


def input_split(f):
	return map(f, input().split())

def main():
	(m, s) = input_split(int)
	sma = [0] * m
	lar = [9] * m
	if m > 1:
		sma[0] = 1
	(i, c) = (-1, 1)
	while sum(sma) != s and i >= -m:
		sma[i] = c
		c += 1
		if c == 10:
			(i, c) = (i - 1, 1)
	sma.sort()
	if sma[0] == 0 and m > 1:
		i = sma.index(1)
		(sma[i], sma[0]) = (sma[0], sma[i])
	if sma == [9] * m and sum(sma) != s:
		print('-1 -1')
		return
	(i, c) = (-1, 8)
	while sum(lar) != s and i >= -m:
		lar[i] = c
		c -= 1
		if c == -1:
			(i, c) = (i - 1, 8)
	print(''.join(map(str, sma)), end=' ')
	print(''.join(map(str, lar)))
main()


(a, b) = map(int, input().split())
if b > a * 9:
	print(-1, -1)
elif b == 0 and a == 1:
	print(0, 0)
elif a > 1 and b == 0:
	print(-1, -1)
else:
	s = ''
	while b != 0:
		if b >= 9:
			b = b - 9
			s = s + str(9)
		elif b >= 8:
			b = b - 8
			s = s + str(8)
		elif b >= 7:
			b = b - 7
			s = s + str(7)
		elif b >= 6:
			b = b - 6
			s = s + str(6)
		elif b >= 5:
			b = b - 5
			s = s + str(5)
		elif b >= 4:
			b = b - 4
			s = s + str(4)
		elif b >= 3:
			b = b - 3
			s = s + str(3)
		elif b >= 2:
			b = b - 2
			s = s + str(2)
		elif b >= 1:
			b = b - 1
			s = s + str(1)
	u = s[-1]
	v = s[:-1]
	t = a - len(s)
	if t > 0:
		s = s + '0' * (a - len(s))
	if s[-1] != '0':
		print(s[::-1], s)
	else:
		q = '1' + (t - 1) * '0' + str(int(u) - 1) + v
		print(q, s)


(n, m) = map(int, input().split())
if m > n * 9 or (n > 1 and m == 0):
	print(-1, -1)
elif n == 1 and m == 0:
	print(0, 0)
else:
	(a, g) = ('', m - 1)
	for i in range(n):
		if m > 9:
			a += '9'
			m -= 9
		else:
			a += str(m)
			m = 0
	r = [a]
	a = ''
	for i in range(n - 1):
		if g > 9:
			a = '9' + a
			g -= 9
		else:
			a = str(g) + a
			g = 0
	a = str(max(1, g + 1)) + a
	r = [a] + r
	print(*r)


(m, s) = [int(i) for i in input().split()]
if s == 0 and m != 1 or s > m * 9:
	print(-1, -1)
	exit()
if s == 0 and m == 1:
	print(0, 0)
	exit()
minans = [1] + [0] * (m - 1)
maxans = [1] + [0] * (m - 1)
tmp = s - 1
for i in range(m - 1, -1, -1):
	if tmp >= 9 - minans[i]:
		tmp -= 9 - minans[i]
		minans[i] = 9
	else:
		minans[i] += tmp
		break
tmp = s - 1
for i in range(0, m):
	if tmp >= 9 - maxans[i]:
		tmp -= 9 - maxans[i]
		maxans[i] = 9
	else:
		maxans[i] += tmp
		break
print(''.join([str(i) for i in minans]), ''.join([str(i) for i in maxans]))


x = input()
(m, s) = list(map(int, x.strip().split()))
smallest = [0 for _ in range(m)]
smallest[0] = 1
vsota_s = 1
i = len(smallest) - 1
while vsota_s < s and i >= 0:
	if s - vsota_s <= 9 - smallest[i]:
		smallest[i] = s - vsota_s + smallest[i]
		vsota_s += s - vsota_s
		i = i - 1
		break
	else:
		member = smallest[i]
		smallest[i] = 9
		vsota_s += 9 - member
		i = i - 1
biggest = [0 for _ in range(m)]
biggest[0] = 1
vsota_b = 1
i = 0
while vsota_b < s and i < len(biggest):
	if s - vsota_b <= 9 - biggest[i]:
		biggest[i] = s - vsota_b + biggest[i]
		vsota_b += s - vsota_b
		i += 1
		break
	else:
		member = biggest[i]
		vsota_b += 9 - member
		biggest[i] = 9
		i = i + 1
if s == 0 and m == 1:
	print(0, 0)
elif vsota_s == vsota_b == s:
	print(''.join(map(str, smallest)), ''.join(map(str, biggest)))
elif vsota_s == s and vsota_b != s:
	print(''.join(map(str, smallest)), -1)
elif vsota_s != s and vsota_b == s:
	print(-1, ''.join(map(str, biggest)))
else:
	print(-1, -1)


a = input()
if a == '1 0':
	print(int(0), int(0))
else:
	b = a.split()
	m = int(b[0])
	s = int(b[1])
	p = m
	q = s
	r = 0
	summax = 0
	summin = 0
	if s == 0:
		print(int(-1), int(-1))
	elif s > m * 9:
		print(int(-1), int(-1))
	else:
		while q > 9:
			q = q - 9
			r = r + 1
		for i in range(r):
			summax = summax + 9 * 10 ** (p - i - 1)
		summax = summax + q * 10 ** (p - r - 1)
		p = m
		q = s
		r = 0
		while q > 9:
			q = q - 9
			r = r + 1
		for i in range(r):
			summin = summin + 9 * 10 ** i
		summin = summin + 1 * 10 ** (m - 1) + (q - 1) * 10 ** r
		print(summin, summax)


(m, s) = map(int, input().split())
if s == 0 and m != 1:
	print('-1', '-1')
elif s > 9 * m:
	print('-1', '-1')
else:
	a = s // 9
	b = s % 9
	if a == 0:
		if m == 1:
			print(b, end=' ')
			print(b)
		else:
			print('1', end='')
			for i in range(m - 2):
				print('0', end='')
			print(b - 1, end='')
			print('', end=' ')
			print(b, end='')
			for i in range(m - 1):
				print('0', end='')
	elif b != 0 and m != a + 1:
		print(1, end='')
		for i in range(m - a - 2):
			print('0', end='')
		print(b - 1, end='')
		for i in range(a):
			print('9', end='')
		print('', end=' ')
		for i in range(a):
			print('9', end='')
		print(b, end='')
		for i in range(m - a - 1):
			print('0', end='')
	elif b != 0 and m == a + 1:
		print(b, end='')
		for i in range(a):
			print('9', end='')
		print('', end=' ')
		for i in range(a):
			print('9', end='')
		print(b, end='')
		for i in range(m - a - 1):
			print('0', end='')
	elif a != m:
		print('1', end='')
		for i in range(m - a - 1):
			print('0', end='')
		print('8', end='')
		for i in range(a - 1):
			print('9', end='')
		print('', end=' ')
		for i in range(a):
			print('9', end='')
		for i in range(m - a - 1):
			print('0', end='')
		print(b, end='')
	else:
		for i in range(m):
			print('9', end='')
		print('', end=' ')
		for i in range(m):
			print('9', end='')


def judge(digit, num):
	if num == 0:
		if digit != 1:
			return -1
		else:
			return str(num)
	elif num <= digit:
		if num <= 10 and num >= 2:
			return '1' + '0' * (digit - 2) + str(num - 1)
		elif num == 1:
			return '1' + '0' * (digit - 1)
		else:
			try:
				return judge(digit - 1, num - 9) + '9'
			except:
				return -1
	elif digit > 1:
		if num >= 10:
			try:
				return judge(digit - 1, num - 9) + '9'
			except:
				return -1
		else:
			try:
				return judge(digit - 1, 1) + str(num - 1)
			except:
				return -1
	elif num <= 9:
		return str(num)
	else:
		return -1

def chase(digit, num):
	if num == 0:
		if digit == 1:
			return str(num)
		else:
			return -1
	elif num <= digit:
		if num <= 9:
			return str(num) + '0' * (digit - 1)
		else:
			try:
				return '9' + chase(digit - 1, num - 9)
			except:
				return -1
	elif digit == 1:
		if num >= 10:
			return -1
		else:
			return str(num)
	elif digit > 1:
		if num <= 9:
			return str(num) + '0' * (digit - 1)
		else:
			try:
				return '9' + chase(digit - 1, num - 9)
			except:
				return -1
	else:
		return -1
x = input().split()
m = int(x[0])
s = int(x[1])
a = judge(m, s)
b = chase(m, s)
if a == -1:
	print('-1', '-1')
elif a[-1] == '0' or len(a) == 1:
	print(int(a), int(a))
else:
	print(int(a), int(b))


(m, s) = map(int, input().split())
if s > m * 9:
	print(-1, -1)
elif s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	pos = 0
	lost = s
	minAns = ''
	while (m - pos - 1) * 9 > lost:
		if pos == 0:
			minAns += '1'
			lost -= 1
		else:
			minAns += '0'
		pos += 1
	if 9 * (m - pos) == lost:
		minAns += '9' * (m - pos)
	else:
		minAns += str(lost % 9) + '9' * (m - pos - 1)
	print(minAns, end=' ')
	maxAns = ''
	lost = s
	pos = 0
	while lost - 9 >= 0:
		maxAns += '9'
		pos += 1
		lost -= 9
	if m - pos > 0:
		maxAns += str(lost)
		maxAns += '0' * (m - pos - 1)
	print(maxAns)


n1 = input().split()
n = int(n1[0])
s = int(n1[1])
if s > 0 and n * 9 > s:
	m = int(s / 9)
	my = s % 9
	d = n - 1 - m
	j = ' '
	for i in range(m):
		j += '9'
	j += str(my)
	for i in range(d):
		j += '0'
	if d == 0:
		for i in range(m):
			j = '9' + j
		j = str(my) + j
	elif my > 0:
		my -= 1
		for i in range(m):
			j = '9' + j
		j = str(my) + j
		for i in range(d - 1):
			j = '0' + j
		j = '1' + j
	else:
		my = 8
		for i in range(m - 1):
			j = '9' + j
		j = str(my) + j
		for i in range(d):
			j = '0' + j
		j = '1' + j
	print(j)
elif n * 9 < s:
	print('-1 -1')
elif s == 0:
	if n == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	j = ' '
	for i in range(n):
		j = '9' + j + '9'
	print(j)


(m, s) = map(int, input().split())
if m == 1:
	if s == 0:
		print('0 0')
	elif s > 9:
		print('-1 -1')
	else:
		for i in range(9, 0, -1):
			if i <= s:
				print(i, i)
				break
elif s == 0 and m > 1:
	print('-1 -1')
elif 9 * m < s:
	print('-1 -1')
else:
	ans = ''
	stn = 0
	for k in range(m - 1):
		for i in range(9, -1, -1):
			if i + stn < s:
				ans += str(i)
				stn += i
				break
	for i in range(9, 0, -1):
		if i + stn <= s:
			ans += str(i)
			break
	ansm = ''
	stn = 0
	for k in range(m):
		for i in range(9, -1, -1):
			if i + stn <= s:
				ansm += str(i)
				stn += i
				break
	print(ans[::-1], ansm)


import math
(m, s) = [int(z) for z in input().split(' ')]
v = math.ceil(s / 9)
if v > m or s == 0:
	if s == 0 and m == 1:
		print(0, 0)
	else:
		print('-1 -1')
else:
	sm = ''
	la = ''
	if v == m:
		if s % 9 == 0:
			sm = '9' * v
		else:
			sm = str(s % 9) + '9' * (v - 1)
	elif v < m:
		sm = '1'
		k = m - 1
		su = s - 1
		if su % 9 == 0:
			v = '9' * (su // 9)
			sm = sm + '0' * (m - 1 - len(v)) + v
		else:
			v = str(su % 9)
			su = su - su % 9
			v = v + '9' * (su // 9)
			sm = sm + '0' * (m - 1 - len(v)) + v
	if s % 9 == 0:
		la = '9' * (s // 9)
		la = la + '0' * (m - len(la))
	else:
		la = '9' * (s // 9) + str(s % 9)
		la = la + '0' * (m - len(la))
	print(sm, la)


def findLargest(s, level, m, res):
	if level == m:
		return res
	for i in range(9, -1, -1):
		if s - i >= 0:
			res = res + str(i)
			res = findLargest(s - i, level + 1, m, res)
			break
	return res
(m, s) = list(map(int, input().split()))
max_s = pow(10, m) - 1
max_s = str(max_s)
sum_max_s = 0
for i in range(0, len(max_s)):
	sum_max_s += int(max_s[i])
if s == 0 and m == 1:
	print(f'{0} {0}')
elif s < 1 or s > sum_max_s:
	print(f'{-1} {-1}')
else:
	res = ''
	max = ''
	min = ''
	res = findLargest(s, 0, m, res)
	max = res
	if res.count('0') > 0:
		nearest_index = res.index('0')
		nearest = int(res[nearest_index - 1])
		res = res[:nearest_index] + str(1) + res[nearest_index + 1:]
		res = res[:nearest_index - 1] + str(nearest - 1) + res[nearest_index:]
		min = sorted(res)
		if min[0] == '0':
			temp_index = min.index('1')
			temp = min[0]
			min[0] = min[temp_index]
			min[temp_index] = temp
		min = ''.join(min)
	else:
		min = sorted(res)
		min = ''.join(min)
	final = [min, max]
	final = ' '.join(final)
	print(final)


(n, k) = map(int, input().split())
a = []
b = []
if k == 0:
	if n == 1:
		print('0 0')
	else:
		print('-1 -1')
	a.append(-1)
if k > n * 9 and len(a) == 0:
	a.append(-1)
	print('-1 -1')
if len(a) == 0:
	a.append(1)
	for i in range(n - 1):
		a.append(0)
	p = k
	k -= 1
	for i in range(n - 1, -1, -1):
		if k >= 9:
			k -= 9
			a[i] += 9
		else:
			a[i] += k
			k = 0
			break
	for i in range(n):
		if p >= 9:
			p -= 9
			b.append(9)
		elif p <= 0:
			b.append(0)
		else:
			b.append(p)
			p = 0
	print(*a, sep='', end=' ')
	print(*b, sep='')


(m, s) = (int(i) for i in input().split())
if m > 1 and s < 1 or s > 9 * m:
	print('-1 -1')
	exit()
else:
	k = s
	ns = ''
	for i in range(m - 1, -1, -1):
		n = max(0, k - 9 * i)
		if n == 0 and i == m - 1 and (k != 0):
			n = 1
		ns += str(n)
		k -= n
	k = s
	nd = ''
	for i in range(m - 1, -1, -1):
		n = min(9, k)
		nd += str(n)
		k -= n
print(ns, end=' ')
print(nd)


(m, s) = list((int(a) for a in input().split()))
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif m * 9 < s:
	print(-1, -1)
else:
	st = 10 ** (m - 1)
	ts = s - 1
	i = 0
	while ts >= 9:
		st += 9 * 10 ** i
		ts -= 9
		i += 1
	if ts > 0:
		st += (s - 1) % 9 * 10 ** i
	ts = s
	ed = 0
	i = m - 1
	while ts >= 9:
		ed += 9 * 10 ** i
		ts -= 9
		i -= 1
	if ts > 0:
		ed += ts * 10 ** i
	print(int(st), int(ed))


import time
I = lambda : list(map(int, input().split(' ')))
(N, s) = I()
mem = {}

def maxDigits(n, s):
	if (n, s) in mem:
		return mem[n, s]
	elif n == 1 and s <= 9 and (s > 0) or (n == N == 1 and s <= 9):
		return (str(s), True)
	elif n < N and s == 0:
		return ('0' * n, True)
	elif n == 1 and s > 9 or (n == N and s == 0) or n <= 0:
		return ('', False)
	else:
		if n == N:
			start = 0
		else:
			start = -1
		for j in range(9, start, -1):
			if s - j >= 0:
				t = maxDigits(n - 1, s - j)
				if t[1] == True:
					mem[n, s] = (str(j) + t[0], True)
					return (str(j) + t[0], True)
		mem[n, s] = ('', False)
		return ('', False)
mem1 = {}

def minDigits(n, s):
	if (n, s) in mem1:
		return mem1[n, s]
	elif n == 1 and s <= 9 and (s > 0) or (n == N == 1 and s <= 9):
		return (str(s), True)
	elif n < N and s == 0:
		return ('0' * n, True)
	elif n == 1 and s > 9 or (n == N and s == 0) or n <= 0:
		return ('', False)
	else:
		if n == N:
			start = 1
		else:
			start = 0
		for j in range(start, 10, 1):
			if s - j >= 0:
				t = minDigits(n - 1, s - j)
				if t[1] == True:
					mem1[n, s] = (str(j) + t[0], True)
					return (str(j) + t[0], True)
		mem1[n, s] = ('', False)
		return ('', False)
t1 = minDigits(N, s)
t2 = maxDigits(N, s)
print(str(t1[0] if t1[1] else -1) + ' ' + str(t2[0] if t2[1] else -1))


(m, s) = list(map(int, input().split()))
minu = [0 for i in range(m)]
s2 = s
beg = True
while s2 > 0:
	found = False
	if beg:
		minu[0] += 1
		beg = False
		s2 -= 1
		found = True
	else:
		j = m - 1
		while j >= 0:
			if minu[j] < 9:
				minu[j] += 1
				s2 -= 1
				found = True
				break
			j -= 1
	if found == False:
		print(-1, -1)
		exit(0)
maxu = [0 for i in range(m)]
s2 = s
while s2 > 0:
	found = False
	j = 0
	while j < m:
		if maxu[j] < 9:
			maxu[j] += 1
			s2 -= 1
			found = True
			break
		j += 1
	if found == False:
		print(-1, -1)
		exit(0)
if sum(minu) != s:
	print(-1, -1)
	exit(0)
if sum(maxu) != s:
	print(-1, -1)
	exit(0)
minu_ans = int(''.join([str(i) for i in minu]))
maxu_ans = int(''.join([str(i) for i in maxu]))
if len(str(minu_ans)) != m:
	print(-1, -1)
	exit(0)
if len(str(maxu_ans)) != m:
	print(-1, -1)
	exit(0)
print(minu_ans, maxu_ans)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	(m, s) = ain()
	if s == 0:
		if m == 1:
			print(0, 0)
		else:
			print(-1, -1)
	elif 9 * m < s:
		print(-1, -1)
	elif m >= s:
		x = ''
		p = s
		s -= 1
		while s > 9:
			x += '9'
			s -= 9
		if s > 0:
			x = str(s) + x
		x = '1' + '0' * (m - 1 - len(x)) + x
		y = ''
		while p > 9:
			y += '9'
			p -= 9
		y = y + str(p) + '0' * (m - 1 - len(y))
		print(x, y)
	else:
		p = s
		s -= 1
		x = ''
		while s > 9:
			x += '9'
			s -= 9
		if s > 0:
			x = str(s) + x
		x = '0' * (m - len(x)) + x
		x = str(int(x[0]) + 1) + x[1:]
		y = ''
		while p > 9:
			y += '9'
			p -= 9
		y = y + str(p) + '0' * (m - 1 - len(y))
		print(x, y)
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')
main()


__author__ = 'Rakshak.R.Hegde'
from math import *
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s / m > 9 or s == 0:
	print('-1 -1')
else:
	num = [9] * m
	psum = 9 * m
	minDiff = min(8, psum - s)
	num[0] -= minDiff
	psum -= minDiff
	index = 1
	while psum > s:
		minDiff = min(9, psum - s)
		num[index] -= minDiff
		psum -= minDiff
		index += 1
	n1 = ''
	for i in num:
		n1 += str(i)
	num = [9] * m
	psum = 9 * m
	index = -1
	while psum > s:
		minDiff = min(9, psum - s)
		num[index] -= minDiff
		psum -= minDiff
		index -= 1
	n2 = ''
	for i in num:
		n2 += str(i)
	print(n1 + ' ' + n2)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, s) = I()
copys = s
if s == 0 and n != 1 or 9 * n < s:
	print(-1, -1)
elif n == 1:
	print(s, s)
else:
	ss = ''
	for i in range(9, 0, -1):
		k = s // i
		ss += str(i) * k
		s -= i * k
	if len(ss) < n:
		ss = ss + '0' * (n - len(ss))
	mi = ''
	s = copys
	for k in range(1, 10):
		if s - k <= 9 * (n - 1):
			mi += str(k)
			s -= k
			n -= 1
			break
	while n > 0:
		for j in range(0, 10):
			if s - j <= 9 * (n - 1):
				mi += str(j)
				s -= j
				break
		n -= 1
	print(mi, ss)


from math import sqrt, floor
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
else:
	if s - 1 <= (m - 1) * 9:
		w = s - 1
		last = w % 9
		num9 = int((w - last) / 9)
		num0 = m - num9 - 1
		if last:
			num0 -= 1
			s = '1' + '0' * num0 + str(last) + '9' * num9
			big = '9' * num9 + str(last + 1) + '0' * (num0 + 1)
		else:
			s = '1' + '0' * num0 + '9' * num9
			big = '9' * num9 + '1' + '0' * num0
	else:
		w = s
		last = w % 9
		num9 = int((w - last) / 9)
		if last:
			s = str(last) + '9' * num9
			big = '9' * num9 + str(last)
		else:
			s = '9' * num9
			big = s
	small = s
	print(small, big)


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow, pi

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

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

def ini():
	return int(input())

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

def sti():
	return str(input())

def par(a):
	print(' '.join(list(map(str, a))))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

def sts(s):
	s = list(s)
	s.sort()
	return ''.join(s)

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
(n, k) = isp()
if k == 0 and n > 1:
	print(-1, -1)
	quit()
elif k == 0 and n == 1:
	print(0, 0)
	quit()
if n * 9 < k:
	print(-1, -1)
	quit()
a = [0] * n
x = k
i = 0
while x > 0:
	if x >= 9:
		a[i] = 9
		i += 1
		x -= 9
	else:
		a[i] = x
		i += 1
		x = 0
b = [0] * n
i = n - 1
x = k - 1
b[0] = 1
while x > 0:
	if x >= 9:
		b[i] = 9
		i -= 1
		x -= 9
	else:
		if b[i] == 1:
			b[i] += x
		else:
			b[i] = x
		i -= 1
		x = 0
print(''.join(map(str, b)), ''.join(map(str, a)))


n = input()
(a, b) = n.split()
if int(b) >= 1 and int(b) <= 9 * int(a) or (int(b) == 0 and int(a) == 1):
	x = 1
	y = 1
	c = []
	g = []
	while x <= int(a):
		if int(b) - 9 * x >= 1:
			x += 1
		else:
			d = int(b) - 9 * (x - 1)
			if int(a) > x:
				c.append('1')
				while y <= int(a) - x - 1:
					c.append('0')
					y += 1
				y = 1
				c.append(str(d - 1))
				while y <= x - 1:
					c.append('9')
					y += 1
				e = ''.join(c)
				c.reverse()
				c[x - 1] = str(d)
				c[-1] = '0'
				f = ''.join(c)
				if int(b) == 1:
					print(e + ' ' + e)
				elif x == 1:
					g.append(str(d))
					while y <= int(a) - x - 1:
						g.append('0')
						y += 1
					g.append('0')
					h = ''.join(g)
					print(e + ' ' + h)
				else:
					print(e + ' ' + f)
				break
			else:
				c.append(str(d))
				while y <= x - 1:
					c.append('9')
					y += 1
				e = ''.join(c)
				c.reverse()
				f = ''.join(c)
				print(e + ' ' + f)
				break
else:
	print('-1 -1')


ms = input().split()
(m, s) = (int(ms[0]), int(ms[1]))
(m1, s1) = (m, s)
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
else:
	maxi = 0
	mini = 10 ** (m - 1)
	while s1 >= 9:
		maxi += 9 * 10 ** (m1 - 1)
		m1 -= 1
		s1 -= 9
	if s1 > 0:
		maxi += s1 * 10 ** (m1 - 1)
	(m2, s2) = (0, s - 1)
	while s2 >= 9:
		mini += 9 * 10 ** m2
		s2 -= 9
		m2 += 1
	mini += s2 * 10 ** m2
	print(mini, maxi)


(m, s) = list(map(int, input().split()))

def find_min(m, s):
	result = []
	s -= 1
	for k in range(m):
		if s >= 9:
			result.append(9)
			s -= 9
		else:
			result.append(s % 9)
			s -= s % 9
	result[-1] += 1
	return ''.join(list(map(str, reversed(result))))

def find_max(m, s):
	result = []
	for k in range(m):
		if s >= 9:
			result.append(9)
			s -= 9
		else:
			result.append(s % 9)
			s -= s % 9
	return ''.join(list(map(str, result)))
if m * 9 < s:
	print(-1, -1)
else:
	if s == 0:
		if m == 1:
			(minimal, maximal) = (0, 0)
		else:
			(minimal, maximal) = (-1, -1)
	else:
		minimal = find_min(m, s)
		maximal = find_max(m, s)
	print(minimal, maximal)


(n, m) = map(int, input().split())
if n == 1 and m == 0:
	print(0, 0)
elif 1 <= m <= 9 * n:
	su = m
	ma = ''
	for i in range(n):
		if su > 9:
			ma += '9'
			su -= 9
		else:
			ma += str(su)
			su = 0
	su = m - 1
	mi = ''
	for i in range(n - 1):
		if su > 9:
			mi = '9' + mi
			su -= 9
		else:
			mi = str(su) + mi
			su = 0
	if su == 0:
		mi = '1' + mi
	else:
		mi = str(su + 1) + mi
	print(mi, ma)
else:
	print(-1, -1)


line = input()
L = line.split()
i = 0
s1 = ''
s2 = ''
n = int(L[0])
m = int(L[1])
if n == 1 and m == 0:
	print('0 0')
elif m == 0 or m > 9 * n:
	print('-1 -1')
else:
	m1 = 9 * n - m
	m2 = m
	for i in range(n):
		if i == 0:
			t = min(8, m1)
		else:
			t = min(9, m1)
		s1 += str(9 - t)
		m1 -= t
		u = min(9, m2)
		s2 += str(u)
		m2 -= u
print(s1, s2)


def LenAndSum(m, s):
	max = ''
	min = ''
	count = 0
	s2 = s
	if m == 1 and s == 0:
		print('0 0')
		return
	if m > 0 and s == 0 or m * 9 < s:
		print('-1 -1')
		return
	for i in range(m):
		if s - 9 >= 0:
			max = max + '9'
			s -= 9
		elif s > 0:
			max = max + str(s)
			s = 0
		else:
			max = max + '0'
			count += 1
	for i in range(m):
		if s2 - 9 > 0:
			min = min + '9'
			s2 -= 9
		elif s2 > 0 and i == m - 1:
			min = str(s2) + min
			s2 = 0
		elif s2 > 1 and i != m:
			min = str(s2 - 1) + min
			s2 = 1
		elif s2 == 1 and i < m - 1:
			min = '0' + min
	print(min, ' ', max)
inp = input()
m = int(inp.split()[0])
s = int(inp.split()[1])
LenAndSum(m, s)


I = lambda : list(map(int, input().split()))
(m, s) = I()
s1 = s
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
else:
	arr = [0] * m
	for i in range(0, m):
		if s > 9:
			arr[i] = 9
			s = s - 9
		else:
			arr[i] = s
			s = 0
	arr1 = [0] * m
	s1 = s1 - 1
	for i in range(m - 1, 0, -1):
		if s1 > 9:
			arr1[i] = 9
			s1 = s1 - 9
		else:
			arr1[i] = s1
			s1 = 0
	arr1[0] = s1 + 1
	for i in range(0, m):
		print(arr1[i], end='')
	print('')
	for i in range(0, m):
		print(arr[i], end='')


def main():
	line = input().split()
	m = int(line[0])
	s = int(line[1])
	digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
	mini = [0] * m
	out1 = ''
	maxi = [0] * m
	out2 = ''
	if s == 0 and m > 1:
		print('-1 -1')
	elif s == 0 and m == 1:
		print('0 0')
	elif s > 9 * m:
		print('-1 -1')
	else:
		for j in range(m):
			if j == 0:
				i = 1
			else:
				i = 0
			while s - digits[i] > 9 * (m - j - 1):
				i += 1
			mini[j] = digits[i]
			out1 += str(digits[i])
			s -= digits[i]
		s = int(line[1])
		for k in range(m):
			t = len(digits) - 1
			while s < digits[t]:
				t -= 1
			maxi[k] = digits[t]
			s -= digits[t]
			out2 += str(digits[t])
		print(out1)
		print(out2)
main()


import sys
(m, s) = map(int, sys.stdin.readline().strip().split(' '))
upp = 9 * m
bot = 1
if m == 1 and s == 0:
	print(0, 0)
elif s < bot or s > upp or m == 0:
	print(-1, -1)
else:
	A = [0] * m
	A[0] = 1
	for x in range(m):
		for y in range(10):
			if sum(A) == s:
				break
			else:
				A[m - x - 1] = y
	for x in range(m):
		print(A[x], end='')
	print(' ', end='')
	A = [9] * m
	for x in range(m):
		for y in range(9, -1, -1):
			if sum(A) == s:
				break
			else:
				A[m - x - 1] = y
	for x in range(m):
		print(A[x], end='')
	print(' ', end='')
	print()


import math, sys
p = input().split()
m = int(p[0])
s = int(p[1])
Min = 10 ** (m - 1)
miN = str((s - 1) % 9)
Max = str(s % 9)
if s / 9 > m:
	print('-1 -1')
	sys.exit()
elif m != 1 and s == 0:
	print('-1 -1')
	sys.exit()
elif m == 1 and s == 0:
	print('0 0')
	sys.exit()
elif s // 9 + 1 == m:
	Max = str(s % 9)
elif s // 9 == m:
	Max = ''
elif s // 9 + 1 < m:
	Max = str(s % 9)
	for k in range(m - 1 - s // 9):
		Max = Max + '0'
for i in range((s - 1) // 9):
	miN = miN + '9'
for i in range(s // 9):
	Max = '9' + Max
MIN = Min + int(miN)
print(MIN, Max, sep=' ')


(m, s) = map(int, input().split())
if 9 * m >= s and s > 0:
	a = ''
	b = ''
	for i in range(m):
		if s >= 9:
			a += '9'
			s -= 9
		else:
			a += str(s)
			s = 0
	if a.count('0') > 0:
		b = a[:a.find('0') - 1] + str(int(a[a.find('0') - 1]) - 1) + a[a.find('0'):len(a) - 1]
		b = '1' + b[::-1]
	else:
		b = a[::-1]
	print(b, a)
elif s == 0 and m == 1:
	print(0, 0)
else:
	print(-1, -1)


import math
(length, digitsum) = [int(x) for x in input().split()]

def max_num(leng, dsum):
	for i in range(dsum // 9):
		print(9, end='')
	print(dsum % 9 if dsum % 9 != 0 else '', end='')
	for i in range(leng - math.ceil(dsum / 9)):
		print(0, end='')

def min_num(leng, dsum):
	if leng - 1 >= math.ceil((dsum - 1) / 9):
		print(1, end='')
		for i in range(leng - 1 - math.ceil((dsum - 1) / 9)):
			print(0, end='')
		print((dsum - 1) % 9 if (dsum - 1) % 9 != 0 else '', end='')
		for i in range((dsum - 1) // 9):
			print(9, end='')
	else:
		print(dsum % 9 if dsum % 9 != 0 else '', end='')
		for i in range(dsum // 9):
			print(9, end='')
	print(' ', end='')
if length == 0 or digitsum > length * 9:
	print(-1, -1, sep=' ')
elif digitsum == 0:
	if length == 1:
		print(0, 0, sep=' ')
	else:
		print(-1, -1, sep=' ')
else:
	min_num(length, digitsum)
	max_num(length, digitsum)


(length_of_integer, sum_of_digits) = map(int, input().split())
if sum_of_digits > length_of_integer * 9 or (sum_of_digits == 0 and length_of_integer > 1):
	print(-1, -1)
elif sum_of_digits == 0 and length_of_integer == 1:
	print(0, 0)
else:
	ans = [0 for i in range(length_of_integer - 1)]
	ans.append(1)
	ans.reverse()
	i = length_of_integer - 1
	while sum(ans) != sum_of_digits:
		if ans[i] == 9:
			if i == 0:
				break
			i = i - 1
		else:
			ans[i] = ans[i] + 1
	ans_1 = [9 for j in range(length_of_integer)]
	i = length_of_integer - 1
	while sum(ans_1) != sum_of_digits:
		if ans_1[i] == 0:
			i = i - 1
		else:
			ans_1[i] = ans_1[i] - 1
	print(''.join(map(str, ans)) + ' ' + ''.join(map(str, ans_1)))


(n, s) = map(int, input().split())
s2 = s
if s == 0 and n == 1:
	print(0, 0)
	exit(0)
if s == 0 and n > 1:
	print(-1, -1)
	exit(0)
if n * 9 < s:
	print(-1, -1)
	exit(0)
big = []
while s != 0:
	if s - 9 < 0:
		big.append(str(s))
		break
	else:
		big.append('9')
		s -= 9
size = n - len(big)
if size == 0:
	print(''.join(big[::-1]), ''.join(big))
else:
	big += ['0'] * size
	small = big[::-1]
	small[0] = '1'
	small[size] = str(int(small[size]) - 1)
	print(''.join(small), ''.join(big))


n = input().split()
n[0] = int(n[0])
n[1] = int(n[1])
if n[1] == 0:
	if n[0] == 1:
		print('0 0')
	if n[0] != 1:
		print('-1 -1')
elif n[0] * 9 < n[1]:
	print('-1 -1')
else:
	i = (n[1] - 1) // 9
	q = (n[1] - 1) % 9
	mi = 10 ** (n[0] - 1) + q * 10 ** i
	while i > 0:
		mi += 9 * 10 ** (i - 1)
		i = i - 1
	ii = n[1] // 9
	qq = n[1] % 9
	if qq == 0:
		ma = ii * '9' + (n[0] - ii) * '0'
	else:
		ma = ii * '9' + str(qq) + '0' * (n[0] - ii - 1)
	print(mi, ma)


(m, s) = map(int, input().split())
min = []
max = []
d = 1
t = 1
s1 = s
s2 = s
if m >= 2 and s == 0:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif s > 9 * m:
	print('-1 -1')
else:
	while d <= m:
		if s1 - 9 * (m - d) > 0:
			w = s1 - 9 * (m - d)
			min.append(str(w))
			s1 = s1 - w
		elif d == 1:
			min.append('1')
			s1 = s1 - 1
		else:
			min.append('0')
			s1 = s1
		d += 1
	while t <= m:
		if s2 - 9 < 0:
			max.append(str(s2))
			s2 = 0
		else:
			max.append('9')
			s2 = s2 - 9
		t += 1
	print(''.join(min), ''.join(max))


ma = []
mi = []

def max_find_digit(nod, sum):
	global ma
	if nod > 1:
		t = sum - (nod - 1) * 9
		if t > 9 or sum == 0:
			return
		if t < 0:
			t = 0
		ma.append(t)
		if sum - t >= 0:
			max_find_digit(nod - 1, sum - t)
		return
	else:
		if sum >= 0 and sum < 10:
			ma.append(sum)
		return

def min_find_digit(nod, sum):
	global mi
	if nod > 1:
		t = sum - (nod - 1) * 9
		if t > 9 or sum == 0:
			return
		if t < 1:
			t = 1
		mi.append(t)

		def max_find_digit(nod, sum):
			if nod > 1:
				t = sum - (nod - 1) * 9
				if t < 0:
					t = 0
				mi.append(t)
				if sum - t >= 0:
					max_find_digit(nod - 1, sum - t)
				return
			else:
				if sum >= 0 and sum < 10:
					mi.append(sum)
				return
		max_find_digit(nod - 1, sum - t)
		return
	else:
		if sum >= 0 and sum < 10:
			mi.append(sum)
		return
x = []
x = input().split()
x[0] = int(x[0])
x[1] = int(x[1])
max_find_digit(x[0], x[1])
min_find_digit(x[0], x[1])
ma = ma[::-1]
m = []
if len(mi) < x[0]:
	m.append(-1)
else:
	min = ''
	for i in range(x[0]):
		min = min + str(mi[i])
	m.append(int(min))
if len(ma) < x[0]:
	m.append(-1)
else:
	max = ''
	for i in range(x[0]):
		max = max + str(ma[i])
	m.append(int(max))
print(m[0], m[1])


import copy
import sys

def input():
	return sys.stdin.readline()

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

def maps():
	return map(str, input().split())

def print(arg, *argv, end=None):
	sys.stdout.write(str(arg))
	for i in argv:
		sys.stdout.write(' ' + str(i))
	sys.stdout.write(end) if end else sys.stdout.write('\n')
DP1 = [[0] * 200 for i in range(1000)]
DP2 = [[0] * 200 for i in range(1000)]

def solve1(curSum, curPos, res):
	if curSum > s:
		return '-1'
	if curPos == m and curSum == s:
		return res
	elif curPos == m:
		return '-1'
	if DP1[curSum][curPos]:
		return '-1'
	DP1[curSum][curPos] = 1
	for i in range(10):
		if curSum == 0 and i == 0 and (m > 1):
			continue
		ret = solve1(curSum + i, curPos + 1, res + str(i))
		if ret != '-1':
			return ret
	return '-1'

def solve2(curSum, curPos, res):
	if curSum > s:
		return '-1'
	if curPos == m and curSum == s:
		return res
	elif curPos == m:
		return '-1'
	if DP2[curSum][curPos]:
		return '-1'
	DP2[curSum][curPos] = 1
	for i in range(9, -1, -1):
		if curSum == 0 and i == 0 and (m > 1):
			continue
		ret = solve2(curSum + i, curPos + 1, res + str(i))
		if ret != '-1':
			return ret
	return '-1'

def solve():
	t = 1
	while t:
		t -= 1
		global m, s
		(m, s) = mapi()
		minn = solve1(0, 0, '')
		maxx = solve2(0, 0, '')
		print(minn, maxx)
solve()


import sys
(m, s) = map(int, sys.stdin.readline().split())

def get_max(m, s, digits=range(9, -1, -1)):
	if not 0 <= s <= 9 * m:
		return None
	if m == 1:
		return s
	for digit in digits:
		candidate = get_max(m - 1, s - digit)
		if candidate is not None:
			return f'{digit}{candidate}'
	return None

def get_min(m, s, digits=range(10)):
	if not 0 <= s <= 9 * m:
		return None
	if m == 1:
		return s
	for digit in digits:
		candidate = get_min(m - 1, s - digit)
		if candidate is not None:
			return f'{digit}{candidate}'
	return None
(max_candidate, min_candidate) = (get_max(m, s, digits=range(9, 0, -1)), get_min(m, s, digits=range(1, 10)))
if max_candidate is not None and min_candidate is not None:
	sys.stdout.write(f'{min_candidate} {max_candidate}')
else:
	sys.stdout.write('-1 -1')


import os
input = input()
(m, s) = input.split()
m = int(m)
s = int(s)
if m == 1 and s < 10:
	print(s, s)
	exit()
if s == 0 or s > 9 * m:
	print(-1, -1)
	exit()
a1 = [0] * m
a2 = [0] * m
ts = s
for i in range(m):
	a1[i] = min(9, ts)
	ts -= a1[i]
ts = s
ts -= 1
for i in reversed(range(m)):
	a2[i] = min(9, ts)
	ts -= a2[i]
a2[0] += 1
print(''.join((str(i) for i in a2)), ''.join((str(i) for i in a1)))


(m, s) = [int(x) for x in input().split()]
if s == 0 and m != 1 or s > 9 * m:
	print(-1, -1)
else:
	big = ''
	bs = s
	small = ''
	ss = s
	for i in range(m):
		if bs >= 9:
			big += '9'
			bs -= 9
		else:
			big += str(bs)
			bs = 0
		if i <= m - 2:
			if ss > 9:
				small = '9' + small
				ss -= 9
			elif ss > 1:
				small = str(ss - 1) + small
				ss = 1
			else:
				small = '0' + small
		else:
			small = str(ss) + small
	print(int(small), int(big))


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

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

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

def can(m, s):
	if 0 <= s <= m * 9:
		return True
	return False

def main():
	(m, s) = vars()
	if s == 0 and m > 1:
		print(-1, -1)
		return
	elif m == 1 and s <= 9:
		print(s, s)
		return
	if can(m, s):
		(m1, s1) = (m, s)
		ans = ''
		for i in range(m):
			for j in range(10):
				if not ans and j == 0:
					continue
				if can(m - 1, s - j):
					ans += str(j)
					m -= 1
					s -= j
					break
		ans1 = ''
		(m, s) = (m1, s1)
		for i in range(m):
			for j in range(9, -1, -1):
				if not ans1 and j == 0:
					continue
				if can(m - 1, s - j):
					ans1 += str(j)
					m -= 1
					s -= j
					break
		print(ans, ans1)
	else:
		print(-1, -1)
t = 1
for _ in range(t):
	main()


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print('0 0')
elif 9 * n < s or s == 0:
	print('-1 -1')
else:
	k = 10 ** (n - 1)
	for i in range(s - 1):
		k += 10 ** (i // 9)
	k2 = 0
	for i in range(s):
		k2 += 10 ** (n - 1 - i // 9)
	print(k, k2)


(a, b) = map(int, input().split())
if 9 * a < b:
	print(-1, -1)
elif b == 0:
	if a != 1:
		print(-1, -1)
	else:
		print(0, 0)
else:
	z = [0] * a
	z[-1] = 1
	k = b - 1
	a1 = k // 9
	for n in range(a1):
		z[n] = 9
	z[a1] += k % 9
	s = z[::-1]
	z[a1] += 1
	z[-1] -= 1
	if a > b and a == 2:
		for n in z:
			print(n, end='')
		print(end=' ')
		for n in z:
			print(n, end='')
	else:
		for n in s:
			print(n, end='')
		print(end=' ')
		for n in z:
			print(n, end='')


solutions = []
dp = {}
firstCall = True

def sumFromLength(s, l, sum=0):
	global solutions
	global dp
	global firstCall
	if l == 1:
		num = sum * 10 + s
		solutions.append(num)
		return
	else:
		till = -1
		if firstCall:
			till = 0
			firstCall = False
		for i in range(9, till, -1):
			if s - i >= 0 and s - i <= 9 * (l - 1):
				num = sum * 10 + i
				sumFromLength(s - i, l - 1, num)
				break
arr = [int(x) for x in input().split()]
l = arr[0]
s = arr[1]
if s <= 9 * l:
	sumFromLength(s, l)
	if len(solutions) > 0:
		num = str(solutions[0])
		if s > 1:
			arr = [int(x) for x in num]
			arr.reverse()
			if arr[0] == 0:
				arr[0] = 1
				for i in range(1, len(arr)):
					if arr[i] > 0:
						arr[i] -= 1
						break
			num = ''.join(map(str, arr))
		print(str(num) + ' ' + str(solutions[0]))
	else:
		print('-1 -1')
else:
	print('-1 -1')


def p(a):
	if a <= 0:
		return 0
	else:
		return a
output = ''
(l, s) = map(int, input().split(' '))
if s / l > 9 or (s == 0 and l > 1):
	print('-1 -1')
elif s == 0 and l == 1:
	print('0 0')
else:
	n = str(s % 9)
	if s % 9 == 0:
		n = ''
	output = n + '9' * p(s // 9)
	if len(output) < l:
		output = '1' + '0' * p(l - 2 - (s - 1) // 9) + str((s - 1) % 9) + '9' * p((s - 1) // 9)
	output = output + ' ' + '9' * p(s // 9) + n + '0' * (l - s // 9 - len(n))
	print(output)


(n, s) = map(int, input().split())
s_save = s
if s == 0 and n == 1:
	(ansmax, ansmin) = (0, 0)
elif s == 0 and n > 1:
	(ansmax, ansmin) = (-1, -1)
elif s > n * 9:
	(ansmax, ansmin) = (-1, -1)
else:
	(ansmax, ansmin) = (0, 0)
	(d, t) = (0, 0)
	for i in range(n):
		if s > 0:
			d = min(9, s)
		else:
			d = 0
		ansmax += d * 10 ** (n - 1 - i)
		s -= d
	s = s_save
	(d, t) = (0, 0)
	if 1 + 9 * (n - 1) >= s:
		for i in range(n):
			if s - 1 > 0:
				d = min(9, s - 1)
			else:
				d = 0
			ansmin += d * 10 ** i
			s -= d
		ansmin += 10 ** (n - 1)
	else:
		for i in range(n):
			d = min(9, s)
			ansmin += d * 10 ** i
			s -= d
print(ansmin, ansmax)


info = input()
info = info.split()
m = int(info[0])
s = int(info[1])
if 9 * m < s:
	print('-1 -1')
elif s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif s == 1:
	print('{} {}'.format(10 ** (m - 1), 10 ** (m - 1)))
else:
	maxr = 0
	minr = 0
	Lmax = []
	Lmax.append(1)
	Lsmall = []
	Lsmall.append(1)
	for i in range(m - 1):
		Lmax.append(0)
		Lsmall.append(0)
	for j in range(m):
		while Lmax[j] < 9:
			Lmax[j] = Lmax[j] + 1
			if sum(Lmax) == s:
				maxr = 1
				for k in range(m):
					Lmax[k] = str(Lmax[k])
				break
		if maxr == 1:
			break
	for j in range(m):
		while Lsmall[m - 1 - j] < 9:
			Lsmall[m - 1 - j] = Lsmall[m - 1 - j] + 1
			if sum(Lsmall) == s:
				minr = 1
				for k in range(m):
					Lsmall[k] = str(Lsmall[k])
				break
		if minr == 1:
			break
	if maxr == 1 and minr == 1:
		maxnum = ''.join(Lmax)
		minnum = ''.join(Lsmall)
		print('{} {}'.format(minnum, maxnum))


def to_num(x):
	if x[0] == '0':
		for i in range(len(x)):
			if x[i] != '0':
				n0 = str(int(x[i]) - 1)
				x = '1' + x[1:i] + n0 + x[i + 1:len(x)]
				break
	if str(int(x)) == x:
		return x
	else:
		return -1
(m, s) = map(int, input().split())
x = ''
while m > 0:
	u = s - 9 * (m - 1)
	if 10 > u > 0:
		x += str(u) + '9' * (m - 1)
		break
	elif u <= 0:
		x += '0'
	else:
		x = '00'
		break
	m -= 1
print(to_num(x), to_num(x[::-1]))


(a, b) = map(int, input().split())
c = a
d = b
e = b
f = ''
g = ''
h = ''
if 9 * a < b:
	print('-1 -1')
	exit()
if a > 1 and b == 0:
	print('-1 -1')
	exit()
if a == 1 and b == 0:
	print('0 0')
	exit()
while c > 0:
	if d >= 9:
		f = f + '9'
		d = d - 9
	else:
		f = f + str(d)
		d = 0
	c = c - 1
q = e - 9 * (a - 1)
if e > 9 * (a - 1):
	g = g + str(q)
else:
	g = g + '1'
	e = e - 1
while a > 1:
	if e >= 9:
		h = h + '9'
		e = e - 9
	else:
		h = h + str(e)
		e = 0
	a = a - 1
h = h[::-1]
g = g + h
print(g, f)


(m, s) = map(int, input().split())
keeps = s
keepm = m
if s > 9 * m:
	print('-1 -1')
elif m == 1 and s < 10:
	print(s, s)
elif m == 1 and s > 9:
	print('-1 -1')
elif m > 1 and s == 0:
	print('-1 -1')
elif m > 1 and s < 10:
	maxnum = s * 10 ** (m - 1)
	minnum = 1 * 10 ** (m - 1) + (s - 1)
	print(minnum, maxnum)
elif m > 1 and s >= 10:
	geshu = s // 9
	if s % 9 == 0:
		maxnum = int('9' * geshu) * 10 ** (m - geshu)
	else:
		first = int('9' * geshu) * 10 + s % 9
		maxnum = first * 10 ** (m - (geshu + 1))
	if s % 9 == 0:
		minnum = 1 * 10 ** (m - 1) + int('8' + '9' * (geshu - 1))
	elif m == geshu + 1:
		minnum = s % 9 * 10 ** (m - 1) + int('9' * geshu)
	else:
		minnum = 1 * 10 ** (m - 1) + (s % 9 - 1) * 10 ** geshu + int('9' * geshu)
	print(minnum, maxnum)


def find_length_sum_digits(m, s):
	if m * 9 < s or (s == 0 and m != 1):
		return '-1 -1'
	min_n = find_min(m, s)
	max_n = find_max(m, s)
	return min_n + ' ' + max_n

def find_min(m, s):
	min_n = ''
	length = m - 1
	while length != 0:
		for i in range(9, -1, -1):
			if 1 <= s - i <= 9 * length:
				s -= i
				min_n = str(i) + min_n
				break
		length -= 1
	min_n = str(s) + min_n
	return min_n

def find_max(m, s):
	max_n = ''
	length = m
	while length != 0:
		diff = min(s, 9)
		s -= diff
		max_n += str(diff)
		length -= 1
	return max_n
(m, s) = [int(e) for e in input().split()]
print(find_length_sum_digits(m, s))


l = list(map(int, input().split()))
if l[1] == 0 and l[0] > 1 or 9 * l[0] < l[1]:
	print('-1 -1')
elif l[1] == 0 and l[0] == 1:
	print('0 0')
else:
	rmax = l[1] // 9 * '9'
	if l[1] % 9 != 0:
		rmax += str(l[1] - 9 * (l[1] // 9)) + (l[0] - 1 - l[1] // 9) * '0'
		if l[0] - 1 - l[1] // 9 > 0:
			rmin = '1' + (l[0] - 1 - l[1] // 9 - 1) * '0' + str(l[1] - 9 * (l[1] // 9) - 1) + l[1] // 9 * '9'
		else:
			rmin = str(l[1] - 9 * (l[1] // 9)) + l[1] // 9 * '9'
	else:
		rmax += (l[0] - l[1] // 9) * '0'
		if l[0] - l[1] // 9 > 0:
			rmin = '1' + (l[0] - l[1] // 9 - 1) * '0' + '8' + (l[1] // 9 - 1) * '9'
		else:
			rmin = l[1] // 9 * '9'
	print(rmin, rmax)


import sys
cache = {}

def logging(fun):

	def decorated(*args):
		result = fun(*args)
		print(fun.__name__, args, ' -> ', result)
		return result
	return decorated

def num(m, s):
	if m < 1:
		return (-1, -1)
	if m == 1:
		if s in range(1, 10):
			return (s, s)
		else:
			return (-1, -1)
	if (m, s) in cache:
		return cache[m, s]
	(result_min, result_max) = (-1, -1)
	for d in range(0, 10):
		(prev_min, prev_max) = num(m - 1, s - d)
		if prev_min < 0:
			continue
		prev_min = prev_min * 10 + d
		prev_max = prev_max * 10 + d
		if result_min == -1:
			(result_min, result_max) = (prev_min, prev_max)
		else:
			result_min = min(result_min, prev_min)
			result_max = max(result_max, prev_max)
	cache[m, s] = (result_min, result_max)
	return (result_min, result_max)
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
else:
	print(' '.join(map(str, num(m, s))))


(n, m) = map(int, input().split())
if n == 1:
	if m > 9 or m < 0:
		print('-1 -1')
	else:
		print(m, m)
if (m < 1 or m > n * 9) and n > 1:
	print('-1 -1')
elif n > 1:
	u = m
	small = [0] * n
	large = [0] * n
	x = 0
	while m // 9 > 0:
		m -= 9
		large[x] = 9
		x += 1
	try:
		large[x] = m
		large[x + 1:] = [0] * (n - x - 1)
	except:
		pass
	x = n - 1
	while u >= 10:
		u -= 9
		small[x] = 9
		x -= 1
	if x == 0:
		small[x] = u
	else:
		small[x] = u - 1
		small[0] = 1
	for x in range(n):
		print(small[x], end='')
	print(' ', end='')
	for x in range(n):
		print(large[x], end='')
	print()


shuru = input()
pieces = shuru.split()
a = int(pieces[0])
b = int(pieces[1])
minn = ''
yiyong = 0
if b < 0 or b > 9 * a:
	print('-1 -1')
elif b == 0 and a == 1:
	print('0 0')
elif b == 0 and a != 1:
	print('-1 -1')
elif b >= 9 * (a - 1) + 1:
	minn = str(b - 9 * (a - 1))
	for i in range(0, a - 1):
		minn = minn + str(9)
	print(minn, end=' ')
else:
	minn = str(1)
	howmany9 = (b - 1) // 9
	jiuzhiqian = b - 1 - howmany9 * 9
	sjzq = str(jiuzhiqian)
	howmany0 = a - 1 - howmany9 - 1
	for i in range(1, howmany0 + 1):
		minn = minn + str(0)
	minn = minn + sjzq
	for i in range(1, howmany9 + 1):
		minn = minn + str(9)
	print(minn, end=' ')
yiyong = 0
maxx = ''
if b < 0 or b > 9 * a:
	t = 1
elif b == 0 and a == 1:
	t = 1
elif b == 0 and a != 1:
	t = 1
else:
	for i in range(a):
		shengxia = b - yiyong
		zheciyong = min(9, shengxia)
		szcy = str(zheciyong)
		maxx = maxx + szcy
		yiyong = yiyong + zheciyong
	print(maxx)


(m, s) = input().split()
m = int(m)
s = int(s)
x = 1
min1 = max1 = 0
if s > 9 * m or (m > 1 and s == 0):
	print(-1, -1)
else:
	if m == 1 and s == 0:
		min1 = max1 = 0
	else:
		n9 = int(s / 9)
		s = s % 9
		m = m - n9
		if s == 0:
			if m == 0:
				for i in range(n9):
					min1 = min1 + 9 * x
					x = x * 10
				max1 = min1
			else:
				min1 = 10 ** (m - 1)
				for i in range(m + n9):
					if i < n9:
						max1 = max1 * 10 + 9
					else:
						max1 = max1 * 10
					if i == m:
						min1 = min1 * 10 + 8
					if i > m:
						min1 = min1 * 10 + 9
		else:
			if m > 1:
				for i in range(m + n9):
					if i < m - 1:
						min1 = 10 ** i
					if i == m - 1:
						min1 = min1 * 10 + s - 1
					if i > m - 1:
						min1 = min1 * 10 + 9
					if i < n9:
						max1 = max1 * 10 + 9
					if i == n9:
						max1 = max1 * 10 + s
					if i > n9:
						max1 = max1 * 10
			if m == 1:
				min1 = s
				max1 = s
				for i in range(n9):
					min1 = min1 * 10 + 9
					max1 = max1 + 10 ** (i + 1) * 9
	print(min1, max1)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

def ii():
	return int(I().strip())

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

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True

def main():
	(m, s) = mi()
	if 9 * m < s:
		print(-1, -1)
	elif s == 0 and m > 1:
		print(-1, -1)
	else:
		maxi = ''
		cnt = s
		for i in range(m):
			if cnt >= 9:
				maxi += '9'
				cnt -= 9
			else:
				maxi += str(cnt)
				cnt = 0
		cnt = s - 1
		tmp = ''
		for i in range(m - 1):
			if cnt >= 9:
				tmp += '9'
				cnt -= 9
			else:
				tmp += str(cnt)
				cnt = 0
		tmp = tmp[::-1]
		mini = str(1 + cnt)
		mini += tmp
		print(mini, maxi)
main()


def solve(m, s):
	smallest = [0 for i in range(m)]
	largest = [0 for i in range(m)]
	smallest[-1] = s
	for i in range(1, m):
		if smallest[-i] > 9:
			smallest[-i - 1] = smallest[-i] - 9
			smallest[-i] = 9
	if smallest[0] == 0 and len(smallest) > 1:
		try:
			lastzero = m - 1 - smallest[::-1].index(0)
			smallest[0] = 1
			smallest[lastzero + 1] -= 1
		except:
			print('-1 -1')
			return
	largest[0] = s
	for i in range(0, m - 1):
		if largest[i] > 9:
			largest[i + 1] = largest[i] - 9
			largest[i] = 9
	if smallest[0] > 9 or (smallest[0] == 0 and len(smallest) > 1):
		print('-1 -1')
		return
	if largest[-1] > 9 or (largest[0] == 0 and len(smallest) > 1):
		print('-1 -1')
		return
	smallest = ''.join([str(c) for c in smallest])
	largest = ''.join([str(c) for c in largest])
	print(smallest, largest)
(m, s) = [int(c) for c in input().split()]
solve(m, s)


(n, s) = list(map(int, input().split()))
if s != 0:
	if n * 9 >= s:
		Max = '9' * (s // 9)
		if s % 9 != 0:
			Max += str(s % 9)
		if len(Max) < n:
			Max += '0' * (n - len(Max))
		Min = list(map(int, Max))
		Min.sort()
		if Min[0] == 0:
			for n in range(1, len(Min)):
				if Min[n] >= 1:
					Min[0] += 1
					Min[n] -= 1
					break
		X = []
		for val in Min:
			X.append(str(val))
		X = ''.join(X)
		print(X, Max)
	else:
		print(-1, -1)
elif n == 1:
	print(0, 0)
else:
	print(-1, -1)


(m, S) = map(int, input().split())

def valid(m, s):
	return 9 * m + s >= S

def rtol():
	l = [0] * m
	l[0] = 1
	s = 1
	if s == S:
		return l
	for i in range(m):
		while l[i] < 9:
			l[i] += 1
			s += 1
			if S == s:
				return l
			if not valid(m - i + 1, s):
				return -1
	else:
		return -1

def ltor():
	l = [0] * m
	l[0] = 1
	s = 1
	if s == S:
		return l
	for i in range(m - 1, -1, -1):
		while l[i] < 9:
			l[i] += 1
			s += 1
			if S == s:
				return l
	return -1
if m == 1 and S == 0:
	print('0 0')
else:
	try:
		print(''.join(map(str, ltor())), end=' ')
	except TypeError:
		print('-1', end=' ')
	try:
		print(''.join(map(str, rtol())))
	except TypeError:
		print('-1')


(m, s) = map(int, input().split())
if s > m * 9 or (s == 0 and m != 1):
	print('-1 -1')
else:
	biggest = '9' * (s // 9) + (str(s % 9) if s % 9 != 0 else '')
	if len(biggest) < m:
		biggest += '0' * (m - len(biggest))
	smallest = list(biggest[::-1])
	if len(smallest) > 1:
		if smallest[0] == '0':
			smallest[0] = '1'
			for i in range(1, len(smallest)):
				if smallest[i] != '0':
					smallest[i] = str(int(smallest[i]) - 1)
					break
	smallest = ''.join(smallest)
	print(smallest, biggest)


(ln, s) = map(int, input().split())
if 9 * ln < s:
	print('-1 -1')
elif s == 0 and ln == 1:
	print('0 0')
elif s == 0 and ln != 1:
	print('-1 -1')
else:
	n = (s + 8) // 9
	x = (n - 1) * 9
	if n > ln:
		print('-1 -1')
	elif n == ln:
		ans = str(s - x) + '9' * (n - 1)
		print(ans, ans[::-1])
	else:
		ans = '1' + '0' * (ln - n - 1) + str(s - x - 1) + '9' * (n - 1)
		rev = '9' * (n - 1) + str(s - x) + '0' * (ln - n)
		print(ans, rev)


(l, s) = list(map(int, input().split()))
if s > 9 * l or (s < 1 and l != 1):
	maxm = -1
	minm = -1
else:
	r = s % 9
	q = s // 9
	maxm = str(9) * q + '0' * (l - q)
	maxm = int(maxm) + int(r * 10 ** (l - q - 1))
	minm = int(str(r) + str(9) * q)
	minm = minm - 10 ** (len(str(minm)) - 1)
	minm = 10 ** (l - 1) + minm
print(minm, maxm)


(m, s) = map(int, input().split())
if s == 0 and m > 1:
	s = -1
ans = ''
ans1 = ''
s1 = s - 1
k = 0
while s > 0:
	if s >= 9:
		ans += '9'
		s -= 9
	else:
		ans += str(s)
		s -= s
t = 0
if len(ans) > 0:
	t = 1 if len(ans) < m else 0
	ans1 = str(int(ans) - t)
	k += t
if len(ans) > m or len(ans1) > m or s == -1:
	print('-1 -1')
elif s1 == -1 and m == 1:
	print('0 0')
else:
	ans = ans + (m - len(ans)) * '0'
	ans1 = '1' * k + '0' * (m - len(ans1) - 1) + ans1[::-1]
	print(ans1, ans)


(m, s) = input().split(' ')
m = int(m)
s = int(s)
if s == 0:
	if m != 1:
		print('-1 -1')
	else:
		print('0 0')
elif s <= 9:
	max = 10 ** (m - 1) * s
	min = 10 ** (m - 1) + s - 1
	print(str(min) + ' ' + str(max))
else:
	y = s % 9
	n = int(s / 9)
	if n > m:
		print('-1 -1')
	elif n == m and y > 0:
		print('-1 -1')
	elif n == m and y == 0:
		max = min = 10 ** m - 1
		print(str(min) + ' ' + str(max))
	else:
		max = int(int(str(10 ** n - 1) + str(y)) * 10 ** (m - n - 1))
		if y == 0:
			if n == m:
				min = max
			else:
				min = int(10 ** (m - 1) + 10 ** n - 10 ** (n - 1) - 1)
		else:
			min = int(10 ** (m - 1) + 10 ** n * (y - 1) + 10 ** n - 1)
		print(str(min) + ' ' + str(max))


import math
while True:
	try:
		(m, s) = map(int, input().split())
		if s > 9 * m or (s == 0 and m != 1):
			print('-1 -1')
		elif s == 0 and m == 1:
			print('0 0')
		elif 0 < s <= 9:
			if m == 1:
				num_b = num_a = s
			else:
				num_a = str(s).ljust(m, '0')
				num_b = str(1).ljust(m - 1, '0') + str(s - 1)
			print('{} {}'.format(num_b, num_a))
		elif 9 < s <= 9 * (m - 1):
			num_a = str(s % 9).rjust(int(s / 9) + 1, '9').ljust(m, '0')
			num_b = str(1) + str((s - 1) % 9).ljust(math.ceil(s / 9), '9').rjust(m - 1, '0')
			print('{} {}'.format(num_b, num_a))
		else:
			num_ori = s - (m - 1) * 9
			num_a = str(num_ori).rjust(m, '9')
			num_b = str(num_ori).ljust(m, '9')
			print('{} {}'.format(num_b, num_a))
	except EOFError:
		break


(m, s) = map(int, input().split())
(mx, mi, a, b) = ([], [], 0, 0)
if s == 0 and m > 1:
	print('-1 -1')
	quit()
if s == 0 and m == 0:
	print('0 0')
	quit()
while s > 0:
	if s > 9:
		mx.append(9)
		s -= 9
		a += 1
	elif s > 0:
		mx.append(s)
		a += 1
		s = 0
	if s == 0:
		break
if a > m:
	print('-1 -1')
	quit()
z = [0 for i in range(m - a)]
mx.extend(z)
cmx = mx[:]
if m > a:
	mx[-1] = 1
	mx[a - 1] -= 1
for i in range(-1, -m - 1, -1):
	print(mx[i], end='')
print(' ', end='')
for i in cmx:
	print(i, end='')


(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and m > 1):
	print('-1 -1')
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
mn = ''
ss = s - 1
for i in range(m - 1):
	x = min(ss, 9)
	ss -= x
	mn = chr(ord('0') + x) + mn
ss += 1
mn = chr(ord('0') + ss) + mn
mx = ''
ss = s
for i in range(m):
	x = min(ss, 9)
	ss -= x
	mx = mx + chr(ord('0') + x)
print('%s %s' % (mn, mx))


input_s = input().split(' ')
m = int(input_s[0])
s = int(input_s[1])
result_max = ''
result_min = ''
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s > m * 9:
	print('-1 -1')
else:
	for (index, i) in enumerate(range(s // 9)):
		result_max += '9'
		result_min += '9'
	if s % 9 != 0:
		result_max += str(s % 9)
		result_min += str(s % 9)
	if m - len(result_min) > 0:
		result_min = result_min[:-1] + str(int(result_min[-1]) - 1)
	for i in range(m - len(result_max)):
		result_max += '0'
		result_min += '0'
	print('1' + result_min[:-1][::-1] if result_min.find('0') >= 0 else result_min[::-1], result_max)


qhy = input()
(a, b) = [int(i) for i in qhy.split()]
maxn = []
minn = []
if b == 0 and a != 1:
	print('-1 -1')
elif 9 * a < b:
	print('-1 -1')
else:
	t = 0
	m = b
	for i in range(a):
		if m > 9:
			t = 9
			m = m - t
			maxn.append(t)
		else:
			t = m
			m = 0
			maxn.append(t)
	t = 0
	m = b
	if m == 0:
		minn.append(0)
	elif m <= (a - 1) * 9:
		minn.append(1)
		m -= 1
	else:
		t = m - (a - 1) * 9
		minn.append(t)
		m = m - t
	for i in range(1, a):
		if m < 9 * (a - i - 1):
			t = 0
			minn.append(0)
		else:
			t = m - 9 * (a - i - 1)
			m -= t
			minn.append(t)
	minn.append(' ')
	for i in range(a + 1):
		print(minn[i], end='')
	for i in range(a):
		print(maxn[i], end='')


(m, s) = map(int, input().split())

def invstr(s):
	return s[::-1]
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	min_str = ''.join(['9' for i in range((s - 1) // 9)])
	if m - len(min_str) == 1:
		min_str += str((s - 1) % 9 + 1)
	else:
		min_str += str((s - 1) % 9)
		min_str += ''.join(['0' for i in range(m - 1 - len(min_str))])
		min_str += '1'
	min_str = invstr(min_str)
	max_str = ''.join(['9' for i in range(s // 9)])
	if s % 9 != 0:
		max_str += str(s % 9)
	max_str += ''.join(['0' for i in range(m - len(max_str))])
	print(f'{min_str} {max_str}')


s = input().split()
a = int(s[0])
b = int(s[1])
if b / a > 9 or b / a <= 0:
	if a == 1 and b == 0:
		print('0', '0')
	else:
		print('-1', '-1')
else:
	k = int((b - 1) / 9)
	j = b - 1 - k * 9
	n = ''
	if a == k + 1:
		l = [str(j + 1)] + ['9'] * k
		t = l[:]
		t.reverse()
	else:
		l = ['1'] + ['0'] * (a - k - 2) + [str(j)] + ['9'] * k
		t = ['9'] * k + [str(j + 1)] + ['0'] * (a - k - 1)
	if l[len(l) - 1] == 0:
		print(n.join(l), n.join(l))
	else:
		print(n.join(l), n.join(t))


(a, b) = map(int, input().split())
if a > 1 and (not b):
	print('-1 -1')
elif a == 1 and b == 0:
	print('0 0')
else:
	b -= 1
	i = a - 1
	j = 0
	s1 = list('1' + '0' * (a - 1))
	s2 = list('1' + '0' * (a - 1))
	while b:
		if s1[i] == '9':
			i -= 1
		if s2[j] == '9':
			j += 1
		if i < 0 or j >= a:
			print(-1, -1)
			exit(0)
		s1[i] = chr(ord(s1[i]) + 1)
		s2[j] = chr(ord(s2[j]) + 1)
		b -= 1
	print(''.join(s1), ''.join(s2))


def func():
	tokens = input().split()
	length = int(tokens[0])
	sum = int(tokens[1])
	sum1 = sum
	if sum == 0 and length == 1:
		print('0 0')
		return
	start = []
	for i in range(length):
		start.append(0)
	sum = sum - 1
	digit = len(start) - 1
	while 1:
		if digit < 0:
			if sum > 0:
				print('-1 -1')
				return
		if sum > 9:
			sum = sum - 9
			start[digit] = 9
			digit -= 1
		elif sum >= 0:
			start[digit] = sum
			break
		elif sum < 0:
			print('-1 -1')
			return
	if start[0] < 9:
		start[0] += 1
	else:
		print('-1 -1')
		return
	reverse = []
	for i in range(length):
		reverse.append(0)
	dig = 0
	while 1:
		if sum1 > 9:
			sum1 = sum1 - 9
			reverse[dig] = 9
			dig += 1
		elif sum1 >= 0:
			reverse[dig] = sum1
			break
	print(''.join((str(x) for x in start)) + ' ' + ''.join((str(y) for y in reverse)))
func()


import copy

def march(number):
	result = 0
	while number != 0:
		result += number % 10
		number //= 10
	return result
line = input()
line1 = line.split()
m = int(line1[0])
s = int(line1[1])
lista = ['0'] * m
listb = ['0'] * m
s1 = s
s2 = s - 1
for i in range(m):
	if s1 >= 9:
		lista[i] = '9'
		s1 = s1 - 9
		continue
	if s1 < 9:
		lista[i] = str(s1)
		s1 = 0
if lista[m - 1] != '0':
	for i in range(m):
		listb[i] = lista[m - 1 - i]
else:
	for i in range(m - 1):
		if s2 >= 9:
			listb[i] = '9'
			s2 = s2 - 9
			continue
		if s2 < 9:
			listb[i] = str(s2)
			s2 = 0
	listb[m - 1] = '1'
	listc = copy.copy(listb)
	for i in range(m):
		listb[i] = listc[m - 1 - i]
if s > 9 * m or (s == 0 and m != 1):
	lista = ['-1']
	listb = ['-1']
if m == 1 and s == 0:
	lista = ['0']
	listb = ['0']
print(''.join(listb))
print(''.join(lista))


def g(x, y):
	if y >= 9:
		return 9
	else:
		return y
(m, s) = map(int, input().split())
(s_1, s_2) = (m, s)
q = m
a = []
h = ''
t = ''
if m == 0 or s > 9 * m:
	print('-1', '-1')
elif s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	if s > 9 * m - 8:
		gou = s - 9 * (m - 1)
	else:
		gou = 1
	a.append(gou)
	s = s - 1
	m = m - gou
	for i in range(q - 1):
		zhongjian = g(m, s)
		a.append(zhongjian)
		m = m - 1
		s = s - zhongjian
	for i in range(q):
		haha = g(s_1, s_2)
		s_1 = s_1 - 1
		s_2 = s_2 - haha
		t = t + str(haha)
	for i in range(q - 1):
		h += str(a[q - 1 - i])
	print(str(gou) + h, t)


(m, s) = map(int, input().split())
res1 = ''
res2 = ''
space = s - 1
space2 = s
flag = False
if s > m * 9:
	flag = True
for i in range(m):
	if space >= 9:
		res1 += '9'
		space -= 9
	elif 9 > space > 0:
		res1 += str(space)
		space = 0
	if space2 >= 9:
		res2 += '9'
		space2 -= 9
	elif 9 > space2 > 0:
		res2 += str(space2)
		space2 = 0
	else:
		res2 += '0'
res1 = res1[::-1]
try:
	if 0 < int(res1[0]) < 9 and len(res1) == m:
		res1 = str(int(res1[0]) + 1) + res1[1:]
	else:
		res1 = str(10 ** (m - len(res1) - 1)) + res1
except:
	pass
if int(res2) == 0 and s == 0 and (m > 1) or flag:
	print(-1, -1)
elif res1 == '':
	res1 = res2
	print(res1, res2)
else:
	print(res1, res2)


line = input()
(m, s) = [int(i) for i in line.split()]
large = 0
tiny = 0
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif s > 9:
	if s > m * 9:
		print('-1 -1')
	else:
		t = 9
		p = 9
		sl = s
		st = s
		tiny = 9
		for i in range(m):
			large += t * pow(10, m - i - 1)
			sl = sl - t
			if sl >= 0:
				if sl < t:
					t = sl
		for i in range(m - 1):
			st = st - p
			if st > 0:
				if st < p:
					p = st
				tiny += p * pow(10, i + 1)
		if tiny // pow(10, m - 1) == 0:
			for i in range(m):
				if tiny // pow(10, i) == 0:
					tiny = tiny + pow(10, m - 1) - pow(10, i - 1)
		print(tiny, large)
else:
	large = s * pow(10, m - 1)
	tiny = pow(10, m - 1) + s - 1
	print(tiny, large)


a = input().split()
m = int(a[0])
z = int(a[0])
s = int(a[1])
x = int(a[1])
q = 0
p = 0
if s > 9 * m or (m > 1 and s == 0):
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	while s >= 9:
		s = s - 9
		q = q + 10 ** (m - 1) * 9
		m = m - 1
	if s >= 0:
		q = q + int(10 ** (m - 1) * s)
		m = m - 1
	if x <= 9 * (z - 1) + 1:
		p = p + 10 ** (z - 1)
		x = x - 1
		for i in range(0, z - 1):
			if x >= 9:
				p = p + 10 ** i * 9
				x = x - 9
			else:
				p = p + 10 ** i * x
				x = 0
	else:
		x = x - 9
		p = 10 ** (z - 1) * (x - 9 * (z - 2) + 1) - 1
	print(int(p), q)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

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

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
INF = float('inf')
mod = 10 ** 9 + 7
(m, s) = MAP()
if m == 1 and s >= 0 and (s < 10):
	print(s, s)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	q = s // 9
	rem = s % 9
	if rem != 0:
		large = '9' * q + str(rem)
	else:
		large = '9' * q
	if len(large) < m:
		large += '0' * (m - len(large))
	small = large[::-1]
	small = list(small)
	if small[0] == '0':
		for (i, ch) in enumerate(small):
			if ch != '0':
				small[i] = str(int(small[i]) - 1)
				break
		small[0] = '1'
	small = ''.join(small)
	print(small, large)


ms = [int(x) for x in input().split()]
(m, s) = (ms[0], ms[1])
import sys
if m > 1 and s == 0:
	print('-1 -1')
	sys.exit()
if s > 9 * m:
	print('-1 -1')
	sys.exit()
if m == 1 and s == 0:
	print('0 0')
	sys.exit()
(min, max) = ([0] * m, [0] * m)

def main_1(s, i=1):
	if s > 9:
		max[i - 1] = 9
		main_1(s - 9, i + 1)
	else:
		max[i - 1] = s

def main_2(s, i=1):
	if s > 9:
		min[-i] = 9
		main_2(s - 9, i + 1)
	else:
		min[-i] = s
if s <= 9 * (m - 1):
	min[0] = 1
	main_2(s - 1)
else:
	main_2(s)
main_1(s)
from functools import reduce
Min = reduce(lambda x, y: str(x) + str(y), min)
Max = reduce(lambda x, y: str(x) + str(y), max)
print(Min, Max)


def ch(n, k):
	return k >= 0 and k <= 9 * n
(n, k) = input().split(' ')
n = int(n)
k = int(k)
n1 = n
a = []
k1 = k
if k == 0 and n == 1:
	print('0 0')
elif k == 0 or n * 9 < k:
	print('-1 -1')
else:
	for i in range(0, n):
		for j in range(0, 10):
			if (i > 0 or j > 0 or (n == 1 and j == 0)) and ch(n - i - 1, k - j):
				a.append(str(j))
				k -= j
				break
	print(''.join(a), end=' ')
	a.clear()
	for i in range(0, n):
		for j in range(0, 10):
			x = 9 - j
			if (i > 0 or x > 0 or (n == 1 and x == 0)) and ch(n - i - 1, k1 - x):
				a.append(str(x))
				k1 -= x
				break
	print(''.join(a), end=' ')


(m, s) = map(int, input().split(' '))
if s == 0 and m == 1:
	print('0' + ' ' + '0')
elif s == 0 and m != 1:
	print('-1' + ' ' + '-1')
elif s > m * 9:
	print('-1' + ' ' + '-1')
else:
	l = []
	while s > 9:
		l.append(9)
		s -= 9
	l.append(s)
	l = l + [0] * (m - len(l))
	minimum = l[::-1]
	for i in range(m):
		l[i] = str(l[i])
	maximum = ''.join(l)
	if minimum[0] == 0:
		minimum[minimum.count(0)] -= 1
		minimum[0] = 1
	for i in range(m):
		minimum[i] = str(minimum[i])
	minimum = ''.join(minimum)
	print(minimum + ' ' + maximum)


(a, b) = map(int, input().split())
if b > 9 * a:
	print('-1' + ' ' + '-1')
elif b == 0 and a > 1:
	print('-1' + ' ' + '-1')
elif a == 1 or b / a == 9:
	print(str(b // a) * a + ' ' + str(b // a) * a)
else:
	mx1 = b // 9
	mx2 = b % 9
	mx = mx1 * '9' + str(mx2) + (a - mx1 - 1) * '0'
	my = mx
	y = my.count('0')
	if y == 0:
		x = list(mx)
		x.reverse()
		mi = ''.join(x)
	else:
		mi = '1' + (y - 1) * '0' + str(eval(mx[-y - 1]) - 1) + (a - y - 1) * '9'
	print(mi + ' ' + mx)


(a, b) = map(int, input().split())
output1 = ''
backupb = b
output2 = ''
if b <= 0 and a != 1 or b > a * 9:
	print('-1 -1')
elif a == 1 and b == 0:
	print(0, 0)
else:
	for i in range(a):
		output1 = output1 + str(min(9, b))
		if b - 9 > 0:
			b = b - 9
		else:
			b = 0
	b = backupb
	if (a - 1) * 9 > b - 1:
		for i in range(1, a + 1):
			if b != 1:
				output2 = output2 + str(min(9, b - 1))
				if b - 9 > 1:
					b = b - 9
				else:
					b = 1
			elif i != a:
				output2 = output2 + '0'
			else:
				output2 += '1'
	else:
		for i in range(1, a + 1):
			if b >= 10:
				output2 = output2 + '9'
				b = b - 9
			else:
				output2 += str(b)
print(output2[::-1], output1)


l = input().split(' ')
(m, s) = (int(l[0]), int(l[1]))
ma = []
if m == 1 and s >= 10:
	print(-1, -1)
elif m == 1 and s <= 9:
	print(s, s)
elif m >= 2 and s == 0:
	print(-1, -1)
elif m >= 2 and s > 9 * m:
	print(-1, -1)
else:
	for i in range(m):
		n = 9
		if n >= s:
			n = s
			s = 0
			ma += [n]
		else:
			s = s - n
			ma += [n]
	mi = ma[::-1]
	if mi[0] == 0:
		mi[0] += 1
		for i in range(m):
			if not i == 0 and (not mi[i] == 0):
				mi[i] -= 1
				break
	for i in range(m):
		ma[i] = str(ma[i])
		mi[i] = str(mi[i])
	print(int(''.join(mi)), int(''.join(ma)))


(m, s) = map(int, input().split())

def sum_digits(n):
	s = 0
	while n:
		s += n % 10
		n //= 10
	return s
s2 = s
s3 = s
low = ''
high = ''
if s == 0 and m != 1 or s > m * 9:
	print('-1 -1')
else:
	for digit in range(m):
		if digit == m - 1:
			low = str(s2) + low
		elif s2 > 9:
			low = '9' + low
			s2 -= 9
		else:
			low = str(s2 - 1) + low
			s2 -= s2 - 1
	for digit in range(m):
		if s3 >= 9:
			high = high + '9'
			s3 -= 9
		else:
			high = high + str(s3)
			s3 -= s3
	print(low + ' ' + high)


[l, t] = list(map(int, input().split(' ')))
m = l
n = t
large = []
small = []
if t == 0 and l > 1:
	print('-1 -1')
elif 9 * l < t:
	print('-1 -1')
elif l == 1 and t == 0:
	print('0 0')
else:
	while l > 0 and t > 9:
		large += ['9']
		t -= 9
		l -= 1
	large += [t] + (l - 1) * ['0']
	while m >= 1 and n > 9:
		small += ['9']
		n -= 9
		m -= 1
	if m >= 2:
		small += [n - 1] + (m - 2) * ['0'] + ['1']
	if m == 1:
		small += [n]
print(''.join(list(map(str, reversed(small)))), end=' ')
print(''.join(list(map(str, large))))


(m, s) = map(int, input().split())
if s > m * 9:
	print(-1, -1)
elif s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	k9 = (s - 1) // 9
	kn9 = m - k9
	a = [0] * (m - k9) + [9] * k9
	if kn9 == 1:
		a[0] = s - k9 * 9
	else:
		a[0] = 1
		a[kn9 - 1] = s - k9 * 9 - 1
	k9 = s // 9
	b = [9] * k9 + [0] * (m - k9)
	if k9 < m:
		b[k9] = s % 9
	print(*a, ' ', *b, sep='')


a = input().split()
m = int(a[0])
s = int(a[1])

def max(m, s):
	if s > 9 * m:
		return '-1'
	elif s == 0 and m == 1:
		return '0'
	elif s == 0 and m > 1:
		return '-1'
	else:
		digits = []
		while s >= 9:
			digits.append('9')
			s -= 9
			m -= 1
		else:
			while m > 0:
				digits.append(str(s))
				s = 0
				m -= 1
			else:
				return ''.join(digits)

def min(m, s):
	if s > 9 * m:
		return '-1'
	elif s == 0 and m == 1:
		return '0'
	elif s == 0 and m > 1:
		return '-1'
	elif m == 1:
		return str(s)
	else:
		digits = []
		while s > 9:
			digits.append('9')
			s -= 9
			m -= 1
		else:
			while m > 1:
				if s > 0:
					digits.append(str(s - 1))
					s = 0
					m -= 1
				else:
					digits.append(str(s))
					m -= 1
			else:
				if digits[-1] == '9':
					digits.append(str(s))
					return ''.join(digits[::-1])
				else:
					digits.append(str('1'))
					return ''.join(digits[::-1])
print(min(m, s), max(m, s))


def cin():
	return map(int, input().split())
import collections
(m, s) = cin()
(a, curr1) = ([1] + [0] * (m - 1), 1)
for i in range(m - 1, 0, -1):
	a[i] = min(9, s - curr1)
	curr1 += a[i]
if s != curr1:
	a[0] = min(9, s - curr1 + 1)
	curr1 += a[0] - 1
(b, curr) = ([0] * m, 0)
for i in range(m):
	b[i] = min(9, s - curr)
	curr += b[i]
if s - curr1 != 0 or s - curr != 0 or any(a + b) < 0 or (b[0] == 0 and m > 1):
	exit(print(-1, -1))
else:
	print(''.join((str(i) for i in a)), ''.join((str(i) for i in b)))


import math
a = input()
(m, s) = a.split()
m = int(m)
s = int(s)
small = [0] * m
big = [0] * m
t = math.ceil(s / 9) - 1
if [m, s] == [1, 0]:
	print('0 0')
elif s > 9 * m or s == 0:
	print('-1 -1')
else:
	for i in range(t):
		big[i] = 9
	big[t] = s - 9 * t
	small[m - t - 1] = s - 9 * t - 1
	small[0] = max(1, s - 9 * (m - 1))
	for i in range(m - t, m):
		small[i] = 9
	small = map(str, small)
	big = map(str, big)
	str_small = ''.join(small)
	str_big = ''.join(big)
	print(str_small + ' ' + str_big)


(m, s) = input().split()
if int(s) == 0 and int(m) == 1:
	print('0 0')
elif int(s) < 1 or int(s) > 9 * int(m):
	print('-1 -1')
else:
	small = pow(10, int(m) - 1)
	large = small * 10 - 1
	a = sum(map(int, str(small)))
	b = sum(map(int, str(large)))
	k = 1
	d = int(s) - a
	while d > 0:
		if d > 9:
			small += k * 9
			d = d - 9
		else:
			small += k * d
			d = 0
		k = k * 10
	dl = b - int(s)
	j = 1
	while dl > 0:
		if dl <= 9:
			large -= j * dl
			dl = 0
		else:
			large -= j * 9
			dl -= 9
		j = j * 10
	print(small, end=' ')
	print(large)


inp = input().split(' ')
m = int(inp[0])
s = int(inp[1])
s_max = s
s_min = s
max_val = ''
min_val = ''
if s == 0 and m != 1 or m * 9 < s:
	max_val = -1
	min_val = -1
	m = 0
for i in range(m):
	if s_max >= 9:
		max_val += '9'
		s_max -= 9
	else:
		max_val += str(s_max)
		s_max -= s_max
	possible = s_min - 1
	possible = possible if possible > 0 else 0
	if possible >= 9:
		min_val += '9'
		s_min -= 9
	elif i != m - 1:
		min_val += str(possible)
		s_min -= possible
	else:
		min_val += str(s_min)
if m != 0:
	min_val = min_val[::-1]
print(min_val, max_val)


import sys

def main():
	number = []
	(m, s) = map(int, input().split())
	if s > 9 * m:
		print('-1 -1')
		return
	i = 9
	_len = m
	while m != 0 and i > -1:
		if s - i > -1:
			m -= 1
			s -= i
			number.append(i)
			i = 9
		else:
			i -= 1
	if sum(number) == 0 and _len != 1:
		print('-1 -1')
		return
	_max = ''
	for i in range(_len):
		_max += str(number[i])
	if _len > 1 and number[0] > 1:
		end = 1
		_min = ''
		while number[0] > 1 and _len - end != 0:
			if number[_len - end] != 9:
				number[0] -= 1
				number[_len - end] += 1
			else:
				end += 1
		i = end = 1
		while _len - end != i:
			if number[_len - end] != 9:
				if number[i] > 0:
					number[i] -= 1
					number[_len - end] += 1
				else:
					i += 1
			else:
				end += 1
		for i in range(_len):
			_min += str(number[i])
		print(_min + ' ' + _max)
		return
	else:
		print(_max + ' ' + _max)
		return
sys.exit(main())


(m, s) = [int(i) for i in input().split()]
a = s
if s < 1 and m > 1 or s > m * 9:
	print(-1, -1)
else:
	for i in range(m - 1, -1, -1):
		j = max(0, a - 9 * i)
		if j == 0 and i == m - 1 and a:
			j = 1
		print(j, end='')
		a -= j
	print(' ', end='')
	a = s
	for i in range(1, m + 1):
		j = min(9, a)
		print(j, end='')
		a -= j


(n, l) = input().split(' ')
l = int(l)
n = int(n)
if n == 1 and l == 0:
	print('0 0')
elif l > n * 9 or l == 0:
	print(-1, -1)
else:
	mx = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0}
	for i in range(9, 0, -1):
		mx[i] = l // i
		l %= i
	a = ''
	for i in range(9, 0, -1):
		if mx[i] != 0:
			a += str(i) * mx[i]
	temp = n - len(a)
	if temp == 0:
		for i in range(0, 10):
			print(str(i) * mx[i], end='')
		print(' ', end='')
	elif mx[1] > 0:
		print(1, end='')
		mx[1] -= 1
		print('0' * temp, end='')
		for i in range(0, 10):
			print(str(i) * mx[i], end='')
		print(' ', end='')
	else:
		print(1, end='')
		print('0' * (temp - 1), end='')
		flag = True
		for i in range(0, 10):
			if mx[i] > 0 and flag:
				print(i - 1, end='')
				mx[i] -= 1
				print(str(i) * mx[i], end='')
				flag = False
			else:
				print(str(i) * mx[i], end='')
		print(' ', end='')
	if len(a) < n:
		print(a, '0' * temp, sep='')
	else:
		print(a)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
(m, s) = M()
if s > m * 9:
	print(-1, -1)
elif s == 0 and m > 1:
	print(-1, -1)
else:
	sm = [0] * m
	lg = [0] * m
	sm[0] = 1
	lg[0] = 1
	x = s - 1
	y = s - 1
	i = 0
	j = m - 1
	while x != 0:
		if x + lg[i] <= 9:
			lg[i] += x
			x = 0
			i += 1
		else:
			x -= 9 - lg[i]
			lg[i] = 9
			i += 1
	while y != 0:
		if y + sm[j] <= 9:
			sm[j] += y
			y = 0
			j -= 1
		else:
			y -= 9 - sm[j]
			sm[j] = 9
			j -= 1
	for i in range(m):
		if i == m - 1:
			print(sm[i], end=' ')
		else:
			print(sm[i], end='')
	for i in range(m):
		print(lg[i], end='')


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s == 0:
	print(-1, -1)
elif m * 9 < s:
	print(-1, -1)
else:
	nums = []
	while len(nums) < m:
		nums.append(min(9, s))
		s = s - min(9, s)
	max_nums = [str(i) for i in nums]
	max_num = ''.join(max_nums)
	min_nums = nums[::-1]
	if min_nums[0] == 0:
		for (j, num) in enumerate(min_nums):
			if num != 0:
				min_nums[j] = num - 1
				break
		min_nums[0] = 1
	min_nums = [str(i) for i in min_nums]
	min_num = ''.join(min_nums)
	print(min_num, max_num)


import math
intp = input().split()
m = int(intp[0])
s = int(intp[1])

def toInt(n):
	return int(''.join(map(str, n)))

def revtoInt(n):
	n = list(reversed(n))
	if n[0] == 0:
		inde = n.index(list(filter(lambda x: x != 0, n))[0])
		n[0] = 1
		n[inde] -= 1
	return toInt(n)
if 1 > s or s > 9 * m:
	if m == 1 and s == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	big = [0] * m
	temp = s
	count = 0
	while temp > 0:
		if temp >= 9:
			big[count] = 9
			temp -= 9
		else:
			big[count] = temp
			temp = 0
		count += 1
	print(revtoInt(big), toInt(big))


(x, y) = map(int, input().split())
lol = [0] * x
i = 0
yo = [0] * x
y0 = y
if x == 1 and y < 10:
	print(y, y)
	exit()
while y > 0 and i < x:
	if lol[i] == 9:
		i += 1
	else:
		lol[i] += 1
		y -= 1
if y0 > 0:
	yo[0] = +1
	y0 -= 1
else:
	print(-1, -1)
	exit()
i = x - 1
while y0 > 0 and i > -1:
	if yo[i] == 9:
		i -= 1
	else:
		yo[i] += 1
		y0 -= 1
if lol[0] == 0 or yo[0] == 0 or y0 > 0 or (y > 0):
	print(-1, -1)
	exit()
yo = list(map(str, yo))
lol = list(map(str, lol))
print(''.join(yo), ''.join(lol))


(n, s) = input().split(' ')
n = int(n)
s = int(s)
x = [i for i in range(10)]
x.reverse()
maxi = 0
mini = 0
sum = 0
flag = 0
for i in range(n):
	for j in x:
		if i == 0 and j == 0:
			flag = -1
			break
		if j <= s - sum and (n - i - 1) * 9 >= s - sum - j:
			maxi += 10 ** (n - i - 1) * j
			sum += j
			break
		elif j == 0:
			flag = -1
	if flag == -1:
		break
if flag == -1:
	maxi = -1
flag = 0
sum = 0
x.reverse()
for i in range(n):
	for j in x:
		if i == 0 and j == 0:
			continue
		if j <= s - sum and (n - i - 1) * 9 >= s - sum - j:
			mini += 10 ** (n - i - 1) * j
			sum += j
			break
		elif j == 9:
			flag = -1
if flag == -1 or mini == 0:
	mini = -1
if n == 1 and s == 0:
	print(0, 0)
else:
	print(mini, maxi)


import sys
input = sys.stdin.readline

def inlt():
	return list(map(int, input().split()))
min_map = {}
max_map = {}

def sum_of_digits(digit):
	digit_sum = 0
	while digit:
		rem = digit % 10
		digit_sum += rem
		digit //= 10
	return digit_sum

def min_helper(l, s):
	if l == 0:
		return -1
	if l == 1:
		if len(str(s)) == 1:
			return str(s)
		else:
			return str(-1)
	if (l, s) in min_map:
		return min_map[l, s]
	start = 10 ** int(l - 1)
	increment = 10 ** int(l - 1)
	for i in range(9):
		end = start + increment - 1
		if sum_of_digits(start) <= s <= sum_of_digits(end):
			if -1 < s - end // 10 ** (l - 1) < 10:
				res = ''
				if l > 2:
					res = '0' * (l - 2)
				res += str(s - end // 10 ** (l - 1))
			else:
				res = min_helper(l - 1, s - end // 10 ** (l - 1))
			if res != '-1':
				min_map[l, s] = str(end // 10 ** (l - 1)) + res
				return min_map[l, s]
		start += increment
	min_map[l, s] = str(-1)
	return str(-1)

def max_helper(l, s):
	if l == 0:
		return -1
	if l == 1:
		if len(str(s)) == 1:
			return str(s)
		else:
			return str(-1)
	if (l, s) in max_map:
		return max_map[l, s]
	decrement = 10 ** int(l - 1)
	end = 10 ** int(l) - 1
	for i in range(9):
		start = end - decrement + 1
		if sum_of_digits(start) <= s <= sum_of_digits(end):
			if s - end // 10 ** (l - 1) == 0:
				res = '0' * (l - 1)
			else:
				res = max_helper(l - 1, s - end // 10 ** (l - 1))
			if res != '-1':
				max_map[l, s] = str(end // 10 ** (l - 1)) + res
				return max_map[l, s]
		end -= decrement
	max_map[l, s] = str(-1)
	return str(-1)

def solve(m, s):
	stack = []
	rem = s
	if s > 9 * m or (s == 0 and m > 1):
		print('-1 -1')
		return
	if s == 0 and m == 1:
		print('0 0')
		return
	for i in range(m):
		stack.append(min(9, rem))
		rem -= min(9, rem)
	_max = ''.join(map(str, stack))
	stack = stack[::-1]
	if stack[0] != 0:
		_min = ''.join(map(str, stack))
	else:
		stack[0] += 1
		for (i, num) in enumerate(stack[1:]):
			if stack[i + 1] != 0:
				stack[i + 1] -= 1
				break
		_min = ''.join(map(str, stack))
	print('%s %s' % (_min, _max))
ms = inlt()
solve(ms[0], ms[1])


(l, s) = [int(i) for i in input().split()]
if s == 0 and l > 1 or s > 9 * l:
	print('-1 -1')
else:
	ma = ''
	for j in range(0, l):
		if s - 9 * j >= 0:
			ma += str(min(9, s - 9 * j))
		else:
			ma += '0'
	e = list(ma)
	e.sort()
	mi = ''
	num = 0
	if e[0] != '0' or (l == 1 and s == 0):
		for i in range(0, l):
			mi += e[i]
	else:
		for i in range(0, l):
			if e[i] != '0':
				num = i
				break
		e[num] = str(int(e[num]) - 1)
		e[0] = '1'
		for j in range(0, l):
			mi += e[j]
	print(mi + ' ' + ma)


(m, n) = map(int, input().split())
s = n
res1 = [0 for i in range(m)]
res2 = [0] * m
if n > 9 * m or (s < 1 and m != 1):
	print(-1, end=' ')
	print(-1, end='')
else:
	s = n - 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			res1[i] = 9
			s = s - 9
		else:
			res1[i] = s
			s = 0
	res1[0] = s + 1
	s = n
	for i in range(0, m):
		if s > 9:
			res2[i] = 9
			s -= 9
		else:
			res2[i] = s
			s = 0
	for i in range(0, m):
		print(res1[i], end='')
	print(' ', end='')
	for i in range(0, m):
		print(res2[i], end='')


s1 = input().split()
leng = int(s1[0])
s = int(s1[1])
if leng * 9 < s or (leng > 1 and s == 0):
	print(-1, ' ', -1)
	raise SystemExit(0)
smax = ''
smin = ''
summax = s
summin = s
if s < 9:
	smax += str(s)
	smax += (leng - len(smax)) * '0'
	if leng == 1:
		print(s, ' ', smax, sep='')
	else:
		print(1, (leng - 2) * '0', s - 1, ' ', smax, sep='')
else:
	while summax > 9:
		smax += '9'
		summax -= 9
	smax += str(summax)
	smax += (leng - len(smax)) * '0'
	smin = '1' + (leng - 1) * '0'
	summin -= 1
	i = leng - 1
	while summin > 9 and i >= 0:
		shelp = str(int(smin[i]) + 9)
		smin = smin[:i] + shelp + smin[i + 1:]
		summin -= 9
		i -= 1
	shelp = str(int(smin[i]) + summin)
	smin = smin[:i] + shelp + smin[i + 1:]
	print(smin, ' ', smax, sep='')


(m, s) = input().split()
(m, s) = (int(m), int(s))
largest = ''
smallest = ''
p = m
q = s
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or 9 * m < s:
	print('-1 -1')
else:
	while m > 0:
		if s >= 9:
			largest = '9' + largest
			s = s - 9
		elif s > 0 and s < 9:
			largest = largest + str(s)
			s = 0
		elif s == 0:
			largest = largest + '0'
		m = m - 1
	while p > 0:
		if q > 9:
			smallest = smallest + '9'
			q = q - 9
		elif q > 1 and q <= 9 and (p != 1):
			smallest = str(q - 1) + smallest
			q = 1
		elif q > 1 and q <= 9 and (p == 1):
			smallest = str(q) + smallest
		elif q == 1 and p > 1:
			smallest = '0' + smallest
		elif q == 1 and p == 1:
			smallest = '1' + smallest
		p = p - 1
print(smallest + ' ' + largest)


from math import *
(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and m > 1):
	print(-1, -1)
elif s == 0:
	print(0, 0)
else:
	rem = ceil(s / 9)
	mn = 10 ** (m - 1)
	mns = s - 1
	counter = 0
	while mns > 0:
		if mns >= 9:
			mn += 9 * 10 ** counter
		else:
			mn += mns * 10 ** counter
		counter += 1
		mns -= 9
	mx = 0
	mxs = s
	counter = m - 1
	while mxs > 0:
		if mxs >= 9:
			mx += 9 * 10 ** counter
		else:
			mx += mxs * 10 ** counter
		mxs -= 9
		counter -= 1
	print(mn, mx)


(m, t) = map(int, input().split())
big = [0] * m
small = [0] * m
s = t
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	if s <= 9:
		big[0] = s
	else:
		i = 0
		while s > 9:
			big[i] = 9
			s = s - 9
			i = i + 1
		big[i] = s
	s = t
	small[0] = 1
	s = s - 1
	if s <= 9:
		small[m - 1] = s
		if m == 1:
			small[m - 1] = t
	else:
		i = m - 1
		while s > 9:
			small[i] = 9
			s = s - 9
			i = i - 1
		small[i] = s
		if i == 0:
			small[i] += 1
	big = list(map(str, big))
	small = list(map(str, small))
	print(''.join(small) + ' ' + ''.join(big))


(n, s) = map(int, input().split(' '))
c = []
d = []
f = 0
t = s
for i in range(n):
	if s > 9 * (n - i):
		f = 1
		break
	b = max(0, s - 9 * (n - i - 1))
	if i == 0 and i < n - 1:
		b = max(1, b)
	c.append(str(b))
	s -= b
	if t > 9:
		d.append('9')
		t -= 9
	else:
		d.append(str(t))
		t = 0
	if s < 0:
		f = 1
		break
if f == 0:
	print(''.join(c))
	print(''.join(d))
else:
	print(-1, -1)


(m, s) = [int(i) for i in input().split()]
a = m * [0]
a[0] = 1
sum = 1
temp = 0
while sum < s and s > 0 and (m * 9 >= s):
	if a[temp] < 9:
		a[temp] = a[temp] + 1
		sum = sum + 1
	else:
		temp += 1
for i in range(m):
	a[i] = str(a[i])
max = ''.join(a)
a = m * [0]
a[0] = 1
sum = 1
temp = m - 1
while sum < s and s > 0 and (m * 9 >= s):
	if a[temp] < 9:
		a[temp] = a[temp] + 1
		sum = sum + 1
	else:
		temp = temp - 1
for i in range(m):
	a[i] = str(a[i])
min = ''.join(a)
if s == 0 and m == 1:
	print(0, 0)
elif m * 9 < s or s <= 0:
	print(-1, -1)
else:
	print(min, max)


import math
s = input().split()
n = int(s[0])
total = int(s[1])
if total < 1 and n > 1 or total > 9 * n:
	print('-1 -1')
else:
	b = total
	for i in range(n - 1, -1, -1):
		j = max(0, b - 9 * i)
		if i == n - 1 and j == 0 and (b > 0):
			a = 1
			b -= 1
		elif i < n - 1 and j == 0:
			a = 0
		else:
			a = j
		print(a, end='')
		b -= j
	print(' ', end='')
	for i in range(n - 1, -1, -1):
		j = min(9, total)
		a = j
		print(a, end='')
		total -= j


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(m, s) = iia()
if m == 1 and s == 0:
	print(s, s)
elif s > 9 * m or s < 1:
	print(-1, -1)
else:
	small = ['0'] * m
	index = m - 1
	tot = s
	while index >= 0:
		if tot >= 9:
			small[index] = '9'
			tot -= 9
		else:
			small[index] = str(tot % 9)
			break
		index -= 1
	if small[0] == '0':
		small[0] = '1'
		for i in range(1, m):
			if int(small[i]) > 0:
				small[i] = str(int(small[i]) - 1)
				break
	big = ['0'] * m
	index = 0
	tot = s
	while index < m:
		if tot >= 9:
			big[index] = '9'
			tot -= 9
		else:
			big[index] = str(tot % 9)
			break
		index += 1
	print(''.join(small), ''.join(big))


(l, s) = map(int, input().split())
ma = ''
k = 0
for i in range(l):
	if k + 9 <= s:
		ma += '9'
	elif k < s:
		ma += str(s - k)
	else:
		ma += '0'
	k = sum([int(i) for i in ma])
mi = ''
k = 0
for i in range(l):
	if k + 10 <= s:
		mi += '9'
	elif k + 1 < s:
		mi += str(s - k - 1) if i != l - 1 else str(s - k)
	else:
		mi += '0' if i != l - 1 else '1'
	k = sum([int(i) for i in mi])
if l * 9 < s:
	print(-1, -1)
elif s != 0:
	print(mi[::-1], ma)
elif l == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


(n, m) = map(int, input().split())
if 1 <= m and m <= n * 9:
	f = m // 9
	v = m % 9
	s = ''
	c = ''
	if v > 0:
		h = n - f - 1
		s += str(9) * f + str(v) + str(0) * h
		if h > 0:
			c += str(1) + str(0) * (h - 1) + str(v - 1) + str(9) * f
		else:
			c += str(v) + str(9) * f
	else:
		h = n - f
		s += str(9) * f + str(0) * h
		if h > 0:
			c += str(1) + str(0) * (h - 1) + str(8) + str(9) * (f - 1)
		else:
			c += str(9) * f
	print(c, s)
elif n == 1 and m == 0:
	print(0, 0)
else:
	print(-1, -1)


(tamanho, aux) = map(int, input().split())
maiorSoma = aux
maiorNumero = ''
while len(maiorNumero) < tamanho:
	if maiorSoma > 9:
		maiorSoma -= 9
		maiorNumero += '9'
	elif maiorSoma != 0:
		maiorNumero += str(maiorSoma)
		maiorSoma = 0
	else:
		maiorNumero += '0'
if maiorNumero[-1] == '0':
	menorNumero = list(maiorNumero[::-1])
	for i in range(len(menorNumero)):
		if menorNumero[i] != '0':
			menorNumero[i] = str(int(menorNumero[i]) - 1)
			menorNumero[0] = '1'
			break
else:
	menorNumero = list(maiorNumero[::-1])
if (aux != 0 or (aux == 0 and tamanho == 1)) and maiorSoma == 0:
	print('%s %s' % (''.join(menorNumero), maiorNumero))
else:
	print('-1 -1')


(m, s) = [int(i) for i in input().split()]
if m * 9 >= s and s > 0:
	if m > s // 9 + 1:
		print('1', end='')
		k = m - ((s - 1) // 9 + 2)
		if k >= 0:
			for i in range(k):
				print('0', end='')
			print((s - 1) % 9, end='')
		else:
			pass
		for i in range(m - k - 2):
			print('9', end='')
		print(' ', end='')
		while m > 0:
			if s > 9:
				print('9', end='')
				s = s - 9
				m -= 1
			elif s > 0:
				print(s, end='')
				s = 0
				m -= 1
			else:
				print('0', end='')
				m -= 1
	elif m == s // 9 + 1:
		print(s % 9, end='')
		for i in range(s // 9):
			print('9', end='')
		print(' ', end='')
		for i in range(s // 9):
			print('9', end='')
		print(s % 9, end='')
	else:
		for i in range(s // 9):
			print('9', end='')
		print(' ', end='')
		for i in range(s // 9):
			print('9', end='')
elif m == 1 and s == 0:
	print('0 0')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
G = [0 for _ in range(m)]
S = [0 for _ in range(m)]
G[0] = min(s, 9)
S[0] = max(1, s - 9 * (m - 1))
if S[0] > 9 or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	for i in range(1, m):
		G[i] = G[i - 1] + min(9, max(0, s - G[i - 1]))
		S[i] = S[i - 1] + max(0, s - 9 * (m - 1 - i) - S[i - 1])
	s = str(S[0])
	g = str(G[0])
	for i in range(1, m):
		s += str(S[i] - S[i - 1])
		g += str(G[i] - G[i - 1])
	print(s + ' ' + g)


import sys
input = sys.stdin.readline
(m, s) = map(int, input().split())
if s == 0 or s > 9 * m:
	if s == 0 and m == 1:
		print(*[0, 0])
	else:
		print(*[-1, -1])
	exit()
res = m * [0]
ress = m * [0]
res[0] = 1
ress[0] = 1
l = 0
r = m - 1
for i in range(1, s):
	if res[l] == 9:
		l += 1
	res[l] += 1
	if ress[r] == 9:
		r -= 1
	ress[r] += 1
for i in ress:
	print(i, end='')
print(end=' ')
for i in res:
	print(i, end='')


(m, s) = list(map(int, input().split()))
t = s
if m == 1 and s == 0:
	print('0 0')
elif s <= sum([int(i) for i in '9' * m]) and s > 0:
	z = list(str(10 ** (m - 1)))
	k = -1
	for i in range(m):
		if s > 9:
			z[k] = '9'
			s -= 9
		elif z[k] != z[0]:
			if s - 1 > 0:
				z[k] = str(s - 1)
				s = 0
		elif z[k] == z[0] and s > 0:
			z[k] = str(s)
		k += -1
	g = int(''.join(z))
	if t <= 9:
		n = str(t) + '0' * (m - 1)
	else:
		r = list('9' * m)
		for i in range(m):
			if t >= 9:
				t -= 9
			elif t > 0:
				r[i] = str(t)
				t = 0
			else:
				r[i] = '0'
		n = ''.join(r)
	print('{} {}'.format(g, n))
else:
	print('-1 -1')


from sys import stdin, stdout

def get():
	a = list(map(int, stdin.readline().split()))
	if len(a) == 1:
		return a[0]
	else:
		return a

def pln(a=None, b=None, c=None, d=None, e=None, f=None):
	a = [a, b, c, d, e, f]
	out = ''
	for i in a:
		if i != None:
			out += str(i) + ' '
	stdout.write(str(out) + '\n')

def pls(a=None, b=None, c=None, d=None, e=None, f=None):
	a = [a, b, c, d, e, f]
	out = ''
	for i in a:
		if i != None:
			out += str(i) + ' '
	stdout.write(str(out))
(n, sum) = get()
if sum == 0:
	if n == 1:
		pln(0, 0)
	else:
		pln(-1, -1)
	exit()
mn = '1' + '0' * (n - 1)
mx = str(min(sum, 9)) + '0' * (n - 1)
s2 = sum
sum -= min(sum, 9)
for i in range(1, n):
	mx = mx[:i] + str(min(sum, 9)) + mx[i + 1:]
	sum -= min(sum, 9)
sum = s2 - 1
for i in range(n - 1, 0, -1):
	mn = mn[:i] + str(min(sum, 9)) + mn[i + 1:]
	sum -= min(sum, 9)
if sum > 0:
	i = 0
	mn = mn[:i] + str(min(sum + 1, 9)) + mn[i + 1:]

def sod(n):
	n = str(n)
	sum = 0
	for x in n:
		sum += int(x)
	return sum
if sod(mn) == sod(mx) and sod(mn) == s2:
	pln(mn, mx)
else:
	pln(-1, -1)


(m, s) = map(int, input().split())
y = m
t = ''
if m == 0:
	print(-1, -1)
elif s == 0 and m > 1:
	print(-1, -1)
elif s > m * 9:
	print(-1, -1)
else:
	t = ''
	while m:
		if s - 9 > 0:
			t += '9'
			s -= 9
			m -= 1
		elif s - 9 == 0:
			t += '9'
			m -= 1
			break
		else:
			t += str(s)
			m -= 1
			break
	if len(t) == y:
		mi = t[::-1]
		MA = t
	else:
		MA = t + '0' * (y - len(t))
		mi = '1'
		y = 0
		for k in range(1, len(MA)):
			if y == 0 and MA[::-1][k] != '0':
				mi += str(int(MA[::-1][k]) - 1)
				y += 1
			else:
				mi += MA[::-1][k]
	print(mi, MA)


(m, s) = input().split(' ')
m = int(m)
s = int(s)
m1 = m
s1 = s
l = []
sm = []

def large(m, s):
	if s >= 9 and 9 * m >= s:
		l.append(9)
		m = m - 1
		s = s - 9
		while m > 0:
			if s > 9:
				l.append(9)
				s = s - 9
				m = m - 1
			else:
				l.append(s)
				s = 0
				m = m - 1
	elif s > 0 and s < 9 and (m != 0):
		l.append(s)
		m = m - 1
		while m > 0:
			l.append(0)
			m = m - 1
	elif s == 0 and m > 1:
		print(-1, -1)
	elif s == 0 and m == 0:
		print(-1, -1)
	elif s == 0 and m == 1:
		print(0, 0)
	elif s > 0 and m == 0:
		print(-1, -1)
	elif 9 * m < s:
		print(-1, -1)
large(m, s)

def small(m, s):
	if s >= 9 and 9 * m >= s:
		while m > 0:
			if s > 9:
				sm.append(9)
				s = s - 9
				m = m - 1
			elif m != 1:
				sm.append(s - 1)
				m = m - 1
				s = 1
			else:
				sm.append(s)
				m = m - 1
				s = 0
		sm.sort()
		if sm[0] == 0:
			for i in range(0, m1):
				if sm[i] != 0:
					temp = sm[0]
					sm[0] = sm[i]
					sm[i] = temp
					break
	if s < 9 and 9 * m >= s:
		while m > 0:
			if m != 1:
				sm.append(s - 1)
				m = m - 1
				s = 1
			else:
				sm.append(s)
				m = m - 1
				s = 0
		sm.sort()
		if sm[0] == 0:
			for i in range(0, m1):
				if sm[i] != 0:
					temp = sm[0]
					sm[0] = sm[i]
					sm[i] = temp
					break
small(m1, s1)
if s1 != 0 and m1 > 0:
	s = ''
	for i in sm:
		s = s + str(i)
	print(s, end=' ')
if s1 != 0 and m1 > 0:
	s = ''
	for i in l:
		s = s + str(i)
	print(s)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s < 1 or s > 9 * m:
	print(-1, -1)
else:
	maxi = s // 9 * '9' + str(s % 9) + (m - s // 9 - 1) * '0'
	if len(maxi) > m:
		maxi = maxi[:-1]
	arr = [1] + [0] * (m - 1)
	i = 1
	j = m - 1
	while i < s:
		if arr[j] == 9:
			j -= 1
		arr[j] += 1
		i += 1
	mini = ''.join((str(x) for x in arr))
	print(mini, maxi)


(m, s) = map(int, input().split())
MIN = 10 ** (m - 1)
MAX = 0
for i in range(s - 1):
	MIN = MIN + +10 ** (i // 9)
for j in range(s):
	MAX = MAX + 10 ** (m - 1 - j // 9)
if m == 1 and s == 0:
	print(0, 0)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	print(MIN, MAX)


(m, s) = [int(x) for x in input().split(' ')]
if m > 1 and s == 0 or 9 * m < s:
	print(-1, -1)
	exit()
if m == 1 and s == 0:
	print(0, 0)
	exit()
t = s
big = 0
for i in range(m - 1, -1, -1):
	z = min(t, 9)
	big += 10 ** i * z
	t -= z
t = s
small = 0
for i in range(0, m):
	z = min(t, 9)
	small += 10 ** i * z
	t -= z
if small < 10 ** (m - 1):
	small -= 1 * 10 ** (len(str(small)) - 1)
	small = 10 ** (m - 1) + small
print(small, big)


(m, s) = map(int, input().strip().split())
mx = ''
mn = ''
if s > 9 * m or (s == 0 and m > 1):
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	q = int(s / 9)
	r = s % 9
	for i in range(q):
		mx += str(9)
	if r != 0:
		mx += str(r)
	while len(mx) < m:
		mx += '0'
	q = int((s - 1) / 9)
	r = (s - 1) % 9
	for i in range(q):
		mn += '9'
	if r != 0:
		if len(mn) < m - 1:
			mn = str(r) + mn
		else:
			mn = str(r + 1) + mn
	while len(mn) < m - 1:
		mn = '0' + mn
	if len(mn) == m - 1:
		mn = '1' + mn
	print(mn, mx)


(m, s) = list(map(int, input().split()))
if s == 0:
	if m != 1:
		print(-1, -1)
	else:
		print(0, 0)
elif s > 9 * m:
	print(-1, -1)
else:
	A = [0] * m
	a = [0] * m
	s1 = s
	for i in range(m):
		if s1 > 9:
			A[i] = 9
			s1 -= 9
		else:
			A[i] = s1
			s1 = 0
	s2 = s - 1
	a[0] = 1
	for i in range(m - 1, -1, -1):
		if s2 > 9:
			a[i] = 9
			s2 -= 9
		else:
			a[i] += s2
			s2 = 0
	for i in range(m):
		print(a[i], end='')
	print(' ', end='')
	for i in range(m):
		print(A[i], end='')


(m, s) = map(int, input().split())
if s < 1 < m or s > 9 * m:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	(q, r) = divmod(s, 9)
	p = '9' * q + (str(r) if r != 0 else '')
	p += '0' * (m - len(p))
	q = p[::-1]
	i = q.rindex('0') if '0' in q else -1
	q = list(map(int, q))
	q[i + 1] -= 1
	q[0] += 1
	print(''.join(map(str, q)), p)


(m, s) = map(lambda i: int(i), input().split())
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	a = [0] * m
	(a[0], remain, idx) = (1, s - 1, m - 1)
	while remain > 0:
		maxinc = 9 - (idx == 0)
		a[idx] += min(maxinc, remain)
		remain = remain - a[idx] + (idx == 0)
		idx -= 1
	b = [0] * m
	(b[0], remain, idx) = (1, s - 1, 0)
	while remain > 0:
		maxinc = 9 - (idx == 0)
		b[idx] += min(maxinc, remain)
		remain = remain - b[idx] + (idx == 0)
		idx += 1
	for i in a:
		print(i, end='')
	print(' ', end='')
	for i in b:
		print(i, end='')


(m, s) = map(int, input().split())

def high(num_digits, total):
	if num_digits * 9 < total or (total == 0 and num_digits > 1):
		return -1
	if total < 10 and total >= 0:
		lst = ['0'] * (num_digits - 1)
		return str(total) + ''.join(lst)
	else:
		return '9' + high(num_digits - 1, total - 9)

def low(num_digits, total):
	if num_digits * 9 < total or (total == 0 and num_digits > 1):
		return -1
	if total < 10 and total >= 0 and (num_digits > 1):
		lst = ['0'] * (num_digits - 2)
		return '1' + ''.join(lst) + str(total - 1)
	elif total < 10 and total >= 0 and (num_digits == 1):
		return str(total)
	else:
		return low(num_digits - 1, total - 9) + '9'
print(low(m, s), high(m, s))


import sys

def validate(i, m, s):
	if i == 0 and s == 0 and (m > 1):
		return False
	return 0 <= s <= m * 9

def solve(input_path=None):
	if input_path is None:
		f = sys.stdin
	else:
		f = open(input_path, 'r')
	(n, s) = map(int, f.readline().split())
	golds = list()
	if validate(0, n, s):
		z = s
		a = ''
		for i in range(n):
			for d in range(10):
				if (i > 0 or d > 0 or (n == 1 and d == 0)) and validate(i + 1, n - i - 1, z - d):
					z -= d
					a += f'{d}'
					break
		z = s
		b = ''
		for i in range(n):
			for d in range(9, -1, -1):
				if (i > 0 or d > 0 or (n == 1 and d == 0)) and validate(i + 1, n - i - 1, z - d):
					z -= d
					b += f'{d}'
					break
		golds.append(f'{a} {b}')
	else:
		golds.append('-1 -1')
	return golds

def main():
	for line in solve():
		print(line)
main()


def largest(m, s):
	if m == 0 and s == 0:
		return (True, '')
	if s >= 0 and s <= 9 * m:
		for digit in range(9, -1, -1):
			(flag, gen) = largest(m - 1, s - digit)
			if flag:
				return (True, str(digit) + gen)
		return (False, '')
	else:
		return (False, '')

def smallest(m, s, first):
	if m == 0 and s == 0:
		return (True, '')
	if s >= 0 and s <= 9 * m:
		if first:
			for digit in range(1, 10):
				(flag, gen) = smallest(m - 1, s - digit, False)
				if flag:
					return (True, str(digit) + gen)
		else:
			for digit in range(10):
				(flag, gen) = smallest(m - 1, s - digit, False)
				if flag:
					return (True, str(digit) + gen)
		return (False, '')
	else:
		return (False, '')

def f(m, s):
	if m == 1 and s == 0:
		return (0, 0)
	(mxflag, mx) = largest(m, s)
	(mnflag, mn) = smallest(m, s, True)
	if not (mnflag and mxflag):
		return (-1, -1)
	else:
		return (mn, mx)
(m, s) = map(int, input().split())
(mx, mn) = f(m, s)
print(mx, mn)


def check(l, s):
	return 0 <= s <= l * 9
(l, s) = map(int, input().split())
x = s
a = l
minn = ''
a = s
for i in range(l):
	for d in range(0, 10):
		if (i > 0 or d > 0 or (l == 1 and d == 0)) and check(l - i - 1, s - d):
			minn += str(d)
			s -= d
			break
maxx = ''
for i in range(l):
	for d in range(9, -1, -1):
		if check(l - i - 1, a - d):
			maxx += str(d)
			a -= d
			break
s = x
if s == 0 and l != 1 or minn == '' or maxx == '' or (minn.count('0') == len(minn) and (l != 1 and s != 0)):
	print(-1, -1)
else:
	print(minn, maxx)


L = 105
maxi = [0] * L
for x in range(1, L):
	maxi[x] = maxi[x - 1] + 9

def ok(su, dl):
	return su >= 0 and su <= maxi[dl]

def maly(su, dl, p):
	if dl == 1:
		return su
	for cyf in range(p, 10):
		if ok(su - cyf, dl - 1):
			return cyf * 10 ** (dl - 1) + maly(su - cyf, dl - 1, 0)

def duzy(su, dl, p):
	if dl == 1:
		return su
	for cyf in range(9, p - 1, -1):
		if ok(su - cyf, dl - 1):
			return cyf * 10 ** (dl - 1) + duzy(su - cyf, dl - 1, 0)
In = input().split()
m = int(In[0])
s = int(In[1])
if m > 1 and s < 1 or s > maxi[m]:
	print('-1 -1')
else:
	print(maly(s, m, 1), duzy(s, m, 1))


def small_below(m, s):
	if m == 1:
		return s
	else:
		num = '1'
		for i in range(m - 2):
			num += '0'
		num += str(s - 1)
		return num

def big_below(m, s):
	num = str(s)
	for i in range(m - 1):
		num += '0'
	return num

def small(m, s):
	num = ''
	g = 0
	nine = s // 9
	if m - nine == 1:
		num += str(s - 9 * nine)
	elif m - nine == 2:
		num += '1'
		num += str(s - 1 - 9 * nine)
	elif m - nine > 2:
		if s - nine * 9 == 1:
			num += '1'
			for i in range(m - (nine + 1)):
				num += '0'
		elif s - nine * 9 == 0:
			g = 1
			num += '1'
			for i in range(m - (nine + 1)):
				num += '0'
			num += '8'
		else:
			num += '1'
			for i in range(m - (nine + 2)):
				num += '0'
			num += str(s - 1 - nine * 9)
	if g == 0:
		for i in range(nine):
			num += '9'
	elif g == 1:
		for i in range(nine - 1):
			num += '9'
	return num

def big(m, s):
	num = ''
	nine = s // 9
	for i in range(nine):
		num += '9'
	if m - nine > 0:
		num += str(s - nine * 9)
		for i in range(m - (nine + 1)):
			num += '0'
	return num
(m, s) = map(int, input().split())
p = [-1, -1]
if s > 9 * m:
	print(-1, -1)
	exit(0)
if m == 1 and s != 0:
	print(s, s)
	exit(0)
if s == 0 and m == 1:
	print(0, 0)
	exit(0)
if m > 1 and s == 0:
	print(-1, -1)
	exit(0)
elif s >= 10:
	print(small(m, s), big(m, s))
else:
	print(small_below(m, s), big_below(m, s))


n = input()
m = []
for i in n.split():
	m.append(int(i))
a = m[0]
b = m[1]
c = m[1]
q = ''
p = ''
if b > a * 9:
	print(-1, -1)
elif b == 0 and a != 1:
	print(-1, -1)
elif b == 0 and m == 1:
	print(0, 0)
elif b <= a * 9:
	for k in range(a):
		if b >= 10:
			q = '9' + q
			b = b - 9
		elif b < 10:
			q = q + str(b)
			b = 0
		if c > 9:
			p = p + '9'
			c = c - 9
		elif a - k == 1:
			p = str(c) + p
		else:
			p = str(c - 1) + p
			c = 1
	print(p, q)


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif m * 9 < s:
	print('-1 -1')
else:
	a = [0 for i in range(m)]
	a[m - 1] = 1
	cnt = s - 1
	for i in range(m):
		while cnt > 0 and a[i] < 9:
			a[i] += 1
			cnt -= 1
	print(''.join(map(str, reversed(a))), end=' ')
	a = [0 for i in range(m)]
	a[0] = 1
	cnt = s - 1
	for i in range(m):
		while cnt > 0 and a[i] < 9:
			a[i] += 1
			cnt -= 1
	print(''.join(map(str, a)))


(n, m) = map(int, input().split())

def can_make(n, m):
	return m <= n * 9 and m >= 0

def make_min(n, m):
	ans = ''
	while n > 0:
		if ans or n == 1:
			start = 0
		else:
			start = 1
		made = False
		for i in range(start, 10):
			if can_make(n - 1, m - i):
				ans += str(i)
				n -= 1
				m -= i
				made = True
				break
		if not made:
			return -1
	return ans

def make_max(n, m):
	ans = ''
	while n > 0:
		if ans or n == 1:
			end = 0
		else:
			end = 1
		made = False
		for i in range(9, end - 1, -1):
			if can_make(n - 1, m - i):
				ans += str(i)
				n -= 1
				m -= i
				made = True
				break
		if not made:
			return -1
	return ans
print(make_min(n, m), make_max(n, m))


(m, s) = list(map(int, input().split()))
mini = []
maxi = []
for i in range(m):
	mini.append(0)
	maxi.append(9)
mini[0] = 1
min_sum = 1
max_sum = 9 * m
if m == 1 and s == 0:
	print('0 0')
elif s < min_sum or s > max_sum:
	print('-1 -1')
else:
	for i in range(m - 1, -1, -1):
		maxi[i] -= min(max_sum - s, 9)
		mini[i] += min(s - min_sum, 9)
		max_sum -= min(max_sum - s, 9)
		min_sum += min(s - min_sum, 9)
	ans1 = ans2 = ''
	for (i, j) in zip(maxi, mini):
		ans1 += str(i)
		ans2 += str(j)
	print(ans2, ans1)


def largest(n, s):
	ans = ''
	if s < 10:
		return str(s) + '0' * (n - 1)
	if s >= 10:
		ans = '9' * (s // 9)
	if s % 9 != 0:
		ans += str(s % 9)
	ans += '0' * (n - len(ans))
	return ans

def smallest(n, s):
	if s == 1:
		return '1' + '0' * (n - 1)
	ans = '1'
	rest = ''
	if s <= 10:
		return '1' + '0' * (n - 2) + str(s - 1)
	else:
		rest = '9' * (s // 9)
		if s % 9 != 0:
			rest = str(s % 9) + rest
		if len(rest) == n:
			return rest
		else:
			return '1' + '0' * (n - len(rest) - 1) + str(int(rest[0]) - 1) + rest[1:]
import sys
(n, s) = map(int, input().split())
ans = ''
if s > 9 * n or (s < 1 and n > 1):
	print(-1, -1)
	sys.exit(0)
elif s < 1 and n == 1:
	print(0, 0)
elif n == 1 and s < 10:
	print(s, s)
else:
	print(smallest(n, s), largest(n, s))


def ma(a, b):
	ans = ''
	for a in range(a):
		ans += str(min(9, b))
		b -= min(9, b)
	return ans
(a, b) = map(int, input().split())
if b == 0 or b > 9 * a:
	if b:
		print(-1, -1)
	elif a == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	q = ma(a, b)
	mi = q[::-1]
	if mi[0] != '0':
		print(mi, q)
	else:
		print('1' + ma(a - 1, b - 1)[::-1], q)


(m, s) = map(int, input().split())
n = s // 9
mod = s % 9
if mod == 0:
	digits = n
else:
	digits = n + 1
if s == 0 and m == 1:
	print(0, 0)
elif digits > m or s == 0:
	print(-1, -1)
elif mod == 0:
	temp = 0
	ma = ''
	ma += '9' * digits
	temp += digits
	ma += '0' * (m - digits)
	mi = ''
	if digits == m:
		mi = ma
	else:
		mi += '9' * (digits - 1)
		mi = '8' + mi
		mi = '1' + '0' * (m - digits - 1) + mi
	print(mi, ma)
else:
	temp = 0
	ma = '9' * n
	ma += str(mod)
	temp += digits
	ma += '0' * (m - digits)
	mi = '9' * n
	if digits == m:
		mi = str(mod) + mi
	else:
		mi = str(mod - 1) + mi
		mi = '1' + '0' * (m - digits - 1) + mi
	print(mi, ma)


(m, s) = map(int, input().split())
t = s
(a, b) = ([], [])
if s > 0 and s <= m * 9:
	for i in range(m):
		if s - 9 > 0:
			p = 9
			s = s - 9
		else:
			p = s
			s = 0
		a.append(str(p))
	max = ''.join(a)
	a.sort()
	for i in a:
		b.append(int(i))
	if b[0] == 0:
		b[0] = 1
		for i in range(1, len(b)):
			if b[i] != 0:
				b[i] -= 1
				break
	min = ''
	for i in b:
		min += str(i)
	print(int(min), int(max))
elif m == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


a = input()
aim = a.split()
m = int(aim[0])
s = int(aim[1])
q = s % 9
w = s // 9
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
elif w < m - 1:
	if q != 0:
		print('1', '0' * (m - w - 2), q - 1, '9' * w, ' ', '9' * w, q, '0' * (m - w - 1), sep='')
	else:
		print('1', '0' * (m - w - 1), '8', '9' * (w - 1), ' ', '9' * w, '0' * (m - w), sep='')
elif w == m - 1:
	print(q, '9' * w, ' ', '9' * w, q, sep='')
elif q == 0 and w == m:
	print('9' * m, ' ', '9' * m, sep='')
else:
	print('-1 -1')


(m, s) = [int(i) for i in input().split()]
k = s
maxium = 0
minium = 0
if s < 1 and m > 1 or s > m * 9:
	print(-1, -1)
else:
	for p in range(m - 1, -1, -1):
		q = max(0, k - 9 * p)
		if q == 0 and p == m - 1 and k:
			q = 1
		print(q, end='')
		k -= q
	print(' ', end='')
	k = s
	for p in range(m - 1, -1, -1):
		q = min(9, k)
		print(q, end='')
		k -= q


(m, s) = map(int, input().split())
if s < 1:
	(print(-(m > 1), -(m > 1)), exit())
if 9 * m < s:
	(print(-1, -1), exit())

def g(s):
	for i in range(m):
		v = min(9, s)
		yield str(v)
		s -= v
a = ''.join(g(s))
print(a[::-1] if a[-1] > '0' else '1' + ''.join(g(s - 1))[-2::-1], a)


(a, b) = map(int, input().split())
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lenth = 10
l2 = []
a1 = a
if a == 1 and b == 0:
	numm = '0'
	str1 = '0'
elif b <= 0 or 9 * a < b:
	numm = -1
	str1 = -1
else:
	numm = ''
	sum1 = 0
	while a > 0:
		lenth = 10
		while lenth > 0:
			if b - sum1 >= 9 and a > 1:
				shuzi = '9'
				numm += shuzi
				lenth = 0
				sum1 += int(shuzi)
			elif sum1 == b:
				shuzi = 0
				numm += str(shuzi)
				lenth = 0
			elif b - sum1 - int(l[lenth - 1]) >= 0:
				shuzi = str(l[lenth - 1])
				numm += shuzi
				lenth = 0
				sum1 += int(shuzi)
			lenth -= 1
		a -= 1
	pri = list(numm)
	l3 = []
	for i in pri:
		if i != '0':
			i = int(i)
			l3.append(i)
	str1 = ''
	if len(l3) == int(a1):
		l3.reverse()
		for i in l3:
			str1 += str(i)
	else:
		l3 = sorted(l3)
		if l3[0] == '1':
			pass
		else:
			shuzi = l3[0]
			l3.pop(0)
			shuzi = shuzi - 1
			l3.append(shuzi)
			l3 = sorted(l3)
		lenth = len(l3)
		n = 1
		str1 = '1'
		while a1 - len(l3) - 1 > 0:
			str1 += '0'
			a1 -= 1
		for i in l3:
			str1 += str(i)
print(str1, numm)


def can(n, s):
	return s >= 0 and s <= 9 * n
(n, s) = [int(x) for x in input().split()]
if n == 1 and s == 0:
	print('0 0')
else:
	small = ''
	sum = s
	for i in range(1, n + 1):
		for d in range(0, 10):
			if i == 1 and d == 0:
				continue
			if can(n - i, s - d):
				small += str(d)
				s -= d
				break
	large = ''
	s = sum
	for i in range(1, n + 1):
		for d in range(9, -1, -1):
			if i == 1 and d == 0:
				continue
			if can(n - i, s - d):
				large += str(d)
				s -= d
				break
	if small == '' or small[0] == '0':
		print('-1 -1')
	else:
		print(small, large)


(m, s) = map(int, input().split())
if s:
	x = [1]
	y = [9]
	for i in range(m - 1):
		x.append(0)
		y.append(9)
	sx = 1
	sy = m * 9
	for i in range(1, m, 1):
		if abs(sy - s) > 9 and sy - s:
			y[m - i] -= 9
			sy -= 9
		elif sy - s:
			y[m - i] -= abs(sy - s)
			sy = s
		if abs(s - sx) > 9 and s - sx:
			x[m - i] += 9
			sx += 9
		elif s - sx:
			x[m - i] += abs(s - sx)
			sx = s
	if abs(s - sy) > 8 and sy - s:
		y[0] -= 8
		sy -= 8
	elif sy - s:
		y[0] -= abs(s - sy)
		sy = s
	if abs(s - sx) > 8 and s - sx:
		x[0] += 8
		sx += 8
	elif s - sx:
		x[0] += abs(s - sx)
		sx = s
	(x, y) = (map(str, x), map(str, y))
	(x, y) = (''.join(x), ''.join(y))
	if s == sx:
		print(x, y)
	else:
		print('-1 -1')
elif m == 1:
	print('0 0')
else:
	print('-1 -1')


(l, d) = input().split()
d = int(d)
l = int(l)
total = 0
mini = 0
f = int(d)
if d > 0 and d <= l * 9:
	for i in range(l, 0, -1):
		if f - 9 > 0 and f - 9 <= l * 9:
			f = f - 9
			total += 9 * 10 ** (i - 1)
		else:
			total += f * 10 ** (i - 1)
			break
	if d >= (l - 1) * 9 + 1:
		mini = (d - (l - 1) * 9 + 1) * 10 ** (l - 1) - 1
	else:
		k = d - 1
		for i in range(l):
			if k - 9 > 0 and k - 9 <= l * 9:
				k = k - 9
				mini += 9 * 10 ** i
			else:
				mini += k * 10 ** i
				mini += 10 ** (l - 1)
				break
	print(mini, total)
elif l == 1 and d == 0:
	print('0 0')
else:
	print('-1 -1')


from sys import stdin
(m, s) = stdin.readline().split(' ')
m = int(m)
s = int(s)
if m == 1 and s / 10 == 0:
	print(s, s)
else:
	temp_s = s
	numa = 0
	numb = 10 ** (m - 1)
	bool = True
	if m != 0 and s != 0 and (s / 9 <= m):
		j = 1
		while j < m + 1:
			a = min(9, temp_s)
			numa = numa + a * 10 ** (m - j)
			temp_s = temp_s - a
			j += 1
		i = 1
		temp_s = s - 1
		while i < 10 ** (m - 1):
			a = min(9, temp_s)
			numb = numb + a * i
			temp_s = temp_s - a
			i = i * 10
		if temp_s > 0:
			numb += temp_s * 10 ** (m - 1)
	else:
		bool = False
	if bool:
		print(numb, numa)
	else:
		print(-1, -1)


(a, b) = [int(i) for i in input().split()]
import math
x = b // 9
y = b % 9
x1 = (b - 1) // 9
y1 = (b - 1) % 9
if b == 0:
	if a == 1:
		print('0 0')
	else:
		print('-1 -1')
elif math.ceil(b / 9) > a:
	out = '-1 -1'
	print(out)
else:
	fst = []
	scd = []
	k = 0
	for i in range(x):
		fst.append('9')
	if y == 0:
		for i in range(a - x):
			fst.append('0')
		out1 = ''.join(fst)
	else:
		fst.append(str(y))
		for i in range(a - x - 1):
			fst.append('0')
		out1 = ''.join(fst)
	if a == 1:
		out1 = str(b)
		out2 = str(b)
	elif a == math.ceil(b / 9):
		if y == 0:
			for i in range(x):
				scd.append('9')
			out2 = ''.join(scd)
		else:
			scd.append(str(y))
			for i in range(x):
				scd.append('9')
			out2 = ''.join(scd)
	else:
		scd.append('1')
		for i in range(a - x1 - 2):
			scd.append('0')
		scd.append(str(y1))
		for i in range(x1):
			scd.append('9')
		out2 = ''.join(scd)
	if b == 1:
		out2 = out1
	print(out2, out1)


n = [int(j) for j in input().split()]
if n[1] == 0 and n[0] == 1:
	print('0 0')
elif n[1] == 0 or n[1] > 9 * n[0]:
	print('-1 -1')
elif n[1] == 9 * n[0]:
	m = ''
	for k in range(n[0]):
		m = m + '9'
	print(m, m)
else:
	x = n[1] % 9
	y = int((n[1] - x) / 9)
	m = ''
	for k in range(y):
		m = m + '9'
	m = m + str(x)
	for k in range(n[0] - y - 1):
		m = m + '0'
	if n[1] > 9 * (n[0] - 1):
		t = n[1] % 9
		w = str(t)
		for k in range(n[0] - 1):
			w = w + '9'
	else:
		t = (n[1] - 1) % 9
		y = int((n[1] - 1 - t) / 9)
		w = '1'
		for k in range(n[0] - 2 - y):
			w = w + '0'
		w = w + str(t)
		for k in range(y):
			w = w + '9'
	print(w, m)


(m, s) = map(int, input().split())
if m > 1 and s == 0 or 9 * m < s:
	print(-1, -1)
elif s <= 9:
	if m >= 2:
		print('1' + '0' * (m - 2) + str(s - 1), str(s) + '0' * (m - 1))
	else:
		print(s, s)
else:
	k = s // 9
	if k == m:
		print('9' * k, '9' * k)
	else:
		l = s % 9
		n = m - k
		if n == 1:
			print(str(l) + '9' * k, '9' * k + str(l))
		elif n != 1 and l == 0:
			print('1' + '0' * (n - 1) + '8' + '9' * (k - 1), '9' * k + '0' * n)
		else:
			x = l - 1
			print('1' + '0' * (n - 2) + str(x) + '9' * k, '9' * k + str(l) + '0' * (n - 1))


L = input().split()
Len = int(L[0])
sum = int(L[1])
if sum == 0:
	if Len == 1:
		print('0 0')
	else:
		print('-1 -1')
elif sum > 9 * Len:
	print('-1 -1')
elif int(Len) == 1:
	print(str(sum), str(sum))
else:
	s = 0
	out = ''
	for i in range(Len):
		if 9 * (s + 1) < sum:
			s += 1
	left = sum - 9 * s
	for i in range(s):
		out += '9'
	out += str(left)
	a = Len - len(out)
	if a == 0:
		largest = out
	if a > 0:
		for i in range(a):
			out += '0'
		largest = out
	a = sum - 9 * (Len - 1)
	if a > 0:
		out = str(a)
		for i in range(Len - 1):
			out += '9'
			smallest = out
	else:
		n = 0
		for i in range(Len):
			if sum > 9 * (n + 1):
				n += 1
		b = sum - 9 * n
		if b == 1:
			zero = Len - n - 1
			out = '1'
			for i in range(zero):
				out += '0'
			for i in range(n):
				out += '9'
			smallest = out
		else:
			if Len - n - 1 == 0:
				out = str(b)
				for i in range(n):
					out += '9'
				smallest = out
			if Len - n - 1 == 1:
				out = '1' + str(b - 1)
				for i in range(n):
					out += '9'
				smallest = out
			if Len - n - 1 > 1:
				zero = Len - n - 2
				out = '1'
				for i in range(zero):
					out += '0'
				out += str(b - 1)
				for i in range(n):
					out += '9'
				smallest = out
	print(smallest, largest)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif m > 1 and s == 0:
	print('-1 -1')
elif s > 9 * m:
	print('-1 -1')
else:
	sum_min = s - 1
	k = 0
	Min_suff = []
	while sum_min > 0 or k < m:
		if sum_min > 9:
			Min_suff = [9] + Min_suff
			sum_min -= 9
		else:
			Min_suff = [sum_min] + Min_suff
			sum_min = 0
		k += 1
	Min_suff[0] += 1
	Min_suff = list(map(str, Min_suff))
	min_str = ''.join(Min_suff)
	sum_max = s
	k1 = 0
	Max_suff = []
	while sum_max > 0 or k1 < m:
		if sum_max > 9:
			Max_suff = Max_suff + [9]
			sum_max -= 9
		else:
			Max_suff = Max_suff + [sum_max]
			sum_max -= sum_max
		k1 += 1
	Max_suff = list(map(str, Max_suff))
	max_str = ''.join(Max_suff)
	print(min_str, max_str)


(m, s) = map(int, input().split())
(intermediate, ans, s1) = ('', 0, s)
if m == 1 and s == 0:
	print('0 0')
else:
	for i in range(m):
		for j in range(10):
			if not (i == 0 and j == 0) and (s - j >= 0 and s - j <= 9 * (m - i - 1)):
				intermediate += str(j)
				s -= j
				break
	ans = intermediate
	(intermediate, s) = ('', s1)
	for i in range(m):
		for j in range(9, -1, -1):
			if not (i == 0 and j == 0) and (s - j >= 0 and s - j <= 9 * (m - i - 1)):
				intermediate += str(j)
				s -= j
				break
	if ans == '' or ans[0] == '0':
		ans = -1
	if intermediate == '' or intermediate[0] == '0':
		intermediate = -1
	print(ans, intermediate)


(m, i_s) = map(int, input().split())
min_num = [1] + [0] * (m - 1)
s = i_s - 1
for i in range(len(min_num) - 1, -1, -1):
	val_inc = min(9 - min_num[i], s)
	min_num[i] += val_inc
	s -= val_inc
if s > 0 or sum(min_num) != i_s or any(map(lambda x: x < 0, min_num)):
	print(-1, -1)
else:
	max_num = [1] + [0] * (m - 1)
	s = i_s - 1
	for i in range(len(max_num)):
		val_inc = min(9 - max_num[i], s)
		max_num[i] += val_inc
		s -= val_inc
	print(*min_num, ' ', *max_num, sep='')


import sys
import math
input = sys.stdin.readline
(n, m) = map(int, input().split())
if n * 9 < m or (m == 0 and n > 1):
	print(-1, -1)
else:
	t = math.floor(m / 9)
	ma = '9' * t
	mi = []
	if t < n:
		ma += str(m % 9)
		ma += '0' * (n - t - 1)
		mi = list(ma)
		if t <= n - 1:
			if m % 9 == 0:
				t -= 1
			if m != 0:
				mi[t] = str(int(mi[t]) - 1)
				mi[-1] = str(int(mi[-1]) + 1)
		mi = ''.join(reversed(mi))
	else:
		mi = ma
	print(mi, ma)


(m, s) = list(map(int, input().split()))
if s == 0 and m == 1:
	print(0, 0)
elif s > 9 * m or s == 0:
	print(-1, -1)
else:
	large = []
	temp = 0
	while temp + 9 < s:
		temp += 9
		large.append('9')
	remain = s - temp
	large.append(str(remain))
	while len(large) != m:
		large.append('0')
	large_ans = ''.join(large)
	small = ['1']
	temp = 0
	while len(small) != m:
		small.append('0')
	index = m - 1
	while temp + 9 < s:
		small[index] = '9'
		index -= 1
		temp += 9
	if index != 0:
		remain = s - temp - 1
	else:
		remain = s - temp
	small[index] = str(remain)
	small_ans = ''.join(small)
	print(small_ans, large_ans)


(m, s) = map(int, input().split())
mn = ''
mx = ''
s1 = s2 = s
if s > 0 and s <= 9 * m:
	while m > 0:
		if s1 >= 9:
			mx += '9'
			s1 -= 9
		else:
			mx += str(s1)
			s1 = 0
		if (m - 1) * 9 >= s2 - 1 and mn == '':
			mn += '1'
			s2 -= 1
		elif (m - 1) * 9 >= s2:
			mn += '0'
		else:
			mn += str(s2 - 9 * (m - 1))
			s2 -= s2 - 9 * (m - 1)
		m -= 1
elif m == 1 and s == 0:
	mn = mx = '0'
else:
	mn = mx = '-1'
print(mn + ' ' + mx)


(m, s) = map(int, input().split())

def f(m, s):
	if s > m * 9:
		return '-1 -1'
	elif s == 0 and m == 1:
		return '0 0'
	elif s * m == 0:
		return '-1 -1'
	else:
		high = []
		while s > 0:
			r = min(s, 9)
			high.append(r)
			s -= r
		high += [0 for i in range(m - len(high))]
		low = high[::-1]
		if low[0] == 0:
			j = 1
			while low[j] == 0:
				j += 1
			low[j] -= 1
			low[0] += 1
		low = ''.join(map(str, low + [' '] + high))
		return low
print(f(m, s))


(m, s) = map(int, input().split())
if s > int(9 * m):
	res = '-1 -1'
elif s == 0:
	if m == 1:
		res = '0 0'
	else:
		res = '-1 -1'
else:
	small = [0] * m
	s_temp = s
	for i in range(m - 1, -1, -1):
		x = min(9, s)
		if x == 0:
			j = i + 1
			while not small[j]:
				j += 1
			small[j] -= 1
			s += 1
			x = 1
		small[i] = x
		s -= x
	small = list(map(str, small))
	small = ''.join(small)
	big = [0] * m
	i = 0
	s = s_temp
	while s:
		x = min(9, s)
		big[i] = x
		s -= x
		i += 1
	big = list(map(str, big))
	big = ''.join(big)
	res = ' '.join([small, big])
print(res)


a = [int(i) for i in input().split()]
l = a[0]
s = a[1]
if l == 1 and s < 10:
	x = str(s)
	y = str(s)
elif s == 0 or s > 9 * l:
	x = '-1'
	y = '-1'
else:
	m = int(s / 9)
	n = s % 9
	if l == m:
		x = m * '9'
		y = m * '9'
	if l == m + 1:
		if n == 0:
			x = '18' + (l - 2) * '9'
			y = (l - 1) * '9' + '0'
		else:
			y = m * '9' + str(n)
			x = str(n) + m * '9'
	if l > m + 1:
		if n == 0:
			x = '1' + (l - m - 1) * '0' + '8' + (m - 1) * '9'
			y = m * '9' + (l - m) * '0'
		elif m != 0 and l == m + 2:
			x = str(n) + (l - m - 1) * '0' + m * '9'
			y = m * '9' + str(n) + (l - m - 1) * '0'
		elif m != 0 and l > m + 2:
			x = '1' + (l - m - 2) * '0' + str(n - 1) + m * '9'
			y = m * '9' + str(n) + (l - m - 1) * '0'
		elif m == 0:
			x = '1' + (l - 2) * '0' + str(n - 1)
			y = m * '9' + str(n) + (l - m - 1) * '0'
print(x + ' ' + y)


(m, s) = map(int, input().split())
s1 = s2 = s
import math
nn = s1 // 9
mod = s1 % 9
if m > 1 and s == 0 or math.ceil(s / 9) > m:
	mi = -1
	ma = -1
else:
	min = []
	if mod != 0:
		if nn + 1 == m:
			min = [mod] + nn * [9]
		elif nn + 2 <= m:
			min = [1] + (m - nn - 2) * [0] + [mod - 1] + nn * [9]
		max = nn * [9] + [mod] + (m - nn - 1) * [0]
	elif mod == 0:
		max = nn * [9] + (m - nn) * [0]
		if nn == m:
			min = m * [9]
		elif nn < m and nn > 0:
			min = [1] + (m - nn - 1) * [0] + [8] + (nn - 1) * [9]
		elif nn == 0:
			min = [0]
	mi = ''.join((str(x) for x in min))
	ma = ''.join((str(x) for x in max))
print(mi, ma)


(length, sum_nums) = list(map(int, input().split()))
result = []
res_max = []
sum_nums2 = int(sum_nums)
i = -1
Done = False
if (length - 1) * 9 + 1 <= sum_nums and length * 9 >= sum_nums:
	for numeral in range(length - 1):
		result.append(9)
	a = list(result)
	result.append(sum_nums - sum(a))
	print(''.join(map(str, reversed(result))), ''.join(map(str, result)))
if sum_nums == 0:
	if length == 1:
		print('0 0')
	else:
		print('-1 -1')
	Done = True
if length * 9 < sum_nums:
	Done = True
	print('-1 -1')
if (length - 1) * 9 >= sum_nums and length * 9 >= sum_nums and (Done is False):
	while sum_nums2 >= 9:
		res_max.append(9)
		sum_nums2 -= 9
	res_max.append(sum_nums2)
	x = length - len(res_max)
	for num in range(x):
		res_max.append(0)
	for num in range(length):
		result.append(0)
	sum_nums -= 1
	result.insert(0, 1)
	while sum_nums >= 9:
		result.remove(0)
		result.insert(i, 9)
		i -= 1
		sum_nums -= 9
	result.remove(0)
	result.insert(i, sum_nums)
	del result[-1]
	print(''.join(map(str, result)), ''.join(map(str, res_max)))


def sumof(x):
	if x == 0:
		return 0
	return x % 10 + sumof(int(x / 10))

def po(a, b):
	ans = 1
	for x in range(b):
		ans = ans * a
	return ans
numbers = list(map(int, input().split()))
m = numbers[0]
n = numbers[1]
maxdig = int(n / 9)
maxi = -1
mini = -1
if n > 9 * m:
	print('-1 -1')
elif n == 0 and m > 1:
	print('-1 -1')
elif n == 0 and m == 1:
	print('0 0')
else:
	sumin = n
	sumax = n
	mini = ''
	maxi = ''
	for x in range(m):
		if sumin == 1:
			if x == m - 1:
				mini = '1' + mini
			else:
				mini = '0' + mini
		elif sumin <= 9:
			if x == m - 1:
				mini = str(sumin) + mini
			else:
				mini = str(sumin - 1) + mini
				sumin = 1
		else:
			mini = str(9) + mini
			sumin = sumin - 9
	for x in range(m):
		if sumax >= 9:
			maxi = maxi + '9'
			sumax = sumax - 9
		else:
			maxi = maxi + str(sumax)
			sumax = 0
	print(mini + ' ' + maxi)


line = input()
lines = line.split()
a = int(lines[0])
b = int(lines[1])
x = a
y = b
t = 0
s = 0
if b < 1 or b > 9 * a:
	if a == 1 and b == 0:
		print('0 0')
	else:
		print('-1 -1')
elif a > 1:
	if b <= 9 * a - 8:
		while y > 10:
			y -= 9
			t += 1
			x -= 1
		y -= 1
		print('1', end='')
		for i in range(x - 2):
			print('0', end='')
		print(y, end='')
		for i in range(t):
			print('9', end='')
		print(' ', end='')
		while b > 9:
			b -= 9
			s += 1
			a -= 1
		for i in range(s):
			print('9', end='')
		print(b, end='')
		for i in range(a - 1):
			print('0', end='')
	else:
		q = b + 9 - 9 * a
		print(q, end='')
		for i in range(a - 1):
			print('9', end='')
		print(' ', end='')
		for i in range(a - 1):
			print('9', end='')
		print(q)
else:
	print(b, b)


(a, b) = map(int, input().split())
sm = [0] * a
la = [0] * a
b1 = b
b2 = b
for i in range(a):
	la[i] = min(9, b1)
	b1 -= min(9, b1)
	sm[a - i - 1] = min(9, b2)
	b2 -= min(9, b2)
t = 1
if sm[0] == 0:
	t = 0
	for i in range(1, a):
		if sm[i] != 0:
			sm[i] -= 1
			sm[0] += 1
			t = 1
			break
if a == 1 and b == 0:
	print(0, 0)
elif b2 != 0 and b1 != 0:
	print(-1, -1)
elif t == 0:
	if b != 0:
		print(-1, *la, sep='')
	else:
		print(-1, -1)
elif b != 0:
	print(*sm, ' ', *la, sep='')


(n, s) = map(int, input().split())

def get_max(n, s):
	s_nine = s // 9
	s_r = s % 9
	if s_r != 0:
		s_n = '9' * s_nine + str(s_r)
	else:
		s_n = '9' * s_nine
	s_l = n - len(s_n)
	return s_n + '0' * s_l

def get_min(n, s):
	s_nine = (s - 1) // 9
	s_r = (s - 1) % 9
	s_n = '9' * s_nine + str(s_r)
	s_l = n - len(s_n)
	k = s_n + '0' * s_l
	k_r = k[::-1]
	p = str(int(k_r[0]) + 1) + k_r[1:]
	return p
if s > 9 * n:
	print('-1 -1')
elif s == 0 and n > 1:
	print('-1 -1')
elif s == 0 and n == 1:
	print('0 0')
else:
	print('{} {}'.format(get_min(n, s), get_max(n, s)))


(a, b) = map(int, input().split())
if a == 1 and b == 0:
	print(0, 0)
elif b == 0:
	print(-1, -1)
elif b > a * 9:
	print(-1, -1)
else:
	largest = ''
	c = b
	for i in range(a):
		if b >= 9:
			largest = largest + '9'
			b -= 9
		else:
			largest = largest + str(b)
			b = 0
	smallest = ''
	for i in range(a):
		if c > 9:
			smallest = '9' + smallest
			c -= 9
		elif i < a - 1:
			smallest = str(c - 1) + smallest
			c = 1
		else:
			smallest = str(c) + smallest
	print(smallest, largest)


import math
q = input().split()
m = int(q[0])
n = int(q[1])
if n > m * 9:
	print('-1 -1')
elif m > 1 and n == 0:
	print('-1 -1')
else:
	list1 = []
	list2 = []
	if n <= 9:
		if m > 1:
			for i in range(m - 2):
				list1.insert(i, 0)
			list1.insert(0, 1)
			list1.append(n - 1)
		else:
			list1.append(n)
		for i in range(m - 1):
			list2.insert(i, 0)
		list2.insert(0, n)
	else:
		a = int(math.floor(n / 9))
		b = n - 9 * a
		if b == 0:
			for i in range(a):
				list2.append(9)
			for i in range(m - a):
				list2.append(0)
		else:
			for i in range(a):
				list2.insert(i, 9)
			list2.insert(a, b)
			for i in range(m - a - 1):
				list2.append(0)
		if b == 0:
			if a < m:
				for i in range(m - a - 1):
					list1.append(0)
				list1.insert(0, 1)
				list1.append(8)
				for i in range(a - 1):
					list1.append(9)
			else:
				for i in range(m):
					list1.append(9)
		elif a + 1 < m:
			c = b - 1
			for i in range(m - a - 2):
				list1.append(0)
			list1.insert(0, 1)
			list1.append(b - 1)
			for i in range(a):
				list1.append(9)
		else:
			for i in range(m - 1):
				list1.append(9)
			list1.insert(0, b)
	list3 = [str(i) for i in list1]
	list4 = [str(i) for i in list2]
	z = ''.join(list3)
	x = ''.join(list4)
	print(z + ' ' + x)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif m > 1 and s == 0:
	print(-1, -1)
else:
	e = s // 9
	r = s % 9
	q = e
	if r > 0:
		q += 1
	if q > m:
		print(-1, -1)
		from sys import exit
		exit()
	(mi, ma) = ('', '')
	if r == 0:
		r = 9
		e -= 1
	for i in range(e):
		mi += '9'
		ma += '9'
	if m - e == 1:
		mi = str(r) + mi
		ma += str(r)
		print(mi, ma)
	else:
		ma += str(r)
		mi = str(r - 1) + mi
		for i in range(m - e - 2):
			mi = '0' + mi
			ma += '0'
		mi = '1' + mi
		ma += '0'
		print(mi, ma)


(m, s) = map(int, input().split())
MIN = m * [0]
MAX = m * [0]
MIN[0] = 1
for i in range(1, s):
	for j in range(1, m + 1):
		if MIN[-j] != 9:
			MIN[-j] += 1
			break
for i in range(s):
	for j in range(0, m):
		if MAX[j] != 9:
			MAX[j] += 1
			break
if (m, s) == (1, 0):
	print(0, 0)
	exit(0)
if sum(MIN) == s and sum(MAX) == s:
	for i in MIN:
		print(i, end='')
	print(' ', end='')
	for i in MAX:
		print(i, end='')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
else:
	ms = ''
	sm = s
	for i in range(m):
		a = 9
		while a >= 0:
			if a <= sm:
				ms = ms + str(a)
				sm = sm - a
				break
			else:
				a = a - 1
	if sm > 0:
		ms = '0'
	ls = ''
	sm = s - 1
	for i in range(m):
		b = 9
		if i == m - 1:
			sm = sm + 1
		while b >= 0:
			if b <= sm:
				ls = ls + str(b)
				sm = sm - b
				break
			else:
				b = b - 1
	if sm > 0:
		ls = '0'
	msi = int(ms)
	lsi = int(ls)
	if msi == 0 or lsi == 0:
		print('-1 -1')
	else:
		print(ls[::-1] + ' ' + ms)


(n, s) = map(int, input().split())
s2 = s
ans = [None] * n
if s > 9 * n:
	print('-1 -1')
elif s == 0 and n != 1:
	print('-1 -1')
else:
	s -= 1
	for i in range(n - 1, 0, -1):
		if s > 9:
			ans[i] = 9
			s -= 9
		else:
			ans[i] = s
			s = 0
	ans[0] = s + 1
	for i in ans:
		print(i, end='')
	print(' ', end='')
	for i in range(0, n, 1):
		if s2 >= 9:
			ans[i] = 9
			s2 -= 9
		else:
			ans[i] = s2
			s2 = 0
	for i in ans:
		print(i, end='')


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for __ in range(t):
	(n, s) = map(int, input().split())
	if s == 0:
		if n == 1:
			print(0, 0)
		else:
			print(-1, -1)
	elif s >= 1 and s <= 9 * n:
		mini = ''
		suma = 0
		for i in range(n):
			fr = 1
			if i != 0:
				fr = 0
			for j in range(fr, 10):
				if j + (n - i - 1) * 9 + suma >= s:
					mini += str(j)
					suma += j
					break
		maxi = ''
		suma = 0
		for i in range(n):
			fr = 0
			if i != 0:
				fr = -1
			for j in range(9, fr, -1):
				if j + suma <= s:
					maxi += str(j)
					suma += j
					break
		print(mini, maxi)
	else:
		print(-1, -1)


(n, s) = map(int, input().split())
if s == 0 and n == 1:
	print(0, 0)
elif s < 1 or s > 9 * n:
	print(-1, -1)
else:
	ans1 = 10 ** (n - 1)
	s1 = s - 1
	k = 1
	while s1 > 0:
		ans1 += min(s1, 9) * k
		s1 -= min(s1, 9)
		k *= 10
	ans2 = ''
	while s > 0:
		ans2 += str(min(9, s))
		s -= min(9, s)
	ans2 += '0' * (n - len(ans2))
	print(ans1, ans2)


(m, s) = map(int, input().split())
maximum = ''
minimum = ''
if s == 0:
	if m == 1:
		print('0 0\n')
	else:
		print('-1 -1\n')
	exit()
temp = '9' * (s // 9)
if s % 9:
	temp += f'{s % 9}'
if len(temp) > m:
	print('-1 -1\n')
	exit()
while len(temp) < m:
	temp += '0'
maximum = temp
temp = temp[::-1]
counter = 0
if temp[0] == '0':
	while temp[counter] == '0':
		counter += 1
	li = [int(x) for x in temp]
	li[0] += 1
	li[counter] -= 1
	for i in range(len(li)):
		minimum += str(li[i])
else:
	minimum = temp
print(f'{minimum} {maximum}')


(m, s) = input().split()
m = int(m)
s = int(s)
zx = -1
min = a = aa = ''
if s > 9 * m:
	print('-1 -1')
if s <= 0 and m != 1:
	print('-1 -1')
if m == 1 and s == 0:
	print('0 0')
elif s <= 9 * m and (s > 0 or m == 1):
	c = int(s / 9)
	for i in range(c):
		a += '9'
	max = a + str(s - 9 * c)
	while len(max) < m:
		max = max + '0'
	max = max[:m]
	for k in max:
		min = k + min
	if int(min[0]) == 0:
		for h in min:
			zx += 1
			if int(h) != 0:
				hh = str(int(h) - 1)
				break
		min = '1' + min[1:zx] + hh + min[zx + 1:]
	print(min, max)


(s, m) = map(int, input().split())
M = m
S = s
k = ''
max = 9 * s
min = 1
count = 0
dig = [9, 8, 7, 6, 5, 4, 3, 2, 1]
if min <= m <= max:
	if m >= dig[0]:
		l = dig[0]
	else:
		l = dig[9 - m]
	while m != 0:
		k += str(l)
		m -= l
		if m not in dig:
			l = 9
		else:
			l = dig[9 - m]
			m = l
	c = len(k)
	k += '0' * (s - c)
	if k[-1] != '0':
		print(k[::-1], k)
	else:
		ma = ''
		dig.reverse()
		l = 1
		while M != 0:
			ma += str(l)
			M -= l
			if M not in dig:
				l = 9
			else:
				l = dig[M - 1]
				M = l
		c = len(ma)
		ma += '0' * (s - c)
		ma = list(map(int, list(ma)))
		ma = ma[:1] + sorted(ma[1:])
		ma = list(map(str, list(ma)))
		ma = ''.join(ma)
		print(ma, k)
elif m == 0 and s == 1:
	print(0, 0)
else:
	print(-1, -1)


(M, S) = input().strip().split()
m = int(M)
s = int(S)
arr = [0] * m
arr[0] = s
e = m - 1
while e > 0:
	if arr[0] == 1 or arr[0] == 0:
		break
	if arr[0] > 9:
		arr[0] = arr[0] - 9
		arr[e] = arr[e] + 9
		e = e - 1
	else:
		arr[e] = arr[0] - 1
		arr[0] = 1
		e = e - 1
if s / m > 9 or (s == 0 and m != 1):
	print('-1 -1')
else:
	for i in range(0, m):
		print(arr[i], end='')
	print(' ', end=' ')
	maxar = [0] * m
	e = 0
	y = s
	while e < m and s > 0:
		x = min(9, s)
		s = s - x
		maxar[e] = x
		e = e + 1
	for i in maxar:
		print(i, end='')
	print()


def maximum(d, sum):
	if d > 1 and sum == 0:
		return -1
	if sum > d * 9:
		return -1
	i = 10
	m = 0
	while sum != 0:
		if sum >= 9:
			m = m * i + 9
			sum = sum - 9
			d = d - 1
		else:
			m = m * i + sum
			sum = 0
			d = d - 1
	for i in range(d):
		m = m * 10
	return m

def minimum(d, sum):
	if d > 1 and sum == 0:
		return -1
	if sum > d * 9:
		return -1
	m = 0
	i = 1
	sum = sum - 1
	while sum != 0:
		if sum <= 9:
			m = sum * i + m
			sum = 0
		else:
			m = 9 * i + m
			sum = sum - 9
			i = i * 10
	sum = sum + 1
	for i in range(d - 1):
		sum = sum * 10
	m = sum + m
	return m
(d, s) = [int(x) for x in input().split()]
print(minimum(d, s), end=' ')
print(maximum(d, s))


def possible(m, sum1):
	if sum1 >= 0 and sum1 <= 9 * m:
		return True
(m, s) = [int(k) for k in input().split()]
Found = True
sum1 = s
low = list()
for i in range(m):
	if Found:
		for d in range(10):
			if i == 0 and d == 0:
				d = 1
				if m == 1 and sum1 == 0:
					d = 0
			if possible(m - i - 1, sum1 - d):
				sum1 -= d
				low.append(d)
				break
			if d == 9:
				Found = False
				print('-1 -1')
				break
if Found:
	sum1 = s
	high = list()
	for i in range(m):
		for d in range(9, -1, -1):
			if possible(m - i - 1, sum1 - d):
				sum1 -= d
				high.append(d)
				break
	l = ''
	h = ''
	for i in range(m):
		l += str(low[i])
		h += str(high[i])
	print(l, h)


import math
(m, s) = [int(i) for i in input().split()]
if m > 1 and s == 0 or s > m * 9:
	print('-1 -1')
else:
	smallKit = []
	if s % 9 != 0:
		smallKit.append(str(s % 9))
	for i in range(s // 9):
		smallKit.append('9')
	a = smallKit[:]
	a.reverse()
	largeKit = a
	if s == 0:
		print('0 0')
	elif math.ceil(s / 9) < m:
		smallKit[0] = str(int(smallKit[0]) - 1)
		small = 10 ** (m - 1) + int(''.join(smallKit))
		large = int(''.join(largeKit)) * 10 ** (m - math.ceil(s / 9))
		print(str(small) + ' ' + str(large))
	else:
		print(str(int(''.join(smallKit))) + ' ' + str(int(''.join(largeKit))))


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print('0 0')
elif s == 1:
	print('1' + (m - 1) * '0', '1' + (m - 1) * '0')
elif s == 0 or s > m * 9:
	print('-1 -1')
else:
	s -= 1
	s1 = s
	minn = [1] + (m - 1) * [0]
	maxx = [1] + (m - 1) * [0]
	i = 0
	while s != 0:
		if i == 0:
			maxx[i] += min(8, s)
			s -= min(8, s)
		else:
			maxx[i] += min(9, s)
			s -= min(9, s)
		i += 1
	i = 0
	while s1 != 0:
		if m - i - 1 == 0:
			minn[m - i - 1] += min(8, s1)
			s1 -= min(8, s1)
		else:
			minn[m - i - 1] += min(9, s1)
			s1 -= min(9, s1)
		i += 1
	print(''.join(map(str, minn)), ''.join(map(str, maxx)))


def minum(s: int, l: int) -> str:
	if s == 0 and l == 1:
		return '0'
	if s == 0:
		return '-1'
	res = ''
	for i in range(l - 1):
		if s > 10:
			res = res + '9'
			s = s - 9
			continue
		if s > 1:
			res = res + str(s - 1)
			s = 1
			continue
		if s == 1:
			res = res + '0'
	if s > 9:
		return '-1'
	res = res + str(s)
	return res[::-1]

def manum(s: int, l: int) -> str:
	if s == 0 and l == 1:
		return '0'
	if s == 0:
		return '-1'
	res = ''
	for i in range(l):
		if s > 9:
			res = res + '9'
			s = s - 9
			continue
		if s > 0:
			res = res + str(s)
			s = 0
			continue
		if s == 0:
			res = res + '0'
	if s != 0:
		return '-1'
	res = res
	return res
(a, b) = map(int, input().split())
print(minum(b, a), manum(b, a))


def min1(d, s):
	if s == 0:
		if d == 1:
			return 0
		else:
			return -1
	if s > 9 * d:
		return -1
	ans = [0] * d
	s = s - 1
	for i in range(d - 1, 0, -1):
		if s > 9:
			ans[i] = 9
			s = s - 9
		else:
			ans[i] = s
			s = 0
	ans[0] = s + 1
	v = 0
	for i in ans:
		v = v * 10 + i
	return v

def max1(d, s):
	if s == 0:
		if d == 1:
			return 0
		else:
			return -1
	if s > 9 * d:
		return -1
	ans = [0] * d
	for i in range(0, d):
		if s > 9:
			ans[i] = 9
			s = s - 9
		else:
			ans[i] = s
			s = 0
	v = 0
	for i in ans:
		v = v * 10 + i
	return v
(d, s) = map(int, input().split())
print(min1(d, s), max1(d, s))


reader = input().split()
(s, m) = map(int, reader)
n = m - 1
s1 = s
if m == 0 and s == 1:
	print(0, 0)
elif m == 0 and s > 1:
	print(-1, -1)
elif m > s * 9:
	print(-1, -1)
else:
	result = ''
	while s1 - 1:
		s1 -= 1
		if n > 9:
			result = '9' + result
			n -= 9
		else:
			result = str(n) + result
			n = 0
	result = str(n + 1) + result
	print(result)
	while m:
		s -= 1
		if m > 9:
			print(9, end='')
			m -= 9
		else:
			print(m, end='')
			m = 0
	for _ in range(s):
		print(0, end='')


(m, s) = [int(x) for x in input().split()]
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
	exit(0)
elif m == 1:
	mi = ma = s
elif s % 9 == 0:
	if m == s // 9:
		mi = ma = '9' * m
	else:
		mi = '1' + '0' * max(0, m - s // 9 - 1) + '8' + '9' * (s // 9 - 1)
		ma = '9' * (s // 9) + '0' * max(0, m - s // 9)
elif s % 9 == 1:
	mi = '1' + '0' * max(0, m - s // 9 - 1) + '9' * (s // 9)
	ma = '9' * (s // 9) + '1' + '0' * max(0, m - s // 9 - 1)
elif m - s // 9 - 1 > 0:
	p = str(s % 9 - 1)
	q = str(s % 9)
	mi = '1' + '0' * max(0, m - s // 9 - 2) + p + '9' * (s // 9)
	ma = '9' * (s // 9) + q + '0' * max(0, m - s // 9 - 1)
else:
	t = str(s % 9)
	mi = t + '9' * (s // 9)
	ma = '9' * (s // 9) + t
print(mi, ma)


(m, s) = [int(x) for x in input().split()]

def func(m, s):
	if s == 0 and m == 1:
		print('0 0')
		return
	if s == 0 or s > m * 9:
		print('-1 -1')
		return
	a = [0] * m
	j = m - 1
	sumx = s
	while sumx > 0:
		if sumx > 9:
			sumx -= 9
			a[j] = 9
			j -= 1
		else:
			a[j] = sumx
			sumx = 0
			break
	if j != 0:
		a[j] -= 1
		a[0] = 1
	for i in a:
		print(i, end='')
	print(' ', end='')
	a = [0] * m
	sumx = s
	j = 0
	while sumx > 0:
		if sumx > 9:
			sumx -= 9
			a[j] = 9
			j += 1
		else:
			a[j] = sumx
			sumx = 0
			break
	for i in a:
		print(i, end='')
	print()
func(m, s)


(m, s) = map(int, input().split())
(a, b) = (0, 0)
if s > 9 * m or s < 1 != m:
	print(-1, -1)
else:
	for i in range(m):
		if m > s // 9 + 1:
			c = 1
			if (s - 1 - 9 * i) // 9 >= 1:
				b += 9 * 10 ** i
			elif s - 1 - 9 * i > 0:
				b += (s - 1 - 9 * i) * 10 ** i
		else:
			c = 0
			if (s - 9 * i) // 9 >= 1:
				b += 9 * 10 ** i
			else:
				b += (s - 9 * i) * 10 ** i
	print(b + 10 ** (m - 1) if c == 1 else b)
	for i in range(m):
		if i + 1 > m - s // 9:
			a += 9 * 10 ** i
		elif i + 1 == m - s // 9:
			a += s % 9 * 10 ** i
	print(a, end=' ')


def logic(l, s):
	if s > 0 and s <= l * 9:
		l1 = [0 for i in range(l)]
		l1[0] = 1
		s1 = s
		s -= 1
		i = l - 1
		while s:
			while s and l1[i] < 9:
				l1[i] += 1
				s -= 1
			i -= 1
		ans = ''
		for i in l1:
			ans += str(i)
		l1 = [0 for i in range(l)]
		i = 0
		s = s1
		while s:
			while s and l1[i] < 9:
				l1[i] += 1
				s -= 1
			i += 1
		ans1 = ''
		for i in l1:
			ans1 += str(i)
		return (int(ans), int(ans1))
	else:
		return (-1, -1)

def brute(l, s):

	def sod(n):
		s = 0
		for i in str(n):
			s += int(i)
		return s
	l1 = []
	for i in range(10 ** (l - 1), 10 ** l):
		if sod(i) == s:
			l1.append(i)
	try:
		return (min(l1), max(l1))
	except:
		return (-1, -1)
(l, s) = map(int, input().split())
if s == 0 and l == 1:
	print(0, 0)
else:
	print(*logic(l, s))


(m, s) = map(int, input().split())
D = [[-1] * (s + 1) for i in range(m + 1)]
D[1][0] = 0
for i in range(1, min(s + 1, 10)):
	D[1][i] = i
for i in range(2, m + 1):
	for j in range(1, s + 1):
		if j < 9 * i + 1:
			if D[i - 1][j] == -1:
				D[i][j] = D[i][j - 1] + 1
			else:
				D[i][j] = D[i - 1][j] * 10
k = D[-1][-1]
if k == 0:
	print('0 0')
elif k != -1:
	l = str(k)[-1::-1]
	p = '1'
	if l[0] == '0':
		for i in range(1, m):
			if l[i] != '0':
				p = p + str(int(l[i]) - 1)
				break
			else:
				p = p + l[i]
		p = p + l[i + 1:]
	else:
		p = l
	print(p, k)
else:
	print('-1 -1')


(m, s) = map(int, input().split())
if m == 1 and s < 10:
	print(s, s)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	a = (s - 1) // 9
	b = (s - 1) % 9
	c = sum((9 * 10 ** i for i in range(a))) + 10 ** (m - 1) + b * 10 ** min(a, m - 1)
	d = sum((9 * 10 ** i for i in range(m - s // 9, m))) + s % 9 * 10 ** max(m - s // 9 - 1, 0)
	print(c, d)


line = input().split()
n = int(line[0])
s = int(line[1])
list = []
b = 0
c = 0
if s > 9 * n:
	print(-1, -1)
elif s == 0 and n == 1:
	print(0, 0)
elif s == 0 and n != 1:
	print(-1, -1)
else:
	for i in range(n):
		if s >= 9:
			s -= 9
			list.append(9)
			b += 1
		elif s < 9 and s > 0:
			list.append(s)
			s = 0
			a = i
		else:
			list.append(0)
			c += 1
	max = ''
	for i in range(n):
		max += str(list[i])
	min = ''
	if b == n:
		for i in range(n):
			min += '9'
	elif b + c == n:
		min += '1'
		for i in range(c - 1):
			min += '0'
		min += '8'
		for i in range(b - 1):
			min += '9'
	elif list[a] == 1:
		min += str(list[a])
		for i in range(c):
			min += '0'
		for i in range(b):
			min += '9'
	elif c != 0:
		min += '1'
		for i in range(c - 1):
			min += '0'
		min += '%d' % (list[a] - 1)
		for i in range(b):
			min += '9'
	else:
		min += '%d' % list[a]
		for i in range(b):
			min += '9'
	print(int(min), int(max))


import math
[l, s] = [int(i) for i in input().split()]
if s > 9:
	t = math.floor(s / 9)
	j = l - 1
	suu = 0
	if t != 0:
		while t > 0:
			suu += 9 * 10 ** j
			t -= 1
			j -= 1
	t = math.floor(s / 9)
	nax = suu + int((s - 9 * t) * 10 ** (l - 1 - t))
	saa = 0
	for p in range(t):
		saa += 9 * 10 ** p
	if s % 9 == 0:
		if l == t:
			nin = saa
		else:
			nin = saa - 10 ** (t - 1) + 10 ** (l - 1)
	else:
		nin = (s - 9 * t - 1) * 10 ** t + 10 ** (l - 1) + saa
else:
	nax = s * 10 ** (l - 1)
	nin = 10 ** (l - 1) + s - 1
if s == 0 and l != 1:
	print('-1 -1')
elif s > 9 * l:
	print('-1 -1')
else:
	print('{} {}'.format(int(nin), int(nax)))


(m, s1) = map(int, input().split())
(ans1, ans2) = ([], [])
s2 = s1
for i in range(m):
	valid = range(s1 - 9 * (m - i - 1), s1 + 1)
	if i == 0 and m != 1:
		for x in range(1, 10):
			if x in valid:
				ans1.append(x)
				s1 -= x
				break
	else:
		for x in range(10):
			if x in valid:
				ans1.append(x)
				s1 -= x
				break
for i in range(m):
	valid = range(s2 - 9 * (m - i - 1), s2 + 1)
	if i == 0 and m != 1:
		for x in range(9, 0, -1):
			if x in valid:
				ans2.append(x)
				s2 -= x
				break
	else:
		for x in range(9, -1, -1):
			if x in valid:
				ans2.append(x)
				s2 -= x
				break
if len(ans1) == m:
	print(*ans1, sep='', end=' ')
else:
	print('-1 ', end='')
if len(ans2) == m:
	print(*ans2, sep='')
else:
	print('-1')


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(M, S) = map(int, input().split())
if S == 0:
	if M == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif S < 0:
	print(-1, -1)
elif M * 9 < S:
	print(-1, -1)
else:
	maxVal = 0
	s = S
	for i in range(M):
		maxVal *= 10
		v = min(9, s)
		maxVal += v
		s -= v
	if s != 0:
		maxVal = -1
	minVal = 0
	s = S
	for i in range(M):
		minVal *= 10
		v = max(0, s - (M - i - 1) * 9)
		if i == 0:
			v = max(v, 1)
		minVal += v
		s -= v
	if s != 0:
		minVal = -1
	print(minVal, maxVal)


(m, s) = map(int, input().split())

def max_(m, s):
	number_find = ''
	for j in range(m):
		i = 9
		if s == 0:
			number_find += str(0)
		while i > 0:
			if s // i > 0:
				number_find += str(i)
				break
			i -= 1
		s -= i
	return int(number_find)

def min_(m, s):
	number_find = ''
	s = s - 1
	for j in range(m):
		if j == m - 1:
			s = s + 1
		i = 9
		if s == 0:
			number_find += str(0)
		while i > 0:
			if s // i > 0:
				number_find += str(i)
				break
			i -= 1
		s -= i
	return int(number_find[::-1])
if m == 0 or s > 9 * m or (m > 1 and s == 0):
	print(-1, -1)
else:
	print(min_(m, s), max_(m, s))


(m, s) = map(int, input().split())
if s == 0 and m > 1 or m * 9 < s:
	print(-1, -1)
elif s == 0:
	print(s, s)
else:
	mn = [0] * m
	mn[0] = 1
	i = m - 1
	sp = s - 1
	while sp:
		if mn[i] == 9:
			i -= 1
		else:
			sp -= 1
			mn[i] += 1
	mx = [0] * m
	i = 0
	sp = s
	while sp:
		if mx[i] == 9:
			i += 1
		else:
			sp -= 1
			mx[i] += 1
	for i in mn:
		print(i, end='')
	print(' ', end='')
	for i in mx:
		print(i, end='')


line = input().split()
n = [int(i) for i in line]
if n[1] == 0 and n[0] != 1:
	print('-1 -1')
elif n[1] > 9 * n[0]:
	print('-1 -1')
elif n[1] == 9 * n[0]:
	print('9' * n[0] + ' ' + '9' * n[0])
elif int(n[1] / 9) + 1 == n[0]:
	b = '9' * (n[0] - 1) + str(n[1] % 9)
	a = str(n[1] % 9) + '9' * (n[0] - 1)
	print(a + ' ' + b)
elif n[1] == 1:
	print('1' + '0' * (n[0] - 1) + ' ' + '1' + '0' * (n[0] - 1))
elif int(n[1] / 9) + 1 < n[0]:
	x = n[1] % 9
	y = n[1] // 9
	b = '9' * y + str(x) + '0' * (n[0] - y - 1)
	u = n[1] - 1
	v = u // 9
	w = u % 9
	a = '1' + '0' * (n[0] - v - 2) + str(w) + '9' * v
	print(a + ' ' + b)
elif n[0] == 1 and n[1] < 10:
	print(str(n[1]) + ' ' + str(n[1]))


(n, s) = [int(x) for x in input().split()]
if s / 9 > n and s != 0 or s == 0:
	if n == 1 and s == 0:
		print(0, 0)
	else:
		print(-1, -1)
else:
	c = s // 9
	max = ''.join(['9' for i in range(c)])
	if c != n:
		max += str(s % 9)
	max += ''.join(['0' for i in range(n - c - 1)])
	min = list(max[::-1])
	for i in range(len(min)):
		if min[i] != '0':
			if i == 0:
				break
			min[0] = '1'
			min[i] = str(int(min[i]) - 1)
			break
	min = ''.join(min)
	print(min, max)


import sys
mod = 1000000007
from math import ceil
import time
from bisect import bisect_left
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
if k > 9 * n or (k == 0 and n != 1):
	print(-1, -1)
else:
	s = str()
	a = [0] * n
	t = 0
	i = 0
	while t != k:
		if t + 9 <= k:
			a[i] += 9
			t += 9
		else:
			a[i] += k - t
			t = k
		i += 1
	s = str()
	for i in a:
		s += str(i)
	if a[-1] == 0:
		i = n - 1
		while i > 0 and (not a[i]):
			i -= 1
		a[i] -= 1
		a[-1] += 1
	s2 = str()
	for i in a[::-1]:
		s2 += str(i)
	print(s2, s)


(Length, Sum) = [int(a) for a in input().split()]
if Sum == 0:
	if Length == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif Sum > Length * 9:
	print(-1, -1)
else:
	MaxList = [0] * Length
	MinList = [0] * Length
	Max = ''
	Min = ''
	SumMin = Sum - 1
	SumMax = Sum
	for digit in range(Length - 1, 0, -1):
		if SumMin > 9:
			MinList[digit] = 9
			SumMin -= 9
		else:
			MinList[digit] = SumMin
			SumMin = 0
	MinList[0] = SumMin + 1
	for digit in range(Length):
		if SumMax >= 9:
			MaxList[digit] = 9
			SumMax -= 9
		else:
			MaxList[digit] = SumMax
			SumMax = 0
	for x in range(Length):
		Min += str(MinList[x])
		Max += str(MaxList[x])
	print(Min, Max)


(m, s) = map(int, input().split())
min = [0] * m
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or m * 9 < s:
	print('-1 -1')
else:
	for i in range(s // 9):
		min[-i - 1] = 9
	if s % 9 != 0:
		min[-s // 9] = s % 9
	max = sorted(min, reverse=True)
	if min[0] == 0:
		for i in range(1, m):
			if min[i] != 0:
				min[0] = 1
				min[i] -= 1
				break
	print(''.join(map(str, min)))
	print(''.join(map(str, max)))


(m, s) = list(map(int, input().split()))
if m == 1 and s == 0:
	print(0, 0)
elif m == 1 and s == 1:
	print(1, 1)
elif m * 9 < s:
	print(-1, -1)
elif s == 0:
	print(-1, -1)
else:
	arr = [1] + [0] * (m - 1)
	arr2 = [0] * m
	k = arr[::-1]
	n = -1
	while sum(k) < s:
		n += 1
		k[n] = 9
	while sum(k) != s:
		if k[n] > 0:
			k[n] -= 1
		else:
			n -= 1
	min_numb = k[::-1]
	min_numb = ''.join(map(str, min_numb))
	arr2 = [0] * m
	z = -1
	while sum(arr2) < s:
		z += 1
		arr2[z] = 9
	if sum(arr2) > s:
		while sum(arr2) != s:
			arr2[z] -= 1
	max_numb = ''.join(map(str, arr2))
	print(min_numb, max_numb)


(a, b) = map(int, input().split(' '))
if [a, b] == [1, 0]:
	print('0 0')
elif 1 <= b <= 9 * a:
	haloe = []
	max9 = b // 9
	other = b % 9
	if other != 0:
		strx = '9' * max9 + str(other) + (a - max9 - 1) * '0'
	else:
		strx = '9' * max9 + (a - max9) * '0'
	haloe.append(strx)
	strx = strx[::-1]
	if strx[0] != '0':
		haloe.append(strx)
	else:
		bad = False
		newstr = '1'
		for i in range(1, len(strx)):
			if strx[i] != '0' and (not bad):
				newstr += str(int(strx[i]) - 1)
				bad = not bad
			else:
				newstr += strx[i]
		haloe.append(newstr)
	print(haloe[1] + ' ' + haloe[0])
else:
	print(-1, -1)


params = input().split(' ')
(dig, theSum) = [int(i) for i in params]

def findNonZero(s):
	for (idx, c) in enumerate(s):
		if c != '0':
			return idx
	else:
		return -1
if theSum > dig * 9:
	print('-1 -1')
elif dig == 1:
	print(str(theSum) + ' ' + str(theSum))
elif theSum == 0:
	print('-1 -1')
elif theSum < 10:
	smallest = '1' + '0' * (dig - 2) + str(theSum - 1)
	biggest = str(theSum) + '0' * (dig - 1)
	print(smallest + ' ' + biggest)
else:
	(q, r) = divmod(theSum, 9)
	if r == 0 and dig == q:
		biggest = '9' * q
		smallest = biggest
		print(smallest + ' ' + biggest)
	else:
		biggest = '9' * q + str(r) + '0' * (dig - q - 1)
		smallest = biggest[dig - 1::-1]
		if smallest[0] == '0':
			rIndex = findNonZero(smallest)
			smallest = '1' + smallest[1:]
			smallest = smallest[:rIndex] + str(int(smallest[rIndex]) - 1) + smallest[rIndex + 1:]
		print(smallest + ' ' + biggest)


(m, s) = list(map(int, input().split()))
if s == 0:
	print('-1 -1') if m > 1 else print('0 0')
	exit()
ma = [0] * m
mi = [0] * m
ss = s - 1
for i in range(m):
	if s <= 0:
		break
	ma[i] = 9 if s > 9 else s
	s -= ma[i]
if s > 0:
	print('-1 -1')
	exit()
mi[0] = 1
for i in range(m - 1, -1, -1):
	if ss <= 0:
		break
	mi[i] += 9 if ss > 9 else ss
	ss -= mi[i]
for i in range(m):
	print(mi[i], end='')
print(' ', end='')
for i in range(m):
	print(ma[i], end='')


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

def si():
	return input()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	(n, s) = mi()
	if n == 1 and s == 0:
		print('0 0')
		exit(0)
	if s > 9 * n or s < 1:
		print('-1 -1')
		exit(0)
	a = ['0'] * n
	s1 = s
	for i in range(n):
		x = min(9, s)
		s -= x
		a[i] = str(x)
	large = ''.join(a)
	a = ['0'] * n
	for i in range(n):
		if i == 0:
			x = max(1, s1 - 9 * (n - i - 1))
		else:
			x = max(0, s1 - 9 * (n - i - 1))
		a[i] = str(x)
		s1 -= x
	small = ''.join(a)
	print(small, large)
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
solve()


(m, s) = [int(i) for i in input().split()]
if (s == 0) & (m == 1):
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	pass
	(Max, Min) = ([], [])
	(smax, smin) = (s, s)
	for i in range(m):
		if i == 0:
			Min.append(str(smin - 9 * (m - i - 1)) if smin - 9 * (m - i - 1) > 0 else '1')
			smin = 9 * (m - i - 1) if smin - 9 * (m - i - 1) > 0 else smin - 1
		else:
			Min.append(str(smin - 9 * (m - i - 1)) if smin - 9 * (m - i - 1) > 0 else '0')
			smin = 9 * (m - i - 1) if smin - 9 * (m - i - 1) > 0 else smin
		if smax >= 9:
			Max.append('9')
			smax -= 9
		else:
			Max.append(str(smax))
			smax = 0
	print(''.join(Min), ''.join(Max))


(m, s) = input().split(' ')
m = int(m)
s = int(s)
if s == 0:
	if m == 1:
		print('0 0')
		exit()
a = [1]
while len(a) < m:
	a.append(0)
b = [9] * m
diff = sum(b) - s
if diff < 0:
	print('-1 -1')
	exit()
i = m - 1
while diff > 0:
	if diff >= 9:
		b[i] -= 9
		i -= 1
	else:
		b[i] -= diff
	diff = sum(b) - s
diff = s - sum(a)
if diff < 0:
	print('-1 -1')
	exit()
i = m - 1
while diff > 0:
	if diff <= 9:
		a[i] += diff
	else:
		a[i] = 9
		i -= 1
	diff = s - sum(a)
print(''.join(map(str, a)), ''.join(map(str, b)))


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right

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

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
(m, s) = ei()
mini = ''
maxi = ''
flag = True
if s == 0:
	if m == 1:
		print(0, 0)
		exit()
	else:
		print(-1, -1)
		exit()
for i in range(m):
	ans = min(9, s)
	maxi += str(ans)
	s -= ans
if s > 0:
	print(-1, -1)
else:
	mini = maxi[::-1]
	mini = [int(i) for i in mini]
	if mini[0] == 0:
		i = 0
		while mini[i] == 0:
			i += 1
		mini[i] -= 1
		mini[0] += 1
	print(''.join([str(i) for i in mini]), maxi)


test = lambda m, s: s >= 0 and s <= 9 * m
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
else:
	(m1, s1) = (m, s)
	(mn, mx) = ('', '')
	fo = True
	while test(m1, s1) and m1 > 0:
		i = 1 if m1 == m else 0
		f = True
		while i <= 9 and f:
			if test(m1 - 1, s1 - i):
				mn = mn + str(i)
				m1 -= 1
				s1 -= i
				f = False
			i += 1
		if f:
			fo = False
			break
	if not fo or mn == '':
		print(-1, -1)
	else:
		(m1, s1) = (m, s)
		while test(m1, s1) and m1 > 0:
			i = 9
			f = True
			while i >= (1 if m1 == m else 0) and f:
				if test(m1 - 1, s1 - i):
					mx = mx + str(i)
					m1 -= 1
					s1 -= i
					f = False
				i -= 1
		print(mn, mx)


(length, su) = map(int, input().split())
s = su
l = length
if s <= 0 and length != 1 or s > 9 * length:
	print(-1, -1)
else:
	lis = []
	while length != 0:
		if su <= 9:
			if su == 1 and length == 1:
				lis.append(1)
				su = 0
			elif su == 1:
				lis.append(0)
			elif length != 1:
				lis.append(su - 1)
				su = 1
			else:
				lis.append(su)
				su = 0
		else:
			lis.append(9)
			su -= 9
		length -= 1
	for i in range(len(lis)):
		lis[i] = str(lis[i])
	li = lis.copy()
	li.reverse()
	minans = ''.join(li)
	lis = []
	while True:
		if l == 0:
			break
		if s >= 9:
			lis.append(str(9))
			s -= 9
		else:
			lis.append(str(s))
			s = 0
		l -= 1
	maxans = ''.join(lis)
	print(minans, maxans)


(m, s) = map(int, input().split())

def maximum(m, s):
	a = s // 9
	if s - 9 * a > 0:
		max_num = '9' * a + str(s - 9 * a) + '0' * (m - a - 1)
	else:
		max_num = '9' * a + '0' * (m - a)
	return max_num
if m == 1 and s == 0:
	print('0', '0')
elif 1 <= s <= 9 * m:
	c = maximum(m, s)
	d = c[::-1]
	if d[0] != '0':
		print(d, c)
	else:
		e = maximum(m - 1, s - 1)
		print('1' + e[::-1], c)
else:
	print(-1, -1)


def check(m, s):
	return 0 <= s <= 9 * m

def solve():
	(m, s) = map(int, input().split())
	(ans_min, ans_max, remaining) = ([], [], s)
	for i in range(m):
		for j in range(10):
			if (i > 0 or j > 0 or (m == 1 and j == 0)) and check(m - i - 1, remaining - j):
				ans_min.append(j)
				remaining -= j
				break
	remaining = s
	for i in range(m):
		for j in range(9, -1, -1):
			if (i > 0 or j > 0 or (m == 1 and j == 0)) and check(m - i - 1, remaining - j):
				ans_max.append(j)
				remaining -= j
				break
	if sum(ans_min) == s and len(ans_min) == m:
		print(''.join((str(d) for d in ans_min)), end=' ')
		print(''.join((str(d) for d in ans_max)))
	else:
		print('-1 -1')
solve()


S = input().split()
m = int(S[0])
s = int(S[1])
M = []
if s == 0 and m > 1 or 9 * m < s:
	print(-1, -1)
else:
	for i in range(m):
		if s >= 9:
			num = 9
		else:
			num = s
		M.append(str(num))
		s = s - num
		m = m - 1
	max = ''.join(M)
	M.reverse()
	if int(M[0]) == 0:
		for i in range(1, len(M)):
			if int(M[i]) > 0:
				M[i] = str(int(M[i]) - 1)
				M[0] = str(1)
				break
	min = ''.join(M)
	print(min + ' ' + max)


(m, s) = [int(x) for x in input().split()]

def getMaxVal(m, s):
	if s == 0 and m == 1:
		return '0'
	if s == 0 or s > 9 * m:
		return '-1'
	q = int(s / 9)
	r = s - q * 9
	if r:
		return '9' * q + str(r) + '0' * (m - q - 1)
	else:
		return '9' * q + '0' * (m - q)

def getMinVal(m, s):
	if s == 0 and m == 1:
		return '0'
	if s == 0 or s > 9 * m:
		return '-1'
	q = int(s / 9)
	r = s - q * 9
	if r:
		if m == q + 1:
			return str(r) + '9' * q
		else:
			return '1' + '0' * (m - 2 - q) + str(r - 1) + '9' * q
	elif s == m * 9:
		return '9' * m
	else:
		return '1' + '0' * (m - q - 1) + '8' + '9' * (q - 1)
print(getMinVal(m, s) + ' ' + getMaxVal(m, s))


(n, m) = map(int, input().split())
small = [9] * n
big = [9] * n
tmp = 9 * n
i = 0
if m == 0 and n == 1:
	print('0 0')
	exit()
canB = False
while i < n:
	if tmp == m:
		canB = True
		break
	elif tmp > m:
		if tmp - m >= 9:
			big[i] -= 9
			tmp -= 9
		else:
			big[i] -= tmp - m
			tmp = m
			canB = True
			break
	i += 1
i = 0
tmp = 9 * n
canS = False
while i < n:
	if tmp == m:
		canS = True
		break
	if i == 0 and tmp - m >= 8:
		small[i] -= 8
		tmp -= 8
	elif tmp > m:
		if tmp - m >= 9:
			small[i] -= 9
			tmp -= 9
		else:
			small[i] -= tmp - m
			canS = True
			break
	i += 1
if tmp == m:
	canS = True
if canS:
	for i in small:
		print(i, end='')
else:
	print('-1', end='')
print(end=' ')
if canB:
	for i in range(n):
		print(big[n - i - 1], end='')
else:
	print('-1', end='')
print()


import math
(n, s) = input('').split()
(n, s) = (eval(n), eval(s))
l = []
l1 = []
if n * 9 < s or (s == 0 and n != 1):
	MIN = -1
	MAX = -1
elif s == 0 and n == 1:
	MIN = 0
	MAX = 0
else:
	t = s
	for i in range(n):
		l.append(0)
	for i in range(n - 1, -1, -1):
		if t > 9:
			l[i] = 9
			t -= 9
		else:
			l[i] = t
			t = 0
	if l[0] == 0:
		for i in range(n):
			if i == 0:
				l[i] += 1
			elif l[i] != 0:
				l[i] -= 1
				break
	no = 0
	for i in range(n):
		no = no * 10 + l[i]
	MIN = no
	t = s
	for i in range(n):
		l1.append(0)
	for i in range(0, n):
		if t > 9:
			l[i] = 9
			t -= 9
		else:
			l[i] = t
			t = 0
	no = 0
	for i in range(n):
		no = no * 10 + l[i]
	MAX = no
print(MIN, end=' ')
print(MAX)


(m, s) = [int(x) for x in input().split()]
if s == 0 and m > 1:
	print('-1 -1')
	exit(0)
max_lim = m * 9
if s > max_lim:
	print('-1 -1')
	exit(0)
smallest = ''
largest = ''
if m == 1:
	smallest = str(s)
	largest = smallest
elif s < 10:
	smallest = '1' + '0' * (m - 2) + str(s - 1)
	largest = str(s) + '0' * (m - 1)
else:
	q = s // 9
	r = s % 9
	if q + 1 == m:
		if r:
			smallest = str(r) + '9' * q
			largest = smallest[::-1]
		else:
			smallest = '18' + '9' * (q - 1)
			largest = '9' * q + '0'
	elif q == m:
		largest = smallest = '9' * q
	else:
		smallest = '1'
		if r:
			smallest += '0' * (m - q - 2) + str(r - 1) + '9' * q
		else:
			smallest += '0' * (m - q - 1) + '8' + '9' * (q - 1)
		largest = '9' * q + str(r) + '0' * (m - q - 1)
print('{0} {1}'.format(smallest, largest))


(l, s) = map(int, input().split())
m = l
if s == 0 and m > 1:
	print('-1 -1')
elif s > 9 * m:
	print('-1 -1')
elif m == 1:
	if s <= 9:
		print(str(s), str(s))
	else:
		print('-1 -1')
else:
	list1 = []
	while s >= 9 and m >= 0:
		list1.append('9')
		s -= 9
		m -= 1
	if m == 0:
		print(''.join(list1), ''.join(list1))
	else:
		list1.append(str(s))
		for k in range(m - 1):
			list1.append('0')
		list2 = []
		for k in range(len(list1)):
			if list1[k] == '9':
				list2.append(list1[k])
		if m == 1:
			list2.append(str(s))
		else:
			if s == 0:
				list2[-1] = '8'
				m = l - len(list2) + 1
			else:
				list2.append(str(s - 1))
			for k in range(m - 2):
				list2.append('0')
			list2.append('1')
		list2 = reversed(list2)
		print(''.join(list2), ''.join(list1))


t = tuple(map(int, input().split()))
a = t[1] // t[0]
if t[0] == 1 and t[1] == 0:
	print('0 0')
elif a > 9 or (a == 9 and t[1] % t[0] != 0) or t[1] == 0:
	print('-1 -1')
else:
	s = [a] * t[0]
	c = t[1] % t[0]
	for i in range(c):
		p = min(c, 9 - s[-1 - i])
		c -= p
		s[-1 - i] += p
	(i, j) = (0, t[0] - 1)
	while i < j:
		if min(9 - s[j], s[i] - int(i == 0)) == 9 - s[j]:
			s[i] -= 9 - s[j]
			s[j] = 9
			j -= 1
		else:
			s[j] += s[i] - int(i == 0)
			s[i] = int(i == 0)
			i += 1
	for i in s:
		print(i, end='')
	print(' ', end='')
	(i, j) = (0, t[0] - 1)
	while i < j:
		if min(9 - s[j], s[i]) == 9 - s[j]:
			s[i] -= 9 - s[j]
			s[j] = 9
			j -= 1
		else:
			s[j] += s[i]
			s[i] = 0
			i += 1
	for i in s[::-1]:
		print(i, end='')
	print('')


(m, s) = map(int, input().split())
a = s
if s == 0 and m != 1 or s / m > 9:
	print(-1, -1)
elif m == 1:
	if s > 9:
		print(-1, -1)
	else:
		(x, y) = (s, s)
		print(x, y)
else:
	mx = []
	for i in range(m):
		if s > 9:
			mx.append(9)
			s = s - 9
		elif s >= 1:
			mx.append(s)
			s = 0
		else:
			mx.append(0)
	if a == 1 and m == 2:
		mn = mx
	else:
		temp = mx[::-1]
		if temp == mx:
			mn = mx
		elif m == 2 and s > 9:
			mn = mx[::-1]
		else:
			mn = []
			for j in range(m):
				if a > 9:
					mn.append(9)
					a -= 9
				elif a > 0:
					mn.append(a)
					a = 0
				else:
					mn.append(0)
			if mn[j] == 0:
				ind = mn.index(0)
				mn[ind - 1] = mn[ind - 1] - 1
				mn[j] = 1
			mn = mn[::-1]
	(x, y) = ('', '')
	for l in mn:
		x = x + str(l)
	for m in mx:
		y = y + str(m)
	print(x, y)


(n, s) = map(int, input().split())
flag = False
smallest = []
longest = []
(i, p) = (n, s)
while i > 0:
	if p == 0:
		longest.append('0')
	else:
		longest.append(str(min(p, 9)))
		p -= int(longest[len(longest) - 1])
	i -= 1
if n > 1 and s == 0:
	flag = True
if p > 0:
	flag = True
(i, p) = (n, s)
p -= 1
while i > 1:
	smallest.append(str(min(p, 9)))
	p -= int(smallest[len(smallest) - 1])
	i -= 1
smallest.append(str(1 + p))
p -= int(smallest[len(smallest) - 1])
if p > 0:
	flag = True
if not flag:
	print(''.join(smallest[::-1]), ''.join(longest))
else:
	print(-1, -1)


def can(spots, sum):
	return 9 * spots >= sum

def biggest(m, s):
	if m == 1 and s <= 9:
		return str(s)
	if m == 1 and s >= 10:
		return 'x'
	if m > 1:
		mx = min(9, s)
		return str(mx) + biggest(m - 1, s - mx)
	return 'x'

def smallest(m, s):
	res = ''
	for i in range(m):
		for digit in range(0, 11):
			if (i > 0 or digit > 0 or (m == 1 and digit == 0)) and can(m - i - 1, s - digit):
				res += str(digit)
				s = s - digit
				break
	return res

def main():
	(m, s) = [int(i) for i in input().split()]
	big = biggest(m, s)
	if big[-1] == 'x' or (len(big) > 1 and big[0] == '0'):
		print('-1 -1')
	else:
		small = smallest(m, s)
		print(small + ' ' + big)
main()


l = list(map(int, input().split()))

def solve(m, s):
	(min_int, max_int) = (-1, -1)
	if s > 9 * m or (s < 1 and m > 1):
		print(min_int, max_int)
	else:
		result = 0
		tmp = s
		for _ in range(m):
			result = result * 10 + min(9, tmp)
			tmp -= min(9, tmp)
		max_int = result
		result = 0
		tmp = s
		for i in range(m, 0, -1):
			num = max(0, tmp - 9 * (i - 1))
			if i == m and num == 0 and (m > 1):
				num = 1
			result = result * 10 + num
			tmp -= num
		min_int = result
		print(min_int, max_int)
solve(l[0], l[1])


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(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
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def initialize(s, n):
	divisor = s // n
	ans = [divisor] * n
	remainder = s % n
	ans[-1] = ans[-1] + remainder
	diff = 0
	if ans[-1] > 9:
		diff = ans[-1] - 9
		ans[-1] = 9
	indx = -2
	while diff != 0:
		if ans[indx] == 9:
			indx -= 1
			continue
		temp = 9 - ans[indx]
		if temp >= diff:
			ans[indx] += diff
			diff = 0
		else:
			diff -= temp
			ans[indx] += temp
			indx -= 1
	return ans

def minimum(ans, n, flag):
	start = -n
	end = -1
	while end > -(n + 1) and ans[end] == 9:
		end -= 1
	if flag and end < -1:
		end += 1
	if ans[start] != 1:
		while start < end:
			if ans[end] == 0:
				continue
			diff = 9 - ans[end]
			if ans[start] > diff:
				ans[start] -= diff
				ans[end] += diff
			else:
				temp = ans[start] - 1
				ans[start] = 1
				ans[end] += temp
			if ans[end] == 9:
				end -= 1
			if ans[start] == 1:
				start += 1
				break
	else:
		start += 1
	while start < end:
		diff = 9 - ans[end]
		if ans[start] > diff:
			ans[start] -= diff
			ans[end] += diff
		else:
			temp = ans[start]
			ans[start] = 0
			ans[end] += temp
		if ans[start] == 0:
			start += 1
		if ans[end] == 9:
			end -= 1
	return ans

def maximum(ans, n):
	start = -n
	end = -1
	while start < 0 and ans[start] == 9:
		start += 1
	while start < end:
		if ans[end] == 0:
			end -= 1
			continue
		diff = 9 - ans[start]
		if ans[end] > diff:
			ans[start] += diff
			ans[end] -= diff
		else:
			ans[start] += ans[end]
			ans[end] = 0
		if ans[start] == 9:
			start += 1
		if ans[end] == 0:
			end -= 1
	return ans

def solve():
	flag = False
	(n, s) = num_input()
	if n == 1:
		if s < 10:
			print(s, s)
		else:
			print(-1, -1)
		return
	if s == 0:
		print(-1, -1)
		return
	if s > 9 * n:
		print(-1, -1)
		return
	if s == 1:
		print('1' + '0' * (n - 1), '1' + '0' * (n - 1))
		return
	if s < n:
		flag = True
	ans = initialize(s, n)
	ans = minimum(ans, n, flag)
	for i in ans:
		print(i, end='')
	print(end=' ')
	ans = maximum(ans, n)
	for i in ans:
		print(i, end='')
	print()
t = 1
for _ in range(t):
	solve()


(m, s) = map(int, input().strip().split())
if m == 1 and s == 0:
	print(0, 0)
	exit()
elif s < 1 or s > 9 * m:
	print(-1, -1)
	exit()

def sum_digits(n):
	return sum([int(x) for x in str(n)])

def increment_digits(number, how_many):
	number = sorted([int(x) for x in str(number)])
	for i in range(len(number)):
		if how_many >= 9:
			number[i] = 9
			how_many -= 9
		else:
			number[i] += how_many
			break
	number = sorted(number)
	if number[0] == 0:
		for (i, n) in enumerate(number):
			if n != 0:
				(number[i], number[0]) = (number[0], number[i])
				break
	return int(''.join([str(x) for x in number]))

def decrement_digits(number, how_many):
	number = sorted([int(x) for x in str(number)], reverse=True)
	for i in range(len(number)):
		if how_many >= 9:
			number[i] = 0
			how_many -= 9
		else:
			number[i] = 9 - how_many
			break
	number = sorted(number, reverse=True)
	if number[0] == 0:
		return -1
	return int(''.join([str(x) for x in number]))
smallest = int('1' + '0' * (m - 1))
largest = int('9' * m)
smallest = increment_digits(smallest, s - sum_digits(smallest))
largest = decrement_digits(largest, sum_digits(largest) - s)
print(smallest, largest)


from sys import stdin
(n, k) = map(int, stdin.readline().rstrip().split(' '))
minimum = 1
maximum = n * 9
if k == 0 and n == 1:
	print(0, 0)
elif k > maximum or k < minimum:
	print(-1, -1)
elif k == maximum:
	print('9' * n, '9' * n)
elif k == minimum:
	print('1' + '0' * (n - 1), '1' + '0' * (n - 1))
else:
	x = k // 9
	xtr = k % 9
	if xtr:
		r = '9' * x
	else:
		r = '9' * (x - 1) + '8'
	left = n - x
	if left >= 1 and xtr:
		if left > 1:
			r += str(xtr - 1)
		else:
			r += str(xtr)
		left -= 1
	if left > 1:
		r += '0' * (left - 1)
	if left:
		r += '1'
	print(r[::-1], end=' ')
	r2 = '9' * x + str(xtr)
	if n - x - 1:
		r2 += '0' * (n - x - 1)
	print(r2)


(m, s) = map(int, input().split())
l = [str(s)]
p = int(''.join(l))
minn = [0] * m
maxn = [0] * m
if m > 1 and s == 0:
	print(-1, -1)
elif 9 * m < s:
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	for k in range(1, 10):
		if 9 * (m - 1) >= s - k:
			minn[0] = k
			s = s - k
			break
	for i in range(1, m):
		for j in range(10):
			if 9 * (m - i - 1) >= s - j:
				minn[i] = j
				s = s - j
				break
	for t in range(m):
		minn[t] = str(minn[t])
	for q in range(9, 0, -1):
		if q <= p:
			maxn[0] = q
			p = p - q
			break
	for r in range(1, m):
		for y in range(9, -1, -1):
			if y <= p:
				maxn[r] = y
				p = p - y
				break
	for z in range(m):
		maxn[z] = str(maxn[z])
	print(''.join(minn), ''.join(maxn))


num = [int(i) for i in input().split()]
maxi = []
if num[0] != 1 and num[1] == 0 or num[1] > 9 * num[0]:
	print('-1 -1')
else:
	for j in range(num[0]):
		maxi.append(min(9, num[1]))
		num[1] -= min(9, num[1])
	mini = maxi[::-1]
	if mini[0] == 0 and num[0] != 1:
		for k in range(0, num[0]):
			if mini[k] != 0:
				mini[k] -= 1
				break
		mini[0] = 1
	for a in range(num[0]):
		print(mini[a], end='')
	print(' ', end='')
	for b in range(num[0]):
		print(maxi[b], end='')


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
res = ['Yes', 'No']
test_case = 1
while test_case:
	test_case -= 1
	(n, s) = mi()
	if n == 1 and s == 0:
		print(0, 0)
		exit()
	if not s or s > n * 9:
		print(-1, -1)
		exit()
	x = [1] + [0] * (n - 1)
	y = [9] * n
	(s1, i) = (1, n - 1)
	while s1 < s:
		x[i] += 1
		s1 += 1
		if x[i] == 9:
			i -= 1
	(s1, i) = (n * 9, n - 1)
	while s1 > s:
		y[i] -= 1
		s1 -= 1
		if y[i] == 0:
			i -= 1
	print(*x, sep='', end=' ')
	print(*y, sep='')


import math
(m, s) = map(int, input().split())
a = 1
(x, y) = (-1, -1)
if m == 1:
	ansmin = [0]
	ansmax = [0]
else:
	ansmin = [1]
	ansmax = [1]
	for _ in range(m - 1):
		ansmax.append(0)
		ansmin.append(0)
b = 1
c = 9 * m
if s < 1 and m > 1 or s > c:
	print('-1 -1')
else:
	i = 0
	while i < m:
		if sum(ansmax[:i + 1]) == s:
			break
		ansmax[i] += 1
		if ansmax[i] == 9:
			i += 1
	i = m - 1
	while i >= 0:
		if sum(ansmin) == s:
			break
		ansmin[i] += 1
		if ansmin[i] == 9:
			i -= 1
	x = ''.join((str(z) for z in ansmin))
	y = ''.join((str(z) for z in ansmax))
	print(x + ' ' + y)


(m, s) = [int(x) for x in input().split(' ')]
if s < 1 and m > 1 or s > 9 * m:
	print('-1 -1')
else:
	maxl = [9 for i in range(m)]
	smxl = 9 * m
	diff = smxl - s
	i = -1
	while diff != 0:
		sub = min(diff, 9)
		maxl[i] -= sub
		diff -= sub
		i -= 1
	minl = [1] + [0 for i in range(m - 1)]
	diff = s - 1
	i = -1
	while diff != 0:
		add = min(9, diff)
		diff -= add
		minl[i] += add
		i -= 1
	print(*minl, ' ', *maxl, sep='')


import sys
s = list(map(int, input().split()))
n = s[0]
m = s[1]
if (n == 1) & (m == 0):
	print('0 0')
	sys.exit()
if (m == 0) | (m > 9 * n):
	print('-1 -1')
	sys.exit()
r = m - 1
d = 0
st1 = ''
d0 = 0
while d < n:
	d = d + 1
	d0 = min(r, 9)
	r = r - d0
	if d < n:
		st1 = str(d0) + st1
	else:
		st1 = str(d0 + 1) + st1
r = m
d = 0
st2 = ''
d0 = 0
while d < n:
	d = d + 1
	d0 = min(r, 9)
	r = r - d0
	if d < n:
		st2 = st2 + str(d0)
	else:
		st2 = st2 + str(d0)
print(st1 + ' ' + st2)


(m, s) = map(int, input().split())
if m > 1 and s == 0 or s > 9 * m:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
else:
	s -= 1
	nines = s // 9
	remain = s % 9
	if m > nines + 1:
		ans1 = '1' + (m - nines - 2) * '0' + str(remain) + nines * '9'
	else:
		ans1 = str(remain + 1) + nines * '9'
	ans2 = nines * '9' + str(remain + 1) + (m - nines - 1) * '0'
	print(ans1 + ' ' + ans2)


from collections import deque

def find_min(m, s):
	pr = print
	le = len
	deq = deque
	minimal = deq()
	deqapp = minimal.appendleft
	while s > 9:
		deqapp('9')
		s -= 9
	deqapp(f'{s - 1}')
	while le(minimal) < m:
		deqapp('0')
	minimal[0] = f'{int(minimal[0]) + 1}'
	represented = ''.join(minimal)
	if le(represented) > m:
		pr('-1', end=' ')
	else:
		pr(represented, end=' ')

def find_max(m, s):
	pr = print
	le = len
	deq = deque
	if not s and m > 1:
		pr('-1', end='')
	else:
		maximal = deq()
		deqapp = maximal.append
		while s > 9:
			deqapp('9')
			s -= 9
		deqapp(f'{s}')
		while le(maximal) < m:
			deqapp('0')
		if le(maximal) > m:
			pr('-1', end='')
		else:
			pr(''.join(maximal), end='')
(m, s) = map(int, input().split())
find_min(m, s)
find_max(m, s)


(n, s) = map(int, input().split())
a = []
flag = 0
chck = 0
for i in range(n):
	chck += 9
if s == 0:
	if n == 1:
		print(0, 0)
		flag = 1
	else:
		flag = 1
		print(-1, -1)
if chck < s and flag == 0:
	print(-1, -1)
	flag = 1
for i in range(n):
	if len(str(s)) > 1:
		z = 9
	else:
		z = min(9, s)
	a.append(z)
	s = s - z
a1 = ''
b1 = ''
for i in range(n):
	a1 += str(a[i])
b1 = ''
b = a[::-1]
if b[0] == 0:
	b[0] = 1
	for i in range(1, n):
		if b[i] > 0:
			b[i] -= 1
			break
for i in range(n):
	b1 += str(b[i])
if flag == 0:
	print(b1, a1)


ms = input().split()
m = int(ms[0])
s = int(ms[1])
if m * 9 < s or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0:
	print('0 0')
else:
	min9 = (s - 1) // 9
	minx = s - 1 - min9 * 9
	max9 = s // 9
	maxx = s - max9 * 9
	if min9 + 2 <= m:
		minNum = '1' + '0' * (m - 2 - min9) + str(minx) + '9' * min9
	else:
		minNum = str(minx + 1) + '9' * min9
	if max9 + 1 <= m:
		maxNum = '9' * max9 + str(maxx) + '0' * (m - 1 - max9)
	else:
		maxNum = '9' * max9
	print(minNum, maxNum)


(m, s) = map(int, input().split())
a = 0
ch = s
ans1 = 0
ans2 = 0
fl = 0
fl2 = 0
if s == 0 and m != 1 or 9 * m < s:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	while a < m:
		if ch >= 9:
			ch -= 9
			ans1 = ans1 * 10 + 9
		else:
			ans1 = ans1 * 10 + ch
			ch = 0
		if ch == 0:
			fl = 1
		a += 1
	a = 0
	ch = s
	p = 1
	while a < m:
		if ch > 9:
			ch -= 9
			ans2 = ans2 + 9 * p
		else:
			if ch == 0:
				break
			if a == m - 1:
				ans2 = ans2 + ch * p
				ch = 0
			else:
				ans2 = ans2 + (ch - 1) * p
				ch = 1
		if ch == 0:
			fl2 = 1
		a += 1
		p *= 10
	if fl and fl2:
		print(ans2, ans1)
	else:
		print(-1, -1)


(m, s) = [int(x) for x in input().split()]

def solvemin(arr, index, currsum):
	if index == 0:
		for i in reversed(range(1, 10)):
			if currsum + i - 1 == s:
				arr[index] = i
				return True
		else:
			return False
	for i in reversed(range(1, 10)):
		if currsum + i == s:
			arr[index] = i
			return True
		if currsum + i < s:
			arr[index] = i
			if solvemin(arr, index - 1, currsum + i) == True:
				return True
			else:
				arr[index] = 0
	else:
		return False

def solvemax(arr, index, currsum):
	if index == m - 1:
		for i in reversed(range(1, 10)):
			if currsum + i == s:
				arr[index] = i
				return True
		else:
			return False
	for i in reversed(range(1, 10)):
		if currsum + i == s:
			arr[index] = i
			return True
		if currsum + i < s:
			arr[index] = i
			if solvemax(arr, index + 1, currsum + i) == True:
				return True
			else:
				arr[index] = 0
	else:
		return False
arr1 = [0] * m
arr1[0] = 1
arr2 = [0] * m
if s > 0 and s <= 9 * m:
	solvemin(arr1, m - 1, 1)
	ans1 = arr1
	ans2 = arr1
	s1 = ''
	s2 = ''
	solvemax(arr2, 0, 0)
	ans2 = arr2
	for item in ans1:
		s1 += str(item)
	for item in ans2:
		s2 += str(item)
	print(s1, s2)
elif s == 0 and m == 1:
	print(0, 0)
else:
	print(-1, -1)


def genmn():
	co9 = s // 9
	prefix = s % 9
	if prefix == 0:
		prefix = 9
		co9 -= 1
	if m == co9 + 1:
		return str(prefix) + '9' * co9
	prefix -= 1
	return '1' + '0' * (m - co9 - 2) + str(prefix) + '9' * co9

def genmx():
	co9 = s // 9
	appendix = s % 9
	if m == co9:
		return '9' * co9
	return '9' * co9 + str(appendix) + '0' * (m - co9 - 1)
(m, s) = list(map(int, input().split()))
if s <= 0 or s > m * 9:
	if s == 0 and m == 1:
		print('0 0')
		exit(0)
	print('-1 -1')
else:
	print('%s %s' % (genmn(), genmx()))


(m, s) = list(map(int, input().split()))
if m * 9 < s or m == 0 or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0:
	print('0 0')
else:
	_min = 10 ** (m - 1)
	_max = min(s, 9) * 10 ** (m - 1)
	_min = [int(x) for x in str(_min)]
	_max = [int(x) for x in str(_max)]
	_s = s - 1
	for i in range(m - 1, -1, -1):
		for j in range(9, 0, -1):
			if _s - j >= 0:
				if i == 0:
					_min[i] += j
				else:
					_min[i] = j
				_s -= j
				break
		if _s == 0:
			break
	_s = s - min(s, 9)
	for i in range(1, m, +1):
		for j in range(9, 0, -1):
			if _s - j >= 0:
				_max[i] = j
				_s -= j
				break
		if _s == 0:
			break
	_min = map(str, _min)
	_max = map(str, _max)
	print(''.join(_min) + '  ' + ''.join(_max))


(m, s) = map(int, input().split())

def max_recur(m, s, a):
	if m == 0:
		return a
	if not a and s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if 9 * m < s:
		return -1
	digit = min(9, s)
	a += str(digit)
	return max_recur(m - 1, s - digit, a)

def min_recur(m, s, a):
	if m == 0:
		return a
	if not a and s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if 9 * m < s:
		return -1
	if not a:
		digit = max(1, s - (m - 1) * 9)
	else:
		digit = max(0, s - (m - 1) * 9)
	a += str(digit)
	return min_recur(m - 1, s - digit, a)
mx = max_recur(m, s, '')
mn = min_recur(m, s, '')
print(mn, mx)


(m, s) = map(int, input().split())
if m > 1 and s == 0 or s > 9 * m or (m == 1 and s > 9):
	print(-1, -1)
elif s == 9 * m:
	print('9' * m, '9' * m)
elif m == 1:
	print(s, s)
else:
	r = s
	i = 0
	a = [0] * m
	b = [0] * m
	while i < m:
		for j in range(9, 0, -1):
			l = s - j
			if l >= 0:
				b[i] = j
				s -= j
				break
		i += 1
	s = round(r % 9)
	k = round((r - r % 9) / 9)
	for j in range(m - 1, m - k - 1, -1):
		a[j] = 9
	a[m - k - 1] = s
	if a[0] == 0:
		a[0] = 1
		for i in range(m - k - 1, m):
			if a[i]:
				a[i] -= 1
				break
	for i in range(m):
		print(a[i], end='')
	print(end=' ')
	for i in range(m):
		print(b[i], end='')


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

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

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(digits, s) = get_ints()
if s > digits * 9:
	print(-1, -1)
	exit()
if s == 0:
	if digits == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit()
score = s
mini = [0] * digits
maxi = [0] * digits
for i in range(digits):
	maxi[i] = t = str(min(s, 9))
	s -= int(t)
score -= 1
mini[0] = 1
for i in range(digits):
	mini[~i] = t = str(min(score, 9) + mini[~i])
	score -= int(t)
print(''.join(mini), ''.join(maxi))


(n, m) = map(int, input().split())
if n * 9 < m or (m == 0 and n > 1):
	print(-1, -1)
else:
	k = (m - 1) // 9
	if m > 0:
		l = (m - 1) % 9 + 1
	else:
		l = 0
	x = 0
	y = 0
	for i in range(k):
		x = x * 10 + 9
	if n - k == 1:
		x += l * 10 ** k
	elif n - k > 1:
		if l > 1:
			x += (l - 1) * 10 ** k + 10 ** (n - 1)
		else:
			x += 10 ** (n - 1) * l
	k = m // 9
	l = m % 9
	for i in range(k):
		y = y * 10 + 9
	if n > k:
		y = y * 10 + l
		y = y * 10 ** (n - k - 1)
	print(x, y)


(m, s) = map(int, input().split())
s1 = s
s2 = s
if m > 1 and s == 0 or s > 9 * m:
	print('-1 -1')
else:
	if s1 <= 1 + 9 * (m - 1):
		min = 1 * 10 ** (m - 1)
		s1 -= 1
		min += 10 ** (s1 // 9) - 1 + s1 % 9 * 10 ** (s1 // 9)
	else:
		min = (s1 - 9 * (m - 1)) * 10 ** (m - 1) + 10 ** (m - 1) - 1
	max = 0
	while s2 != 0:
		for p in range(m):
			if s2 >= 9:
				max += 9 * 10 ** (m - p - 1)
				s2 -= 9
			else:
				max += s2 * 10 ** (m - p - 1)
				s2 = 0
	print('%d %d' % (min, max))


(m, s) = map(int, input().split())
if s == 1:
	print('1' + '0' * (m - 1), '1' + '0' * (m - 1))
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
if s == 0 or s > 9 * m:
	print('-1 -1')
	exit()
dev = s // 9
s -= dev * 9
if dev == m:
	print('9' * dev, '9' * dev)
	exit()
if dev + 1 == m:
	if s == 0:
		dev -= 1
		print('18' + '9' * dev, '9' * dev + '81')
	else:
		print(str(s) + '9' * dev, '9' * dev + str(s))
	exit()
countn = m - dev - 2
if s != 0:
	vtr = s - 1
	s = 1
else:
	dev -= 1
	vtr = 8
	s = 1
(s, vtr) = (min(s, vtr), max(s, vtr))
x = s + vtr
if x >= 10:
	x = '9' + str(x - 9)
x = str(x)
if s == 0 and vtr == 1:
	print(str(vtr) + '0' * countn + str(s) + '9' * dev, '9' * dev + str(vtr) + str(s) + '0' * countn)
else:
	x = s + vtr
	count = 1
	if x >= 10:
		x = '9' + str(x - 9)
		count = 2
	x = str(x)
	print(str(s) + '0' * (m - 2 - dev) + str(vtr) + '9' * dev, '9' * dev + str(x) + '0' * (m - count - dev))


(n, s) = map(int, input().split())
if n > 1 and s == 0 or s > 9 * n:
	print(-1, -1)
elif n == 1 and s == 0:
	print(0, 0)
else:
	l = [0] * (n - 1) + [1]
	x = 0
	while sum(l) < s:
		if l[x] == 9:
			x += 1
		l[x] += 1
	l2 = [9] * n
	x = 0
	while sum(l2) > s:
		if l2[x] == 0:
			x += 1
		l2[x] = l2[x] - 1
	l1 = [str(x) for x in l]
	l2 = [str(x) for x in l2]
	l1 = l1[::-1]
	l2 = l2[::-1]
	print(''.join(l1), ''.join(l2))


import itertools as ittls
from collections import Counter
from functools import reduce
import string

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
(m, s) = inputarray()
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	quit()
if s > 9 * m:
	print(-1, -1)
	quit()
(p, q) = divmod(s, 9)
maxv = '9' * p + (str(q) + '0' * (m - p - 1) if q != 0 else '0' * (m - p))
(p, q) = divmod(s - 1, 9)
minv = ('1' + '0' * (m - p - 2) + str(q) if p != m - 1 else str(q + 1)) + '9' * p
print(minv, maxv)


def g(x, y):
	if y >= 9:
		return 9
	else:
		return y
(m, s) = map(int, input().split())
(s1, s2) = (m, s)
q = m
a = []
h = ''
t = ''
if m == 0 or s > 9 * m:
	print('-1', '-1')
elif s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	if s > 9 * m - 8:
		ozo = s - 9 * (m - 1)
	else:
		ozo = 1
	a.append(ozo)
	s = s - 1
	m = m - ozo
	for i in range(q - 1):
		z = g(m, s)
		a.append(z)
		m = m - 1
		s = s - z
	for i in range(q):
		H = g(s1, s2)
		s1 = s1 - 1
		s2 = s2 - H
		t = t + str(H)
	for i in range(q - 1):
		h += str(a[q - 1 - i])
	print(str(ozo) + h, t)


(n, m) = map(int, input().split())
max = 0
min = 0
if m == 0 and n != 1 or m > 9 * n:
	print(-1, -1)
elif n == 1 and m == 0:
	print(0, 0)
else:
	min = 10 ** (n - 1)
	for i in range(m - 1):
		a = i // 9
		min += 10 ** a
	max = 0
	for i in range(m):
		b = n - 1 - i // 9
		max += 10 ** b
	print(min, max)


(m, s) = input().split()
m = int(m)
s = int(s)
if m == 1 and s == 0:
	print('0 0')
elif s > 9 * m or s < 1:
	print('-1 -1')
else:
	ma = '9' * m
	ma = list(ma)
	r = 9 * m - s
	i = -1
	while r != 0:
		q = min(9, r)
		ma[i] = str(9 - q)
		r -= q
		i -= 1
	ma = ''.join(ma)
	mi = '1'
	mi += '0' * (m - 1)
	mi = list(mi)
	r = s - 1
	i = m - 1
	while r != 0:
		if i > 0:
			q = min(9, r)
			mi[i] = str(q)
			r -= q
		else:
			mi[i] = str(r + 1)
			r = 0
		i -= 1
	mi = ''.join(mi)
	print(mi, ma)


(m, s) = map(int, input().split())
if 9 * m < s:
	print(-1, -1)
	exit()
if s == 0 and m > 1:
	print(-1, -1)
	exit()
if m == 1:
	print(s, s)
	exit()
if m == s / 9:
	print('9' * (s // 9), '9' * (s // 9))
	exit()
(st, nd) = ('', '')
if not s % 9:
	n1 = s // 9
	if m == n1 + 1:
		st += '18' + '9' * (n1 - 1)
		nd += '9' * n1 + '0'
	else:
		n3 = m - n1 - 1
		st += '1' + '0' * n3 + '8' + '9' * (n1 - 1)
		nd += '9' * n1 + '0' * (n3 + 1)
else:
	n1 = s // 9
	n2 = s % 9
	if m == n1 + 1:
		st += str(n2) + '9' * n1
		nd += '9' * n1 + str(n2)
	elif m == n1 + 2:
		st += '1' + str(n2 - 1) + '9' * n1
		nd += '9' * n1 + str(n2) + '0'
	else:
		n3 = m - n1 - 1
		st += '1' + '0' * (n3 - 1) + str(n2 - 1) + '9' * n1
		nd += '9' * n1 + str(n2) + '0' * n3
print(st + ' ' + nd)


(m, s) = map(int, input().split())
if m == 1:
	if 0 <= s <= 9:
		print(s, s)
	else:
		print(-1, -1)
elif m * 9 == s:
	print('9' * m, '9' * m)
elif 1 <= s <= 9 * m:
	a = ''
	a += '9' * (s // 9)
	a += str(s % 9)
	a += '0' * (m - len(a))
	b = ''
	if 1 <= s <= 9 * (m - 1) + 1:
		b += '1'
		c = '9' * ((s - 1) // 9)
		if 1 + len(c) == m:
			b += c
		else:
			d = str((s - 1) % 9) + c
			b = b + '0' * (m - len(b) - len(d)) + d
	else:
		b += str(s % 9)
		b += '9' * (s // 9)
	print(b, a)
else:
	print(-1, -1)


(n, s) = map(int, input().split())
if n == 1 and s == 0:
	print(0, 0)
	exit(0)
if s > 9 * n or s == 0:
	print(-1, -1)
	exit(0)
a = [0] * n
a[0] = 1
ss = 1
ind = n - 1
while ind >= 0:
	if s - ss > 9:
		ss += 9
		a[ind] = 9
	else:
		if ind == 0:
			a[ind] = s - ss + 1
		else:
			a[ind] = s - ss
		break
	ind -= 1
s1 = str.join('', map(str, a))
a = [0] * n
ss = 0
ind = 0
while ind < n:
	if s - ss > 9:
		ss += 9
		a[ind] = 9
	else:
		a[ind] = s - ss
		break
	ind += 1
print(s1 + ' ' + str.join('', map(str, a)))


(m, s) = tuple(map(int, input().split()))
l = []
q = []
s1 = s
ans = 0
if s > m * 9:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0' * m + ' ' + '0' * m)
else:
	for i in range(m):
		q.append(0)
		if s == 0:
			ans = 1
			break
		if i == m - 1:
			s -= 1
			l.append(1)
		else:
			l.append(0)
	if ans == 1:
		print('-1 -1')
	else:
		for i in range(m):
			if s >= 9:
				s -= 9 - l[i]
				l[i] = 9
			else:
				l[i] += s
				s = 0
		l.reverse()
		s = s1
		for i in range(m):
			if s >= 9:
				s -= 9
				q[i] += 9
			else:
				q[i] += s
				s = 0
		a = ''
		for i in l:
			a += str(i)
		a += ' '
		for i in q:
			a += str(i)
		print(a)


(lg, s) = map(int, input().split())
minNr = -1
maxNr = -1
if s == 0 and lg == 0:
	minNr = 0
	maxNr = 0
	print(minNr, maxNr)
elif s in range(1, lg * 9 + 1) and lg > 0:
	if lg == 1:
		minNr = s
		print(minNr, end=' ')
	else:
		s -= 1
		minNr = ['9'] * int(s / 9) + [str(int(s % 9))]
		minNr += ['0'] * (lg - len(minNr))
		minNr[-1] = str(int(minNr[-1]) + 1)[0]
		s += 1
		print(''.join(minNr[::-1]), end=' ')
	maxNr = '9' * int(s / 9) + str(int(s % 9))
	maxNr += '0' * (lg - len(maxNr))
	print(maxNr[0:lg])
elif s == 0 and lg == 1:
	print(0, 0)
else:
	print(minNr, maxNr)


(a, b) = map(int, input().split())
if b > 9 * a or (b == 0 and a != 1):
	print(-1, -1)
elif a == 1 and b == 0:
	print(0, 0)
else:
	(M, m) = (0, 10 ** (a - 1))
	for i in range(b - 1):
		m += 10 ** (i // 9)
	for i in range(b):
		M += 10 ** (a - 1 - i // 9)
	print(m, M)


(s, m) = map(int, input().split())
if m == 0 or m > 9 * s:
	if s == 1 and m == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	max = '9' * (m // 9) + (str(m % 9) if m % 9 != 0 else '')
	min = list(max)
	min.reverse()
	if len(max) == s:
		min = ''.join(min)
	else:
		max += '0' * (s - len(max))
		min[0] = str(int(min[0]) - 1)
		min = '1' + '0' * (s - len(min) - 1) + ''.join(min)
	print(min + ' ' + max)


(l, s) = map(int, input().split())
x = ''
if s == 0:
	if l == 1:
		print(0, 0)
		exit()
	else:
		print(-1, -1)
		exit()
while s >= 1:
	if s <= 9:
		x = x + str(s)
		s = 0
	else:
		x = x + '9'
		s = s - 9
if l < len(x):
	print('-1 -1')
else:
	a = x[::-1]
	t = len(a)
	if l > t:
		a = '1' + a.replace(a[0], str(int(a[0]) - 1), 1)
	a = a[:1] + '0' * (l - len(a)) + a[1:]
	print(a, x + '0' * (l - len(x)))


(length, total) = map(int, input().strip().split(' '))
if total > 9 * length or total == 0:
	if length == 1 and total == 0:
		print(0, 0)
	else:
		print(-1, -1)
else:
	l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
	ans = ''
	i = len(l) - 1
	tota = 0
	while i >= 0:
		if total >= total - i >= 0:
			total -= i
			tota += i
			ans += str(l[i])
		else:
			i -= 1
		if total == 0:
			break
	result = ''
	rr = list(ans)
	i = length - len(ans)
	ans += '0' * (length - len(ans))
	if i > 0:
		rr[len(rr) - 1] = chr(ord(rr[-1]) - 1)
		while i > 1:
			rr.append(0)
			i -= 1
	rr.append('1')
	asn = ''
	i = length - 1
	while i >= 0:
		asn += str(rr[i])
		i -= 1
	print(asn, ans)


(m, s) = map(int, input().split())
maxx = '9' * (s // 9) + (str(s % 9) if s % 9 != 0 else '')
check = list({maxx})
if m == 1 and s == 0:
	print(0, 0)
elif m < len(maxx) or (len(check) <= 1 and check[0] == '0' or check[0] == ''):
	print(-1, -1)
else:
	k = m - len(maxx)
	maxx = maxx + '0' * k
	if '0' in maxx:
		minn = '1' + (m - len(str(int(str(maxx).replace('0', '')) - 1)[::-1]) - 1) * '0' + str(int(maxx.replace('0', '')) - 1)[::-1]
		print(minn, maxx)
	else:
		print(maxx[::-1], maxx)


def solve():
	(m, s) = map(int, input().split())
	if s == 0 and m == 1:
		print(0, 0)
		return
	s_copy = s
	largestNo = [0] * m
	i = 0
	while i < m and s > 0:
		largestNo[i] += min(9, s)
		s -= min(9, s)
		i += 1
	if s != 0 or s_copy == 0:
		print(-1, -1)
		return
	s = s_copy - 1
	smallestNo = [0] * m
	smallestNo[0] = 1
	i = m - 1
	while i < m and s > 0:
		smallestNo[i] += min(s, 9)
		s -= min(s, 9)
		i -= 1
	smallestNo = [str(d) for d in smallestNo]
	largestNo = [str(d) for d in largestNo]
	print(''.join(smallestNo), ''.join(largestNo))
solve()


def get_max(length, somme):
	fs = []
	for x in range(length):
		temp = min(9, somme)
		somme -= temp
		fs.append(temp)
	return fs

def get_min(length, somme):
	mx = get_max(length, somme)
	mx.sort()
	if mx[0] == 0:
		mx[0] = 1
		x = 1
		while mx[x] == 0:
			x += 1
		mx[x] -= 1
	return mx

def main():
	(m, s) = map(int, input().split())
	if m == 1 and s == 0:
		print(0, 0)
		return
	if m > 1 and s == 0 or s > m * 9:
		print(-1, -1)
		return
	ml = get_max(m, s)
	minl = get_min(m, s)
	s1 = ''
	s2 = ''
	for item in minl:
		s1 += str(item)
	for item in ml:
		s2 += str(item)
	print(s1, s2)
main()


n = str(input()).split()
l = int(n[0])
s = int(n[1])
if s == 0:
	if l == 1:
		print(0, 0)
		quit()
	else:
		print(-1, -1)
		quit()
if l * 9 < s:
	print(-1, -1)
	quit()

def mx(l, s):
	x = s
	r = ''
	for i in range(0, l):
		if x == 0:
			r = r + '0'
		else:
			nextChar = min(9, x)
			r = r + str(nextChar)
			x = x - nextChar
	return r

def mn(l, s):
	x = s
	r = ''
	for i in range(0, l):
		if i == l - 1:
			r = str(x) + r
		elif x == 1:
			r = '0' + r
		else:
			nextChar = min(9, x - 1)
			r = str(nextChar) + r
			x = x - nextChar
	return r
print(mn(l, s), mx(l, s))


(m, s) = [int(i) for i in input().split()]
n = ''
t = ''
if s == 0 and m == 1:
	(n, t) = (0, 0)
elif s >= 1 and s <= 9 * m:
	if s // 9 == m:
		(n, t) = ('9' * m, '9' * m)
	elif s // 9 == m - 1:
		if s % 9 > 0:
			n += str(s % 9) + '9' * (m - 1)
		else:
			n += '1' + '8' + '9' * (m - 2)
		t += '9' * (m - 1) + str(s % 9)
	else:
		k = (s - 1) // 9
		n += '1' + '0' * (m - 2 - k) + str((s - 1) % 9) + '9' * k
		k = s // 9
		t += '9' * k + str(s % 9) + '0' * (m - k - 1)
else:
	(n, t) = ('-1', '-1')
print(n, t)


def stringify(l):
	s = ''
	for i in l:
		s += str(i)
	return s
(m, s) = map(int, input().split())
mc = m
sc = s
ans = []
rans = []
if sc > mc * 9 or (sc == 0 and mc > 1):
	ans = [-1]
	rans = [-1]
elif mc == 1 and sc == 0:
	ans = [0]
	rans = [0]
else:
	while m:
		if s >= 9:
			s -= 9
			rans.append(9)
		elif s < 9 and s > 0:
			rans.append(s)
			s = 0
		else:
			rans.append(0)
		m -= 1
	ans = rans.copy()
	if mc > 2 and sc > 1:
		fl = 0
		for i in range(mc - 1):
			if ans[i] < 9:
				ans[i] -= 1
				fl = 1
				if ans[i] == -1:
					ans[i] = 0
					ans[i - 1] = 8
				break
		if fl:
			ans[mc - 1] = 1
		ans = ans[::-1]
	elif mc == 2 and sc > 9:
		ans = ans[::-1]
	elif mc == 2 and sc <= 9:
		ans[0] -= 1
		ans[1] = 1
		ans = ans[::-1]
print(stringify(ans), stringify(rans))


(jiweishu, he) = [int(i) for i in input().split()]
zuida1 = 9 * jiweishu
zuixiao1 = 1
if he == 0 and jiweishu == 1:
	print('0 0')
	exit()
if he > zuida1 or he < zuixiao1:
	print('-1 -1')
	exit()
if jiweishu == 1:
	print(he, end=' ')
	print(he)
	exit()
if he == 0 and jiweishu != 1:
	print('-1 -1')
	exit()
zuidashouwei = min(9, he)
zuida = str(zuidashouwei)
if zuidashouwei != 9:
	for i in range(jiweishu - 1):
		zuida = zuida + str(0)
else:
	shengduoshao = he - zuidashouwei
	for i in range(2, jiweishu + 1):
		if shengduoshao != 0:
			zheyiwei = min(shengduoshao, 9)
			shengduoshao = shengduoshao - zheyiwei
			zuida = zuida + str(zheyiwei)
		else:
			zheyiwei = 0
			zuida = zuida + str(0)
if (jiweishu - 1) * 9 + 1 <= he:
	zuixiao = str(min(9, he))
	shengduoshao = he - int(zuixiao)
	for i in range(2, jiweishu):
		zuixiao = str(min(9, shengduoshao)) + str(zuixiao)
		shengduoshao = shengduoshao - min(9, shengduoshao)
	zuixiao = str(shengduoshao) + str(zuixiao)
else:
	zuixiao = 1
	s = ''
	shengduoshao = he - 1
	for i in range(2, jiweishu + 1):
		s = str(min(9, shengduoshao)) + s
		shengduoshao = shengduoshao - min(9, shengduoshao)
	zuixiao = str(1) + s
print(zuixiao, end=' ')
print(zuida)


(n, m) = map(int, input().split())
l = m
if n != 1 and m == 0:
	print(-1, -1)
elif n == 1 and m == 0:
	print(0, 0)
elif m > n * 9:
	print(-1, -1)
else:
	i = 0
	s = [0] * n
	a = [0] * n
	while i < n and m != 0:
		s[i] += min(9, m)
		m -= s[i]
		i += 1
	i = n - 1
	while i > -1:
		a[i] += min(9, l)
		l -= a[i]
		if l == 0:
			a[i] -= 1
			a[0] += 1
			break
		i -= 1
	print(*a, sep='', end=' ')
	print(*s, sep='')


(a, b) = [int(i) for i in input().split()]
if a * 9 < b or b < 0:
	print('-1 -1')
elif a == 1 and b == 0:
	print('0', '0')
elif a > 1 and b == 0:
	print('-1 -1')
else:
	da = b // 9
	e = b % 9
	ma = ''
	mi = ''
	if e == 0:
		da = da - 1
		e = 9
	i = 0
	while i < da:
		ma = ma + str(9)
		i += 1
		mi = mi + str(9)
	ma = ma + str(e)
	i += 1
	while i < a:
		ma = ma + str(0)
		i += 1
	if da + 1 == a:
		mi = str(e) + mi
	else:
		mi = str(1) + '0' * (a - da - 2) + str(e - 1) + mi
	print(int(mi), int(ma))


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
	exit()
if s >= 1 and s <= 9 * m:
	mn = []
	mx = []
	for i in range(m):
		mn.append(0)
		mx.append(0)
	mnk = s * 1
	mxk = s * 1
	mn[0] = 1
	mnk -= 1
	for i in range(m - 1, -1, -1):
		if mnk > 9:
			mn[i] += 9
			mnk -= 9
		else:
			mn[i] += mnk
			mnk = 0
			break
	mx[0] = min(mxk, 9)
	mxk -= min(mxk, 9)
	for i in range(1, m, 1):
		if mxk > 9:
			mx[i] += 9
			mxk -= 9
		else:
			mx[i] += mxk
			mxk = 0
			break
	a = []
	b = []
	for i in range(m):
		a.append(str(mn[i]))
		b.append(str(mx[i]))
	print(''.join(a), ''.join(b))
else:
	print('-1 -1')


(n, k) = map(int, input().split())
if k == 1:
	print('1' + '0' * (n - 1), '1' + '0' * (n - 1))
elif n == 1:
	if 0 <= k <= 9:
		print(k, k)
	else:
		print('-1 -1')
else:
	ANS = ['1'] + ['0'] * (n - 2) + ['1']
	k -= 2
	if k < 0:
		print('-1 -1')
	else:
		ANS[0] = str(min(8, k) + 1)
		k -= min(8, k)
		i = 1
		while k > 0 and i < n - 1:
			ANS[i] = str(min(9, k))
			k -= min(9, k)
			i += 1
		ANS[-1] = str(min(8, k) + 1)
		k -= min(8, k)
		if k > 0:
			print('-1 -1')
		else:
			a = ''.join(ANS)
			a = a[::-1]
			if i == n - 1:
				if ANS[-2] != '9':
					ANS[-2] = str(1 + int(ANS[-2]))
					ANS[-1] = '0'
				b = ''.join(ANS)
			else:
				if ANS[i - 1] == '9':
					ANS[-1] = '0'
					ANS[i] = '1'
				else:
					ANS[i - 1] = str(1 + int(ANS[i - 1]))
					ANS[-1] = '0'
				b = ''.join(ANS)
			print(a, b)


(n, k) = map(int, input().split())
if n == 1 and k == 0:
	print('0 0')
	exit()
if k == 0 or 9 * n < k:
	print('-1 -1')
elif k <= 9 and n == 1:
	print(k, k)
elif k > 9:
	t = k // 9
	res = '9' * min(t, n)
	if n == t and k - 9 * min(t, n) == 0:
		print(res, res)
	else:
		mn = 0
		dif = k - 9 * min(t, n)
		dig = n - min(t, n)
		if dig == 1:
			print(str(dif) + res, res + str(dif))
		else:
			if dif == 0:
				mn = '1' + '0' * (dig - 1) + '8' + res[0:-1]
			else:
				mn = '1' + '0' * (dig - 2) + str(dif - 1) + res
			print(mn, res + str(dif) + '0' * (dig - 1))
else:
	t = min(n, k)
	res1 = '1' + '0' * (n - 2) + str(k - 1)
	res2 = str(k) + '0' * (n - 1)
	print(res1, res2)


(m, s) = input().split()
m = int(m)
s = int(s)
if s == 0:
	if m == 1:
		min = 0
		max = 0
	else:
		max = -1
		min = -1
elif s > 9 * m:
	max = -1
	min = -1
elif s < 10:
	max = s * 10 ** (m - 1)
	min = 10 ** (m - 1) + s - 1
elif s == 9 * m:
	max = 10 ** m - 1
	min = 10 ** m - 1
elif s == 9 * m + 1:
	max = (10 ** (s // 9 - 1) - 1) * 10 + 1
	min = 2 * 10 ** (m - 1) - 1
elif s > 9 * (m - 1):
	max = (10 ** (s // 9) - 1) * 10 ** (m - s // 9) + s % 9 * 10 ** (m - s // 9 - 1)
	min = (s % 9 + 1) * 10 ** (m - 1) - 1
elif s % 9 == 0:
	max = (10 ** (s // 9) - 1) * 10 ** (m - s // 9)
	min = 10 ** (m - 1) + 9 * 10 ** (s // 9 - 1) - 1
else:
	max = (10 ** (s // 9) - 1) * 10 ** (m - s // 9) + s % 9 * 10 ** (m - s // 9 - 1)
	min = 10 ** (m - 1) + (s - 1) % 9 * 10 ** (s // 9) + 10 ** (s // 9) - 1
print(min, max)


(m, s) = map(int, input().split())
u = ''
if s > 9 * m or (s == 0 and m > 1):
	print(-1, -1)
else:
	i = m - 1
	k = s
	while i >= 0:
		j = max(0, k - 9 * i)
		if j == 0 and i == m - 1 and k:
			j = 1
		u += str(j)
		k -= j
		i -= 1
	u += ' '
	k = s
	for i in range(m):
		u += str(min(9, s))
		s -= min(9, s)
	print(u)


def dp_large(length, sum):
	if length == 0:
		if sum != 0:
			raise IndexError
		else:
			return ''
	if sum >= 9:
		return '9' + dp_large(length - 1, sum - 9)
	else:
		return str(sum) + dp_large(length - 1, 0)

def dp_small(length, sum):
	if length == 1:
		if sum > 9:
			raise IndexError
		else:
			return str(sum)
	if sum > 9:
		return dp_small(length - 1, sum - 9) + '9'
	else:
		return dp_small(length - 1, 1) + str(sum - 1)
	return ''

def f(length, sum):
	if sum == 0:
		if length == 1:
			print('0 0')
		else:
			print('-1 -1')
	else:
		try:
			large = dp_large(length, sum)
		except:
			large = '-1'
		try:
			small = dp_small(length, sum)
		except:
			small = '-1'
		print('{} {}'.format(small, large))
f(*map(int, input().split()))


import sys
import math

def length(x):
	x = str(x)
	return len(x)
inp = input().split()
m = int(inp[0])
s = int(inp[1])
if s == 0 and m == 1:
	print('0 0')
elif s < 1 or s > 9 * m:
	print('-1 -1')
else:
	digits = [0 for i in range(m)]
	nines = s // 9
	remain = int(s % 9)
	for i in range(0, m - nines):
		digits[i] = 0
	for i in range(m - nines, m):
		digits[i] = 9
	i = m - nines
	if remain > 0:
		i -= 1
		digits[i] = remain
	if digits[0] == 0:
		digits[0] += 1
		digits[i] -= 1
	for i in range(m):
		print(digits[i], end='', flush=True)
	print(' ', end='')
	for i in range(nines):
		digits[i] = 9
	for i in range(nines, m):
		digits[i] = 0
	if remain > 0:
		digits[nines] = remain
	for i in range(m):
		print(digits[i], end='', flush=True)


(m, s) = input().split()
m = int(m)
s = int(s)
mi = 0
ma = 0
if s > 0 and s <= m * 9:
	if s > 9 * m - 8:
		for i in range(m):
			mi += 9 * 10 ** i
		mi -= (9 * m - s) * 10 ** (m - 1)
		mi = str(mi)
		mini = list(mi)
		mini.reverse()
		ma = ''.join(mini)
	else:
		a = (s - 1) // 9
		b = (s - 1) % 9
		for i in range(a):
			mi += 9 * 10 ** i
		mi += b * 10 ** a
		mi += 10 ** (m - 1)
		c = s // 9
		d = s % 9
		for i in range(m - c, m):
			ma += 9 * 10 ** i
		ma += d * 10 ** (m - c - 1)
	ma = str(ma)
	mi = str(mi)
	print(mi + ' ' + ma)
elif m == 1 and s == 0:
	print('0 0')
else:
	print('-1 -1')


(m, s) = map(int, input().split())

def ismax(m, s):
	op1 = str()
	if s == 0:
		return -1
	elif s > m * 9:
		return -1
	else:
		for i in range(m):
			if s > 9:
				op1 = op1 + '9'
				s -= 9
			elif 0 < s <= 9:
				op1 = op1 + str(s)
				s = 0
			else:
				op1 = op1 + '0'
		return int(op1)

def ismin(m, s):
	op2 = str()
	lis = []
	if s == 0:
		return -1
	elif s > m * 9:
		return -1
	else:
		l = max(1, s - 9 * (m - 1))
		op2 = op2 + str(l)
		s = s - l
		for i in range(m - 1):
			if s > 9:
				lis.append(9)
				s -= 9
			elif 0 < s <= 9:
				lis.append(s)
				s = 0
			else:
				lis.append(0)
		lis = sorted(lis)
		if len(lis) == 1:
			op2 = op2 + str(*lis)
		elif len(lis) > 1:
			st = ''.join(map(str, lis))
			op2 = op2 + st
		return int(op2)
if m == 1 and s == 0:
	print(0, 0)
else:
	print(ismin(m, s), ismax(m, s))


(m, s) = map(int, input().split(' '))
(smallest, largest) = ([], [])
if s == 0 and m > 1 or m * 9 < s:
	print('-1 -1')
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
if m * 9 == s:
	smallest = largest = ['9'] * (s // 9)
else:
	(s_small, s_large) = (s, s)
	if m % 9 > 0 or s % 9 > 0:
		while s_small > 9:
			smallest.append('9')
			s_small -= 9
		if len(smallest) < m - 1:
			smallest.insert(0, '1')
			s_small -= 1
			smallest.insert(1, str(s_small))
			while len(smallest) < m:
				smallest.insert(1, '0')
		else:
			smallest.insert(0, str(s_small))
	else:
		while s_small:
			smallest.append('9')
		if len(smallest) < m:
			smallest.remove('9')
			smallest.insert(0, '1')
			smallest.insert(1, '8')
			while len(smallest) < m:
				smallest.insert(1, '0')
	while len(largest) < m:
		if s_large >= 9:
			largest.append('9')
			s_large -= 9
		else:
			largest.append(str(s_large))
			s_large = 0
print(''.join(smallest) + ' ' + ''.join(largest))


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	(m, s) = invr()
	if s < 1 and m > 1 or s > 9 * m:
		print(-1, -1)
	else:
		remaining = s - min(s, 1)
		min_s = ''
		for i in range(m - 1):
			if remaining >= 9:
				min_s = '9' + min_s
				remaining -= 9
			else:
				min_s = str(remaining) + min_s
				remaining = 0
		min_s = str(remaining + min(s, 1)) + min_s
		if int(min_s) == 0:
			min_s = '0'
		remaining = s - min(s, 9)
		max_s = ''
		for i in range(m - 1):
			if remaining >= 9:
				max_s += '9'
				remaining -= 9
			else:
				max_s += str(remaining)
				remaining = 0
		max_s = str(min(s, 9)) + max_s
		if int(max_s) == 0:
			max_s = '0'
		print(min_s, max_s)


a = input().split(' ', 2)
length = int(a[0])
asum = int(a[1])
if length == 1 and asum == 0:
	print('0 0')
elif asum == 0:
	print('-1 -1')
elif asum > length * 9:
	print('-1 -1')
else:
	ans1 = 0
	ans2 = 0
	str1 = ''
	str2 = ''
	if asum < 10:
		ans1 = 10 ** (length - 1) + asum - 1
		ans2 = asum * 10 ** (length - 1)
	elif asum == length * 9:
		i = length
		while i > 0:
			str1 = '9' + str1
			str2 = str2 + '9'
			i = i - 1
	else:
		cnt9 = int(asum / 9)
		left = int(asum - cnt9 * 9)
		i = cnt9
		while i > 1:
			str1 = '9' + str1
			str2 = str2 + '9'
			i = i - 1
		if left != 0:
			str1 = '9' + str1
			str2 = str2 + '9'
			str2 = str2 + str(left)
			if cnt9 == length - 1:
				str1 = str(left) + str1
			else:
				str1 = str(left - 1) + str1
			i = length - cnt9 - 1
			while i > 1:
				str1 = '0' + str1
				str2 = str2 + '0'
				i = i - 1
			if cnt9 != length - 1:
				str1 = '1' + str1
				str2 = str2 + '0'
		else:
			str1 = '8' + str1
			str2 = str2 + '9'
			i = length - cnt9
			while i > 1:
				str1 = '0' + str1
				str2 = str2 + '0'
				i = i - 1
			if cnt9 != length - 1:
				str1 = '1' + str1
				str2 = str2 + '0'
	if ans1 != 0 and ans2 != 0:
		str1 = '%d' % ans1
		str2 = '%d' % ans2
	print(str1 + ' ' + str2)


def min_len_sum(m, s):
	a = [[]] * (m + 1)
	for i in range(m + 1):
		a[i] = ['-1'] * (s + 1)
	for j in range(min(s, 9) + 1):
		a[1][j] = str(j)
	for i in range(2, m + 1):
		a1 = a[i - 1]
		a0 = a[i]
		for j1 in range(1, s + 1):
			if a1[j1] == '-1':
				break
			for d in range(10):
				j = j1 + d
				if j > s:
					break
				new_val = a1[j1] + str(d)
				if a0[j] == '-1' or new_val < a0[j]:
					a0[j] = new_val
	return a[m][s]

def max_len_sum(m, s):
	a = [[]] * (m + 1)
	for i in range(m + 1):
		a[i] = ['-1'] * (s + 1)
	for j in range(min(s, 9) + 1):
		a[1][j] = str(j)
	for i in range(2, m + 1):
		a1 = a[i - 1]
		a0 = a[i]
		for j1 in range(1, s + 1):
			if a1[j1] == '-1':
				break
			for d in range(10):
				j = j1 + d
				if j > s:
					break
				new_val = a1[j1] + str(d)
				if a0[j] == '-1' or new_val > a0[j]:
					a0[j] = new_val
	return a[m][s]

def main():
	(m, s) = map(int, input().split())
	print(min_len_sum(m, s), max_len_sum(m, s))
main()


from sys import stdin, stdout
input = stdin.readline
(m, s) = map(int, input().split())
if s == 0 and m == 1:
	stdout.write('0 0')
	exit(0)
elif s == 0:
	stdout.write('-1 -1')
	exit(0)
ma = ['9'] * (s // 9)
ma += [str(s % 9)] if s % 9 != 0 else []
while len(ma) < m:
	ma.append('0')
mi = list(reversed(ma.copy()))

def f():
	for i in range(len(mi)):
		if mi[i] != '0':
			return i
if mi[0] == '0':
	mi[f()] = str(int(mi[f()]) - 1)
	mi[0] = '1'
if m * 9 < s:
	stdout.write('-1 -1')
	exit(0)
stdout.write(''.join(mi) + ' ' + ''.join(ma))


(m, s) = input().split()
m = int(m)
s = int(s)
l1 = 0
l2 = 0
if s == 0:
	if m > 1:
		l1 -= 1
		l2 -= 1
	elif m == 1:
		l1 = 0
		l2 = 0
elif 9 * m < s:
	l1 -= 1
	l2 -= 1
elif s == 9 * m:
	l1 = l2 = 10 ** m - 1
elif s > 9:
	t = int(s / 9)
	if m <= 2:
		l1 += (s - 9 * t) * 10 ** (m - 1)
		for i in range(1, t + 1):
			l1 += 9 * 10 ** (i - 1)
	else:
		l1 += 10 ** (m - 1)
		l1 += 10 ** t - 1
		if s > 9 * t:
			l1 += (s - 9 * t - 1) * 10 ** t
		else:
			l1 -= 10 ** (t - 1)
	l2 += (s - 9 * t) * 10 ** (m - t - 1)
	for i in range(1, t + 1):
		l2 += 9 * 10 ** (m - i)
else:
	l1 = 10 ** (m - 1) + s - 1
	l2 = s * 10 ** (m - 1)
print('%s %d' % (l1, l2))


(m, s) = map(int, input().split())
mx = ''
mn = ''
if s < 1 and m > 1 or s > m * 9:
	print('-1 -1')
else:
	k = s
	for i in range(m - 1, -1, -1):
		j = max(0, k - 9 * i)
		if j == 0 and i == m - 1 and k:
			j = 1
		mx += str(j)
		k -= j
	print(mx)
	k = s
	for i in range(m - 1, -1, -1):
		l = min(9, k)
		mn += str(l)
		k -= l
	print(mn)


(m, s) = input().split()
m = int(m)
s = int(s)
if s / m == 0:
	if s + m == 1:
		a = b = 0
	else:
		a = b = -1
elif 0 < s / m <= 1:
	sy = s - 1
	n = sy // 9
	if n != 0:
		sy = sy - n * 9
		a = 10 ** (m - 1) + 10 ** n - 1 + sy * 10 ** n
	else:
		a = 10 ** (m - 1) + sy
	sy1 = s - 9
	if sy1 <= 0:
		b = s * 10 ** (m - 1)
	else:
		n1 = s // 9
		s = s - n1 * 9
		b = (10 ** n1 - 1) * 10 ** (m - n1) + s * 10 ** (m - n1 - 1)
elif s / m > 1:
	if s / 9 > m:
		a = b = -1
	else:
		n = s // 9
		if n == m - 1:
			if s % 9 == 0:
				a = 9 * 10 ** (n - 1) - 1 + 10 ** (m - 1)
				b = (10 ** n - 1) * 10 + s - n * 9
			else:
				a = (s - n * 9) * 10 ** (m - 1) + 10 ** n - 1
				b = (10 ** n - 1) * 10 + s - n * 9
		elif n == m:
			a = 10 ** n - 1
			b = 10 ** n - 1
		elif n == 0:
			a = 10 ** (m - 1) + s - 1
			b = s * 10 ** (m - 1)
		elif s % 9 != 0:
			a = 10 ** (m - 1) + 10 ** n - 1 + (s - n * 9 - 1) * 10 ** n
			b = (10 ** n - 1) * 10 ** (m - n) + (s - n * 9) * 10 ** (m - n - 1)
		else:
			b = (10 ** n - 1) * 10 ** (m - n) + (s - n * 9) * 10 ** (m - n - 1)
			a = 10 ** (m - 1) + 9 * 10 ** (n - 1) - 1
print(a, b)


(m, s) = [int(i) for i in input().split()]
if m == 1 and s == 0:
	print(0, 0, sep=' ')
elif m > 1 and s == 0:
	print(-1, -1, sep=' ')
elif m > s:
	min_ = ''
	len_ = s
	len_ -= 1
	curr = 0
	while curr < m - 1:
		k = min(9, len_)
		min_ = str(k) + min_
		curr += 1
		len_ -= k
	min_ = str(max(len_ + 1, 1)) + min_
	max_ = ''
	while s:
		k = min(9, s)
		max_ += str(k)
		s -= k
	max_ += '0' * (m - len(max_))
	print(min_, max_)
elif s > 9 * m:
	print(-1, -1)
else:
	max_ = ''
	len_ = s
	while len_:
		k = min(9, len_)
		max_ += str(k)
		len_ -= k
	if len(max_) < m:
		max_ += '0' * (m - len(max_))
	min_ = ''
	s -= 1
	curr = 0
	while curr < m - 1:
		k = min(9, s)
		min_ = str(k) + min_
		s -= k
		curr += 1
	min_ = str(max(s + 1, 1)) + min_
	print(min_, max_)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif 9 * m < s or (s < 1 and m > 1):
	print(-1, -1)
else:
	l = [0] * m
	scopy = s
	for i in range(m):
		if s < 0:
			break
		k = min(9, s)
		l[i] = str(k)
		s = s - k
	max_val = ''.join(l)
	l1 = ['0'] * m
	l1[0] = '1'
	s = scopy
	s = s - 1
	for i in range(m):
		if s <= 0:
			break
		k1 = min(9, s)
		if i != m - 1:
			l1[m - i - 1] = str(k1)
		else:
			l1[m - i - 1] = str(k1 + 1)
		s = s - k1
	min_val = ''.join(l1)
	print(min_val, max_val)


(m, s) = [int(i) for i in input().split()]
if m * 9 < s or (s == 0 and m != 1):
	x = -1
else:
	z = s // 9
	b = s % 9
	x = ''
	x += z * '9'
	if b != 0:
		x += str(b)
		z += 1
	x += (m - z) * '0'
if x == -1:
	y = -1
elif m == 1 and s == 0:
	y = 0
else:
	y = 0
	ma = 0
	for i in range(m):
		if i > 0:
			z = 0
		elif i == 0:
			z = 1
		for p in range(z, 10):
			if s - ma - p <= (m - i - 1) * 9:
				y = y * 10 + p
				ma += p
				break
print(y, x)


(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and m > 1):
	print('-1 -1')
else:
	s2 = s - 1
	m2 = m
	res1 = ''
	res2 = ''
	while m:
		res1 += str(min(9, s))
		s = max(0, s - 9)
		if m == 1:
			s2 += 1
		res2 = str(min(9, s2)) + res2
		s2 = max(0, s2 - 9)
		m -= 1
	print(res2, res1)


def can(m, s):
	return s <= 9 * m and s >= 0
mn = ''
ss = 0
(m, s) = map(int, input().split())
for i in range(m):
	for d in range(10):
		if can(m - i - 1, s - ss - d) and (d != 0 or i != 0 or m == 1):
			ss += d
			mn += str(d)
			break
	else:
		print(-1, -1)
		break
else:
	print(mn, end=' ')
	ss = 0
	mx = ''
	for i in range(m):
		for d in range(9, -1, -1):
			if can(m - i - 1, s - ss - d) and (d != 0 or i != 0 or m == 1):
				ss += d
				mx += str(d)
				break
		else:
			print(-1, -1)
			break
	else:
		print(mx)


(m, s) = list(map(int, input().split()))

def can(m, s):
	return s >= 0 and s <= 9 * m
sum_ = s
min_ = ''
for i in range(m):
	for d in range(10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, sum_ - d):
			min_ += str(d)
			sum_ -= d
			break
sum_ = s
max_ = ''
for i in range(m):
	for d in range(9, -1, -1):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, sum_ - d):
			max_ += str(d)
			sum_ -= d
			break
if min_.count('0') == len(min_) and min_.count('0') > 1 or min_ == '' or len(min_) < m:
	print(-1, -1)
else:
	print(min_, max_)


def get_max(sum, num, curr, length, dp):
	if sum == 0 and length == 0:
		return num
	elif sum < 0 or length < 0:
		return -1
	if sum > 0 and length == 0:
		return -2
	ans = -1
	for i in range(curr, -1, -1):
		ans = get_max(sum - i, num * 10 + i, i, length - 1, dp)
		if ans != -1:
			return ans
		elif ans == -2:
			return -2
	return ans

def get_min(max_num):
	if max_num == '-1':
		return -1
	min_num = max_num[::-1]
	if not (min_num[0] == '0' and len(min_num) > 1):
		return min_num
	lst = []
	isChange = False
	for num in min_num:
		if num != '0' and (not isChange):
			min_num2 = ord(num) - ord('1')
			lst.append('%d' % min_num2)
			isChange = True
		else:
			lst.append(num)
	lst[0] = '1'
	return ''.join(lst)
nums = input().split()
length = int(nums[0])
sum = int(nums[1])
max_num = str(get_max(sum, 0, 9, length, {}))
if len(max_num) != length or max_num == '-2':
	max_num = '-1'
min_num = get_min(max_num)
print(min_num, max_num)


import sys
import math
from collections import defaultdict

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()]

def fun1(m, s, c, no):
	l = []
	if c == m:
		l = [x for x in range(9, 0, -1)]
	else:
		l = [x for x in range(9, -1, -1)]
	if c <= 1 or s < 0:
		if s > 9 or s < 0:
			return -1
		else:
			no = no + str(s)
			return no
	else:
		v = 0
		for i in l:
			if s - i >= 0:
				no = no + str(i)
				return fun1(m, s - i, c - 1, no)
				break

def fun2(m, s, c, no):
	if c == m:
		if s > 9 or s < 0:
			return -1
		else:
			no = str(s) + no
			return no
	else:
		l = []
		l = [x for x in range(9, -1, -1)]
		v = 0
		for i in l:
			if s - i >= 1:
				no = str(i) + no
				return fun2(m, s - i, c + 1, no)
				break
		return no
(m, s) = read_int_line()
n = ''
n = fun1(m, s, m, n)
n1 = ''
n1 = fun2(m, s, 1, n1)
if n == None or n1 == None:
	print(-1, -1)
else:
	print(n1, n)


import math

def findmax(m, s):
	digits = list()
	if s == 0:
		if m == 1:
			return ['0']
		else:
			return ['-1']
	else:
		while m > 1:
			if s > 9:
				digits.append('9')
				s = s - 9
				m = m - 1
			else:
				digits.append(str(s))
				s = 0
				m = m - 1
		if s > 9:
			return ['-1']
		else:
			digits.append(str(s))
			return digits

def findmin(m, s):
	digits = list()
	if m == 1:
		if s <= 9:
			return [str(s)]
		else:
			return ['-1']
	elif s == 1:
		return ['1', '0' * (m - 1)]
	elif s == 0:
		return ['-1']
	elif m == math.ceil(s / 9):
		return [str(s % 9), '9' * (s // 9)]
	elif m > math.ceil(s / 9):
		digits.append('1')
		a = findmax(m - 1, s - 1)
		a.sort()
		return digits + a
	else:
		return ['-1']
n = input().split()
(m, s) = (int(n[0]), int(n[1]))
a = int(''.join(findmin(m, s)))
b = int(''.join(findmax(m, s)))
print(a, b, sep=' ')


(m, s) = map(int, input().split())
mi = ''
mx = ''
if s < 1 and m > 1 or s > 9 * m:
	print(-1, -1)
else:
	k = s
	for i in range(m - 1, -1, -1):
		a = max(0, k - i * 9)
		if a == 0 and i == m - 1 and k:
			a = 1
		mi += str(a)
		k -= a
	k = s
	for i in range(m):
		a = min(9, k)
		mx += str(a)
		k -= a
	print(mi, mx)


(m, s) = map(int, input().split())

def biggest_number(length, sum_digits):
	if length > 1 and sum_digits == 0 or length * 9 < sum_digits:
		return -1
	number = ''
	curr_digit = 0
	remaining_sum = sum_digits
	while remaining_sum > 0:
		number += str(min(remaining_sum, 9))
		remaining_sum -= min(remaining_sum, 9)
		curr_digit += 1
	if len(number) > length or sum([int(digit) for digit in number]) != sum_digits:
		return -1
	return number + '0' * (length - len(number))

def smallest_number(length, sum_digits):
	if length > 1 and sum_digits == 0 or length * 9 < sum_digits:
		return -1
	if length == 1 and sum_digits == 0:
		return 0
	number = [0 for i in range(length)]
	curr_digit = length - 1
	remaining_sum = sum_digits - 1
	while remaining_sum > 0 and curr_digit >= 0:
		number[curr_digit] = min(remaining_sum, 9)
		remaining_sum -= min(remaining_sum, 9)
		curr_digit -= 1
	if number[0] < 9 and sum(number) == sum_digits - 1:
		number[0] += 1
		return ''.join(map(str, number))
	else:
		return -1
print(smallest_number(m, s), biggest_number(m, s))


(n, s) = map(int, input().split())
if n == 1:
	if len(str(s)) == 1:
		print(s, s)
		exit()
if s > n * 9 or s == 0:
	print(-1, -1)
	exit()
ansmax = ''
stemp = s
while stemp - 9 > 0:
	ansmax += '9'
	stemp -= 9
if stemp > 0:
	ansmax += str(stemp)
while len(ansmax) < n:
	ansmax += '0'
ansmin = ''
stemp = s
while len(ansmin) < n:
	if stemp > 9:
		ansmin = ansmin + '9'
		stemp -= 9
	elif n - len(ansmin) > 1:
		ansmin = str(stemp - 1) + ansmin
		while len(ansmin) < n - 1:
			ansmin = '0' + ansmin
		ansmin = '1' + ansmin
	else:
		ansmin = str(stemp) + ansmin
print(ansmin, ansmax)


(x, y) = map(int, input().split())
if 9 * x < y:
	print(-1, -1)
	exit(0)
if y == 0:
	if x != 1:
		print(-1, -1)
	else:
		print(0, 0)
	exit(0)
mx = [0] * x
v = y
for n in range(x):
	p = 9
	if v > 9:
		v -= p
	else:
		p = v
		v = 0
	mx[n] += p
mx.sort(reverse=True)
mn = mx[::-1]
n = 0
while not mn[n]:
	n += 1
mn[n] -= 1
mn[0] += 1
a = ''
b = ''
for n in mn:
	a += str(n)
for n in mx:
	b += str(n)
print(a, b)


from math import *
(m, s) = map(int, input().split())
if s > 9 * m or (s == 0 and m != 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print(0, 0)
else:
	mn = '9' * ((s - 1) // 9)
	if len(mn) < m - 1:
		mn = str((s - 1) % 9) + mn
		mn = '0' * (m - len(mn) - 1) + mn
		mn = '1' + mn
	elif len(mn) == m - 1 and s % 9 != 0:
		mn = str(s % 9) + mn
	else:
		mn = '9' + mn
	print(mn)
	ncnt = s // 9
	mx = '9' * ncnt
	if s % 9 != 0:
		mx += str(s % 9)
	mx = mx + '0' * (m - len(mx))
	print(mx)


import sys
(m, s) = [int(x) for x in input().split()]
if m == 1 and s == 0:
	print('0 0')
	sys.exit()
if s == 0:
	print('-1 -1')
	sys.exit()
UPPER_BORDER = 10
LOWER_BORDER = -1
dp1 = [[UPPER_BORDER] * (s + 1) for x in range(m + 1)]
dp2 = [[LOWER_BORDER] * (s + 1) for x in range(m + 1)]
dp1[0][0] = 0
dp2[0][0] = 0
for mi in range(1, m + 1):
	for si in range(1, s + 1):
		for i in range(10):
			if si - i >= 0 and dp1[mi - 1][si - i] != UPPER_BORDER:
				dp1[mi][si] = i
				break
		for i in range(10):
			if si - 9 + i >= 0 and dp2[mi - 1][si - 9 + i] != LOWER_BORDER:
				dp2[mi][si] = 9 - i
				break
if dp1[m][s] == UPPER_BORDER:
	print('-1 -1')
else:
	(s1, s2) = ('', '')
	(mi, si) = (m, s)
	while mi > 0:
		s1 = str(dp1[mi][si]) + s1
		si -= dp1[mi][si]
		mi -= 1
	(mi, si) = (m, s)
	while mi > 0:
		s2 = str(dp2[mi][si]) + s2
		si -= dp2[mi][si]
		mi -= 1
	print(s2, end=' ')
	print(s1)


(m, s) = map(int, input().split())
zuida = 0
zuixiao = 0
weishu = m
qiuhe = s
if s == 0 and m > 1:
	print('-1 -1')
elif m == 1 and s == 0:
	print('0 0')
elif s > 9 * m:
	print('-1 -1')
else:
	while s > 9:
		zuida = zuida + 9 * 10 ** (m - 1)
		s = s - 9
		m = m - 1
	zuida = zuida + s * 10 ** (m - 1)
	m = weishu
	s = qiuhe
	s = s - 1
	b = 0
	while s >= 9:
		zuixiao = zuixiao + 9 * 10 ** b
		s = s - 9
		b = b + 1
	zuixiao = zuixiao + s * 10 ** b + 10 ** (m - 1)
	print(str(int(zuixiao)), str(int(zuida)))


(m, s) = map(int, input().split())
if s == 0 and m > 1 or m * 9 < s:
	print('-1 -1')
	exit()

def find_max(m, s):
	ans = [0] * m
	i = 0
	while s > 9:
		ans[i] = 9
		s -= 9
		i += 1
		if i == m and s > 0:
			print('-1 -1')
			exit()
	ans[i] += s
	ans_1 = ''.join([str(x) for x in ans])
	return ans_1

def find_min(m, s):
	ans = [1] + [0] * (m - 1)
	i = m - 1
	s -= 1
	while s > 9:
		ans[i] = 9
		s -= 9
		i -= 1
		if i == 0 and s > 8:
			print('-1 -1')
			exit()
	ans[i] += s
	ans_2 = ''.join([str(x) for x in ans])
	return ans_2
print(find_min(m, s), find_max(m, s))


(d, s) = list(map(int, input().split()))
maxsum = 9 * d
minsum = 1
flag = 1
maxl = list()
minl = list()
if d <= 0 or 9 * d < s or (d > 1 and s == 0):
	flag = 0
elif d == 1:
	maxl.append(s)
	minl.append(s)
else:
	nine = s // 9
	for _ in range(nine):
		maxl.append(9)
		minl.append(9)
	if nine < d:
		maxl.append(s % 9)
		for _ in range(d - nine - 1):
			maxl.append(0)
		if s % 9 == 0:
			minl[nine - 1] = 8
			for i in range(nine, d):
				if i == d - 1:
					minl.append(1)
				else:
					minl.append(0)
		elif nine == d - 1 and s % 9 != 0 and (s > 9):
			minl.append(s % 9)
		else:
			minl.append(s % 9 - 1)
			for i in range(nine + 1, d):
				if i == d - 1:
					minl.append(1)
				else:
					minl.append(0)
if flag != 0:
	for i in range(d):
		print(minl[d - i - 1], end='')
	print(' ', end='')
	for i in range(d):
		print(maxl[i], end='')
else:
	print('-1 -1')


n = input()
a = n.split()
b = int(a[0])
i = b
c = int(a[1])
l = 0
s = 0
if n == '1 0':
	print('0 0')
elif c > 9 * b or c == 0:
	print('-1 -1')
else:
	while i > 0:
		i -= 1
		if c - 9 >= 0:
			c = c - 9
			l = l + 9 * 10 ** i
		else:
			l = l + c * 10 ** i
			c = 0
	i = b
	c = int(a[1])
	for t in range(b):
		if c - 9 > 1:
			s = s + 9 * 10 ** t
			c = c - 9
		else:
			s = s + (c - 1) * 10 ** t
			c = 1
	s = s + 10 ** (b - 1)
	print(str(s) + ' ' + str(l))


(m, s) = map(int, input().split())
if s == 0 and m != 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	s -= 1
	num = [0] * m
	num[0] = 1
	n = s
	for i in range(m - 1, -1, -1):
		if n + num[i] >= 9:
			n -= 9 - num[i]
			num[i] = 9
		else:
			num[i] = num[i] + n
			n = 0
	for i in range(m):
		print(num[i], end='')
	print(' ', end='')
	n = s
	num = [0] * m
	num[0] = 1
	for i in range(m):
		if n + num[i] > 9:
			n -= 9 - num[i]
			num[i] = 9
		else:
			num[i] = num[i] + n
			n = 0
		print(num[i], end='')


def maxNumber(m, sumLeft):
	if sumLeft <= 0:
		return -1
	maxNumber = [0 for _ in range(m)]
	index = 0
	while sumLeft >= 9 and index < len(maxNumber):
		maxNumber[index] += 9
		sumLeft -= 9
		index += 1
	if sumLeft > 0 and index >= len(maxNumber):
		return -1
	elif sumLeft < 0:
		return -1
	elif sumLeft > 0:
		maxNumber[index] += sumLeft
	return int(''.join((str(i) for i in maxNumber)))

def minNumber(m, sumLeft):
	minNumber = [0 for _ in range(m)]
	minNumber[0] = 1
	sumLeft -= 1
	if sumLeft < 0:
		return -1
	index = m - 1
	while sumLeft >= 9 and index > 0:
		minNumber[index] += 9
		sumLeft -= 9
		index -= 1
	if index == 0 and sumLeft <= 8:
		minNumber[0] += sumLeft
		sumLeft = 0
	elif index == 0 and sumLeft >= 9:
		return -1
	elif index != 0 and sumLeft <= 9:
		minNumber[index] += sumLeft
		sumLeft = 0
	if sumLeft != 0:
		return -1
	return int(''.join((str(i) for i in minNumber)))
(m, s) = list(map(int, input().split(' ')))
if m == 1 and s == 0:
	print('0 0')
else:
	maxNum = maxNumber(m, s)
	minNum = minNumber(m, s)
	if maxNum == -1 or minNum == -1:
		print('-1 -1')
	else:
		print(str(minNum) + ' ' + str(maxNum))


def findLargest(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	res = [0] * m
	for i in range(0, m):
		if s >= 9:
			res[i] = 9
			s = s - 9
		else:
			res[i] = s
			s = 0
	st = ''
	for i in range(0, m):
		st = st + str(res[i])
	st = int(st)
	return st

def findSmallest(m, s):
	if s == 0:
		if m == 1:
			return 0
		else:
			return -1
	if s > 9 * m:
		return -1
	res = [0 for i in range(m + 1)]
	s -= 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			res[i] = 9
			s -= 9
		else:
			res[i] = s
			s = 0
	res[0] = s + 1
	st = ''
	for i in range(m):
		st = st + str(res[i])
	st = int(st)
	return st

def main():
	inp = list(map(int, input().split()))
	ans = [-1, -1]
	ans[0] = findSmallest(inp[0], inp[1])
	ans[1] = findLargest(inp[0], inp[1])
	if ans[1] == -1 and ans[0] != -1:
		ans[1] = ans[0]
	for i in range(len(ans) - 1):
		print(ans[i], end=' ')
	i += 1
	print(ans[i])
main()


(n, sum) = [int(i) for i in input().split()]
q = sum % 9
w = sum // 9
if sum == 0:
	if n == 1:
		print('0 0')
	else:
		print('-1 -1')
elif w < n - 1:
	if q != 0:
		print('1', '0' * (n - w - 2), q - 1, '9' * w, ' ', '9' * w, q, '0' * (n - w - 1), sep='')
	else:
		print('1', '0' * (n - w - 1), '8', '9' * (w - 1), ' ', '9' * w, '0' * (n - w), sep='')
elif w == n - 1:
	print(q, '9' * w, ' ', '9' * w, q, sep='')
elif q == 0 and w == n:
	print('9' * n, ' ', '9' * n, sep='')
else:
	print('-1 -1')


(n, m) = [int(i) for i in input().split()]
m2 = m
if n == 1 and m == 0:
	print(0, 0)
elif m == 0 or n * 9 < m:
	print(-1, -1)
else:
	max = 0
	for i in range(n):
		if m >= 9:
			max = max * 10 + 9
			m = m - 9
		else:
			max = max * 10 + m
			m = 0
	min = 0
	for i in range(n):
		if m2 > 9:
			min = min + 10 ** i * 9
			m2 = m2 - 9
		else:
			if m2 > 1:
				min = min + 10 ** i * (m2 - 1)
				m2 = 1
			if m2 == 1 and i == n - 1:
				min = min + 10 ** i * 1
	print(min, max)


from sys import stdin, stdout
import math
cin = stdin.readline
cout = stdout.write

def getNum(m, s):
	temp = ''
	for i in range(9, 0, -1):
		if not m:
			break
		for j in range(s // i, -1, -1):
			if s - i * j >= 0:
				s -= i * j
				m -= j
				temp += str(i) * j
				break
		if m < 0:
			return ''
	if s:
		return ''
	temp += '0' * m
	if temp == '0' * m and m > 1:
		return ''
	return temp
(m, s) = map(int, cin().split())
result = getNum(m, s)
if not result:
	cout('-1 -1')
elif result[-1] == '0' and len(result) > 1:
	if '1' in result:
		cout(result[result.index('1'):] + result[:result.index('1')][::-1] + ' ' + result)
	else:
		ind = result.index('0')
		ans = '1' + result[ind + 1:] + chr(ord(result[ind - 1]) - 1) + result[:ind - 1][::-1]
		cout(ans + ' ' + result)
else:
	cout(result[::-1] + ' ' + result)


(length, summ) = [int(x) for x in input().split()]
if summ == 0 and length == 1:
	print(0, 0)
elif summ > length * 9 or summ == 0:
	print(-1, -1)
else:
	maxx = [0] * length
	temp_sum = summ
	i = 0
	while temp_sum > 0:
		if temp_sum <= 9:
			maxx[i] = temp_sum
			break
		else:
			maxx[i] = 9
			i += 1
			temp_sum -= 9
	minn = list(maxx)
	minn.reverse()
	if minn[0] == 0:
		for i in range(len(minn)):
			if minn[i] != 0:
				minn[i] -= 1
				minn[0] = 1
				break
	for i in minn:
		print(i, end='')
	print(end=' ')
	for i in maxx:
		print(i, end='')


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 fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans
from math import *
for _ in range(1):
	(m, s) = map(int, input().split())
	if s == 0 and m > 1 or s > 9 * m:
		print(-1, -1)
	elif s == 0 and m == 1:
		print(0, 0)
	elif s == 1:
		ans = '1' + '0' * (m - 1)
		print(ans, ans)
	else:
		maxi = [0] * m
		mini = [0] * m
		check = s
		i = 0
		while check > 0:
			maxi[i] += min(check, 9)
			i += 1
			check -= min(check, 9)
		if maxi[-1] == 0:
			mini[0] = 1
			s -= 1
			i = m - 1
			while s > 0:
				mini[i] = min(s, 9)
				i -= 1
				s -= min(s, 9)
		else:
			mini = maxi[::-1]
		for i in range(m):
			print(mini[i], end='')
		print(' ', end='')
		for i in range(m):
			print(maxi[i], end='')
		print('')


def solve(m, s):
	if s == 0 and m > 1:
		return (-1, -1)
	if s == 0 and m == 1:
		return (0, 0)
	g = ''
	nines = '9' * (s // 9)
	remaining = str(s % 9)
	rest = remaining if remaining != '0' else ''
	cur_size = len(nines) + len(rest)
	if cur_size > m:
		return (-1, -1)
	g = nines + rest + '0' * (m - cur_size)
	l = g[::-1]
	if l[0] == '0':
		l = '1' + l[1:]
		for (i, v) in enumerate(l[1:], 1):
			if v != '0':
				l = l[:i] + str(int(v) - 1) + l[i + 1:]
				break
	return (l, g)

def main():
	(m, s) = list(map(int, input().split()))
	print(*solve(m, s))
main()


put = input().split()
l = int(put[0])
s = int(put[1])
if s == 0 and l == 1:
	print(0, 0)
	exit()
if s < 1 or s > 9 * l:
	print(-1, -1)
	exit()
a = [0] * l
b = [0] * l
i = 0
k = -1
if l > 1:
	a[0] = 1
	b[0] = 1
while True:
	if sum(a) == s:
		break
	if a[k] < 9:
		a[k] += 1
	else:
		k -= 1
while True:
	if sum(b) == s:
		break
	if b[i] < 9:
		b[i] += 1
	else:
		i += 1
for i in range(l):
	a[i] = str(a[i])
	b[i] = str(b[i])
a = ''.join(a)
b = ''.join(b)
print(a, b)


line = input().split()
m = int(line[0])
s = int(line[1])
if s == 0 and m != 1 or s > 9 * m:
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	y9 = (9 * m - s) % 9
	n9 = (9 * m - s) // 9
	re = str(9 - y9)
	nmax = '9' * (m - n9 - 1) + re + '0' * n9
	if nmax[m - 1] != '0':
		nmin = nmax[::-1]
		print(int(nmin), int(nmax))
	elif y9 != 0:
		re = str(8 - y9)
		nmin = '1' + '0' * (n9 - 1) + re + '9' * (m - n9 - 1)
		print(int(nmin), int(nmax))
	else:
		nmin = '1' + '0' * (n9 - 1) + '8' + '9' * (m - n9 - 1)
		print(int(nmin), int(nmax))


def small(m, s):
	if 9 * m < s or s == 0:
		return -1
	ans = ''
	for i in range(1, m + 1):
		for j in range(0, 10):
			if i == 1 and j == 0:
				continue
			if 9 * (m - i) >= s - j:
				ans += str(j)
				s -= j
				break
	return ans

def large(m, s):
	if 9 * m < s or s == 0:
		return -1
	ans = ''
	for i in range(1, m + 1):
		for j in range(9, -1, -1):
			if i == 1 and j == 0:
				continue
			if 9 * (m - i) >= s - j and s - j >= 0:
				ans += str(j)
				s -= j
				break
	return ans

def solve(m, s):
	if m == 1 and s == 0:
		return [0, 0]
	l = []
	l.append(small(m, s))
	l.append(large(m, s))
	return l
(m, s) = map(int, input().split())
l = solve(m, s)
for i in l:
	print(i, end=' ')


import sys
import time

def read_line(cast=None):
	if cast is not None:
		return cast(input().strip())
	else:
		return input().strip()

def read_list(cast=int):
	return list(map(cast, read_line().split()))

def solve(m, s):
	if s == 0 and m == 1:
		print('0 0')
		return
	if s == 0 and m > 1:
		print('-1 -1')
		return
	mem_s = s
	r = [0] * m
	r[0] = 1
	s -= 1
	if s == 0:
		t = ''.join(map(str, r))
		print(t + ' ' + t)
		return
	i = 0
	while i < m and s > 0:
		ov = r[m - 1 - i]
		r[m - 1 - i] += min(9 - ov, s)
		s -= r[m - 1 - i] - ov
		i += 1
	if s > 0:
		print('-1 -1')
		return
	t = ''.join(map(str, r))
	s = mem_s
	r = [0] * m
	i = 0
	while i < m and s > 0:
		ov = r[i]
		r[i] += min(9 - ov, s)
		s -= r[i] - ov
		i += 1
	if s > 0:
		print('-1 -1')
		return
	t2 = ''.join(map(str, r))
	print(t + ' ' + t2)
	return
(m, s) = read_list()
solve(m, s)


(m, s) = map(int, input().split())
largest = [9] * m
smallest = [1] + [0] * (m - 1)
largestSum = 9 * m
smallestSum = 1
if s == 0 and m == 1:
	print('0 0')
	exit()
if not (s >= smallestSum and s <= largestSum):
	print('-1 -1')
	exit()
for i in range(m)[::-1]:
	if largestSum > s:
		remaining = largestSum - s
		largest[i] = 9 - min(9, remaining)
		largestSum -= 9 - largest[i]
	if smallestSum < s:
		if i == 0:
			smallestSum -= 1
		remaining = s - smallestSum
		smallest[i] = min(9, remaining)
		smallestSum += smallest[i]
	if smallestSum == s and largestSum == s:
		print(''.join(map(str, smallest)), ''.join(map(str, largest)))
		break
else:
	print('-1 -1')


o = input().rstrip().split(' ')
a = int(o[0])
b = int(o[1])
N = a
M = b
if a == 1 and b > 9:
	print(-1, -1)
elif b == 0:
	if a == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif a * 9 < b:
	print(-1, -1)
else:
	b -= 1
	A = b // 9
	B = b - A * 9
	L = []
	if 1:
		for i in range(0, A):
			L.append('9')
		a -= A
		a -= 1
		for i in range(9, -1, -1):
			while a > 0 and i <= B:
				L.append(i)
				B = B - i
				a = a - 1
		if B == 0:
			L.append(1)
		else:
			L.append(B + 1)
		L.reverse()
		for i in range(0, len(L)):
			if i == len(L) - 1:
				print(L[i], end=' ')
			else:
				print(L[i], end='')
	A = M // 9
	B = M - A * 9
	a = N
	for i in range(0, A):
		print('9', end='')
	a -= A
	for i in range(9, -1, -1):
		while a > 0 and i <= B:
			print(i, end='')
			B = B - i
			a = a - 1


(a, b) = map(int, input().split())
s = []
if b == 0 and a == 1:
	print('0 0')
elif b == 0 or b / a > 9:
	print('-1 -1')
else:
	for i in range(a):
		if b > 9:
			s.append(9)
			b -= 9
		elif b > 0:
			s.append(b)
			b = 0
		else:
			s.append(0)
	if 0 not in s:
		s.sort()
		for i in range(a):
			print(s[i], end='')
	else:
		s.sort()
		print('1', end='')
		ff = 1
		for i in range(1, a):
			if ff == 1 and s[i] != 0:
				print(s[i] - 1, end='')
				ff = 0
			else:
				print(s[i], end='')
	print(' ', end='')
	s.sort(reverse=True)
	for i in range(a):
		print(s[i], end='')


(l, s) = map(int, input().split())
ma = 0
mi = 0
si = s - 1
maw = [9]
miw = [1] * l
if s == 0 and l != 1 or l == 0:
	ma = -1
	mi = -1
else:
	if s <= 9:
		ma = s * 10 ** (l - 1)
	elif s > l * 9:
		ma = -1
	else:
		ss = s - 9
		for i in range(1, l):
			if ss > 9:
				maw.append(9)
				ss -= 9
			else:
				maw.append(ss)
				ss = 0
		for i in range(l):
			ma += 10 ** (l - i - 1) * maw[i]
	if l == 1 and s <= 9:
		mi = s
	elif s == 1:
		mi = 10 ** (l - 1)
	elif s > l * 9:
		mi = -1
	elif l * 9 - 8 < s <= l * 9:
		miw = [9] * l
		miw[0] = s - 9 * (l - 1)
		for i in range(l):
			mi += 10 ** (l - 1 - i) * miw[i]
	else:
		for i in range(l):
			if si > 9:
				miw[l - 1 - i] = 9
				si -= 9
			elif si <= 9:
				miw[l - 1 - i] = si
				si = 0
		miw[0] = 1
		for i in range(l):
			mi += 10 ** (l - 1 - i) * miw[i]
print(mi, ma)


(n, m) = list(map(int, input().split()))
if m > n * 9:
	print(-1, -1)
elif m == 0 and n > 1:
	print(-1, -1)
elif n == 1 and m == 0:
	print(0, 0)
else:
	m1 = m
	large = [0] * n
	for i in range(n):
		if m >= 9:
			m -= 9
			large[i] = 9
		else:
			large[i] = m
			m = 0
	small = [0] * n
	m = m1
	for i in range(n - 1, -1, -1):
		if m > 9:
			small[i] = 9
			m -= 9
		elif m > 1:
			if i == 0:
				small[i] = m
			else:
				small[i] = m - 1
				small[0] = 1
				break
		elif m == 1:
			small[0] = 1
			break
	small = ''.join((str(e) for e in small))
	large = ''.join((str(e) for e in large))
	print(small, large)


[m, s] = list(map(int, input().strip().split()))
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	(largest, smallest) = (['0'] * m, ['0'] * m)
	(s1, s2) = (s, s)
	for idx in range(m):
		largest[idx] = str(min(s1, 9))
		s1 -= int(largest[idx])
	smallest[0] = str(max(1, s2 - 9 * (m - 1)))
	s2 -= int(smallest[0])
	for idx in range(1, m):
		smallest[idx] = str(max(0, s2 - 9 * (m - idx - 1)))
		s2 -= int(smallest[idx])
	print(''.join(smallest) + ' ' + ''.join(largest))


import math
(m, s) = [int(x) for x in input().split()]
if s == 0 and m == 1:
	print('0 0')
elif s < 1 or s > m * 9:
	print('-1 -1')
else:
	a = 0
	y = max(1, s - 9 * (m - 1))
	b = y * 10 ** (m - 1)
	n = math.ceil(s / 9)
	for i in range(n):
		x = s - 9 * i
		a += min(9, x) * 10 ** (m - i - 1)
	k = math.ceil((s - y) / 9)
	for i in range(k):
		b += min(9, s - y - 9 * i) * 10 ** i
	print(b, end=' ')
	print(a)


def valid(l, c):
	return l * 9 >= c
(m, s) = map(int, input().split())
if not valid(m, s) or (s == 0 and m > 1):
	print(-1, -1)
	exit()
(t, min_res) = (s, '')
for i in range(m):
	for d in range(10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and valid(m - i - 1, t - d):
			min_res += chr(ord('0') + d)
			t -= d
			break
k = s // 9
max_res = k * '9'
if k < m:
	max_res += chr(s % 9 + ord('0'))
	k += 1
if k < m:
	max_res += (m - k) * '0'
print(min_res, max_res)


l = input().split()
(n, s) = (int(l[0]), int(l[1]))
a = b = []
if 1 <= s <= 9 * n:
	a = [9] * (s // 9)
	if s % 9:
		a += [s % 9]
	d = n - len(a)
	if d:
		a += [0] * d
		b = a[::-1]
		b[0] = 1
		b[d] -= 1
	else:
		b = a[::-1]
	a = ''.join(map(str, a))
	b = ''.join(map(str, b))
	print(b, a)
elif s == 0 and n == 1:
	print('0 0')
else:
	print('-1 -1')


import math
(m, s) = [int(x) for x in input().split()]
x = math.ceil(s / 9)
if m < x or s <= 0:
	if s <= 0 and m == 1:
		print(str(0) + ' ' + str(0))
	else:
		print(str(-1) + ' ' + str(-1))
if s > 0:
	if m == x:
		a = s - 9 * (x - 1)
		min_a = str(a) + '9' * (x - 1)
		max_a = '9' * (x - 1) + str(a)
		print(str(min_a) + ' ' + str(max_a))
	if m > x:
		if m == x + 1:
			a = 1
			b = s - 1
			c = b - 9 * (x - 1)
			min_a = str(a) + str(c) + '9' * (x - 1)
		else:
			a = 1
			b = s - 1
			n = math.ceil(b / 9)
			zeroes = m - n - 1
			c = b - 9 * (x - 1)
			if c > 0:
				min_a = str(a) + '0' * zeroes + str(c) + '9' * (x - 1)
			if c <= 0:
				min_a = str(a) + '0' * zeroes + '9' * (x - 1)
		c = s - 9 * (x - 1)
		max_a = '9' * (x - 1) + str(c) + '0' * (m - x)
		print(str(min_a) + ' ' + str(max_a))


(n, s) = map(int, input().split())
minR = (s + 8) // 9
if minR > n or (s == 0 and n > 1):
	print(-1, -1, end=' ')
else:
	minZnac = int(str(s % 9) + '9' * (s // 9))
	lenMin = len(str(minZnac))
	if lenMin < n:
		minZnac -= 10 ** (lenMin - 1)
		lenMin = len(str(minZnac))
		print(1, '0' * (n - 1 - lenMin), minZnac, sep='', end=' ')
	else:
		print(minZnac, end=' ')
	print('9' * (s // 9), end='')
	n -= s // 9
	s %= 9
	if n > 0:
		print(str(s) + '0' * (n - 1))


(n, s) = tuple(map(int, input().split()))

def biggest(n, s):
	if s == 0 and n > 1 or s > 9 * n:
		return -1
	else:
		res = ''
		while s != 0:
			res += str(min(9, s))
			s -= min(9, s)
		res += '0' * (n - len(res))
	return res

def smallest(n, s):
	if s == 0 and n > 1 or s > 9 * n:
		return -1
	elif s == 0 and n == 1:
		return 0
	else:
		big = list(reversed(biggest(n, s)))
		if big[0] == '0':
			big[0] = '1'
			i = 1
			while big[i] == '0':
				i += 1
			big[i] = str(int(big[i]) - 1)
		return ''.join(big)
print(smallest(n, s), biggest(n, s))


import sys
input = sys.stdin.readline
(m, s) = map(int, input().split())
(big, samll) = ([], [])
if 1 <= s <= 9 * m:
	ss = s
	for i in range(m):
		v = min(9, ss)
		ss -= v
		big.append(v)
	samll = [*big]
	if samll[-1] == 0:
		last = -1
		for i in range(len(samll) - 1, -1, -1):
			if samll[i] != 0:
				last = i
				break
		samll[-1] = 1
		samll[last] -= 1
	print(*samll[::-1], sep='', end=' ')
	print(*big, sep='')
elif s == 0 and m == 1:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
flag = 0
if s == 0:
	if m == 1:
		ma = 0
		mi = 0
	else:
		flag = 1
elif s % 9 != 0:
	ma = 10 ** (s // 9) - 1
	if s % 9 != 0:
		ma = ma * 10 + s % 9
	if len(str(ma)) < m:
		ma = ma * 10 ** (m - len(str(ma)))
	if len(str(ma)) != m:
		flag = 1
	if flag != 1:
		d1 = s // 9
		d2 = s % 9
		if d1 + 1 == m:
			mi = d2 * 10 ** d1 + 10 ** d1 - 1
		else:
			mi = 10 ** (m - d1 - 1) + d2 - 1
			mi = mi * 10 ** d1 + 10 ** d1 - 1
else:
	d1 = s // 9
	ma = 10 ** d1 - 1
	if len(str(ma)) < m:
		ma = ma * 10 ** (m - len(str(ma)))
	if len(str(ma)) != m:
		flag = 1
	if flag != 1:
		if d1 == m:
			mi = ma
		else:
			mi = 10 ** (d1 - 1) - 1
			mi = 8 * 10 ** (d1 - 1) + mi
			mi = 10 ** (m - 1) + mi
if flag == 1:
	print('-1 -1')
else:
	print(mi, ma)


(m, s) = [int(x) for x in input().split()]
a = ''
b = ''
na = s
nb = s
if 9 * m < s or (s == 0 and m != 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	for i in reversed(range(m)):
		x = na
		if x <= 9 and i != 0:
			x -= 1
		y = nb
		if x >= 10:
			x = 9
		elif x < 0:
			x = 0
		if y >= 10:
			y = 9
		elif y < 0:
			y = 0
		a = str(x) + a
		na -= x
		b += str(y)
		nb -= y
	print(a + ' ' + b)


(m, k) = map(int, input().split())
A = list(str(k // m) * m)
A = list(map(int, A))
A[-1] += k % m
B = A[:]
if 9 * m < k or (sum(A) == 0 and len(A) > 1):
	print(-1, -1)
else:
	c = m - 1
	a = 0
	while a != c and a < m and (c >= 0) and (a < c):
		if a == 0:
			if A[0] - 1 == 0:
				a += 1
			elif A[c] + (A[0] - 1) > 9:
				s = A[c]
				A[c] += 9 - A[c]
				A[a] -= 9 - s
				c -= 1
			else:
				A[c] += A[0] - 1
				A[0] = 1
				if A[c] == 9:
					c -= 1
				a += 1
		elif A[a] == 0:
			a += 1
		elif A[c] + A[a] > 9:
			s = A[c]
			A[c] += 9 - A[c]
			A[a] -= 9 - s
			c -= 1
		else:
			A[c] += A[a]
			A[a] = 0
			if A[c] == 9:
				c -= 1
			a += 1
	for i in range(m):
		if i == 0:
			for j in range(i, m):
				if A[j] < A[i] and A[j] != 0:
					(A[i], A[j]) = (A[j], A[i])
		else:
			for j in range(i, m):
				if A[j] < A[i]:
					(A[i], A[j]) = (A[j], A[i])
	for i in A:
		print(i, end='')
	print(end=' ')
	M = sum(A)
	L = M // 9
	A = []
	for i in range(L):
		A.append(9)
	for i in range(m - L):
		A.append(0)
	A[-1] += M % 9
	A.sort(reverse=True)
	for i in A[:]:
		print(i, end='')


(m, s) = input().split()
(m, s) = (int(m), int(s))
if 9 * m < s or (s == 0 and m != 1):
	print(-1, -1)
else:
	lis = [0 for i in range(m)]
	q = int(s // 9)
	r = int(s % 9)
	if s == 0:
		print(0, 0)
	elif m == 1 and s == 9:
		print(9, 9)
	elif m == 2 and s == 18:
		print(99, 99)
	elif q == m - 1:
		for i in range(q):
			lis[i] = '9'
		lis[m - 1] = str(r)
		lis1 = lis[:]
		if r != 0:
			print(int(''.join(lis[::-1])), int(''.join(lis)))
		else:
			print(int(''.join(['1', '8'] + lis[::-1][2:m])), int(''.join(lis1)))
	elif q < m - 1:
		for i in range(q):
			lis[i] = '9'
		lis[q] = str(r)
		for i in range(q + 1, m):
			lis[i] = '0'
		lis1 = lis[:]
		if r != 0:
			lis[m - 1] = '1'
			lis[q] = str(r - 1)
			print(int(''.join(lis[::-1])), int(''.join(lis1)))
		else:
			lis[m - 1] = '1'
			lis[q - 1] = '8'
			print(int(''.join(lis[::-1])), int(''.join(lis1)))
	else:
		for i in range(m):
			lis[i] = '9'
		print(int(''.join(lis)), int(''.join(lis)))


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
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 MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

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

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

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 main():
	(m, s) = MI()
	if s == 0 and m != 1:
		pf('-1 -1')
	elif s == 0 and m == 1:
		pf('0 0')
	elif s > 9 * m:
		pf('-1 -1')
	else:
		ans = []
		while len(ans) < m:
			ans.append(min(9, s))
			s = s - min(9, s)
		mx_ans = JA(ans, '')
		mn_ans = ans[::-1]
		if mn_ans[0] == 0:
			for i in range(m):
				if mn_ans[i] != 0:
					mn_ans[i] -= 1
					break
			mn_ans[0] = 1
		mn_ans = JA(mn_ans, '')
		pf(mn_ans + ' ' + mx_ans)
main()


(m, s) = map(int, input(' ').split())
if s == 0 and m == 1:
	print(0, 0)
elif s > m * 9 or s == 0:
	print(-1, -1)
else:
	M = '9' * (s // 9)
	if s % 9 != 0:
		M += str(s % 9)
	M += '0' * (m - len(M))
	m = sorted(M)
	if m[0] == '0':
		i = 0
		while m[i] == '0':
			i += 1
		m = '1' + ''.join(m[1:i]) + chr(ord(m[i]) - 1) + ''.join(m[i + 1:])
	m = ''.join(m)
	print(m, M)


(m, s) = map(int, input().split())
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
else:
	big = ['0' for _ in range(m)]
	small = ['0' for _ in range(m)]
	s1 = s2 = s
	for i in range(m):
		if s1 > 9:
			big[i] = '9'
			s1 -= 9
		else:
			big[i] = str(s1)
			break
	if s2 == 0:
		small[0] = '0'
	elif s2 > (m - 1) * 9 + 1:
		small[0] = str(s2 - (m - 1) * 9)
		for i in range(1, m):
			small[i] = '9'
	else:
		small[0] = '1'
		s2 -= 1
		for i in reversed(range(1, m)):
			if s2 > 9:
				small[i] = '9'
				s2 -= 9
			else:
				small[i] = str(s2)
				break
	print(int(''.join(small)), int(''.join(big)))


(a, b) = map(int, input().split())
h = []
l = []
if b == 0 and a > 1:
	print('-1 -1')
elif b > a * 9:
	print('-1 -1')
elif a == 1:
	if b == 0:
		print(0, 0)
	elif b > 0 and b < 10:
		print(b, b)
	else:
		print('-1 -1')
elif b == a * 9:
	for i in range(a):
		l.append(9)
		h.append(9)
elif b == 1:
	l.append(1)
	h.append(1)
	for i in range(a - 1):
		l.append(0)
		h.append(0)
elif b <= 9:
	h.append(b)
	for i in range(1, a):
		h.append(0)
	l.append(1)
	for i in range(1, a - 1):
		l.append(0)
	l.append(b - 1)
else:
	p = a - b // 9 - 1
	if p == 0:
		l.append(b % 9)
		for i in range(a - 1):
			l.append(9)
		for i in range(a - 1):
			h.append(9)
		h.append(b % 9)
	else:
		l.append(1)
		if b % 9 == 0:
			for i in range(p):
				l.append(0)
			l.append(8)
			for i in range(b // 9 - 1):
				l.append(9)
		else:
			for i in range(p - 1):
				l.append(0)
			l.append(b % 9 - 1)
			for i in range(b // 9):
				l.append(9)
		for i in range(b // 9):
			h.append(9)
		h.append(b % 9)
		for i in range(p):
			h.append(0)
for i in l:
	print(i, end='')
print(end=' ')
for i in h:
	print(i, end='')


(m, s1) = list(map(int, input().split()))
if s1 == 0 and m > 1 or m * 9 < s1:
	print('-1 -1')
else:
	a = list((0 for i in range(m)))
	a[0] = 1
	s = s1 - 1
	for i in range(m):
		if s <= 9:
			a[m - i - 1] = s
			s = 0
		if s == 0:
			break
		if s > 9:
			a[m - i - 1] = 9
			s -= 9
	b = list((0 for i in range(m)))
	s = s1
	for i in range(m):
		if s <= 9:
			b[i] = s
			s = 0
		if s == 0:
			break
		if s > 9:
			b[i] = 9
			s -= 9
	if sum(a) != s1:
		a[0] += 1
	print(''.join(map(str, a)), ''.join(map(str, b)))


(n, m) = map(int, input().strip().split())
num = ''
sumi = m
if n == 1 and m == 0:
	print(0, 0)
else:
	while sumi:
		if sumi >= 9:
			num += '9'
			sumi -= 9
		else:
			num += str(sumi)
			sumi = 0
	if len(num) > n or n == 0 or m == 0:
		print(-1, -1)
	else:
		ans1 = num + '0' * (n - len(num))
		ans2 = ''
		if len(num) == n:
			ans2 = ''.join((num[i] for i in range(n - 1, -1, -1)))
		else:
			num = num[:-1] + str(int(num[-1]) - 1)
			ans2 = '1' + '0' * (n - (len(num) + 1)) + ''.join((num[i] for i in range(len(num) - 1, -1, -1)))
		print(ans2, ans1)


def f(m, s):
	if m == 1 and s < 10:
		return str(s)
	if m == 1 and s > 9:
		return 'F'
	if s > 9:
		return '9' + f(m - 1, s - 9)
	else:
		return str(s) + f(m - 1, 0)

def g(m, s):
	s1 = s
	L = list()
	if m == 1 and s < 10:
		return s
	if m == 1 and s > 9:
		return -1
	if s == 0:
		return -1
	while s1 > 9:
		L.append('9')
		s1 = s1 - 9
	if len(L) == m - 1:
		L.append(str(s1))
	else:
		L.append(str(s1 - 1))
		while len(L) < m - 1:
			L.append(str(0))
		L.append('1')
	L = L[::-1]
	ch = ''
	for c in L:
		ch += c
	return int(ch)
chaine = str(input())
liste = chaine.split()
m = int(liste[0])
s = int(liste[1])
mini = -1
maxi = -1
if f(m, s)[len(f(m, s)) - 1] != 'F' and s != 0:
	maxi = int(f(m, s))
mini = g(m, s)
if m == 1 and s == 0:
	(mini, maxi) = (0, 0)
if mini == -1 or maxi == -1:
	(mini, maxi) = (-1, -1)
print(str(mini) + ' ' + str(maxi))


line = input().split()
m = int(line[0])
sum = int(line[1])
if sum == 0:
	if m != 1:
		print(-1, -1)
	else:
		print(0, 0)
elif m * 9 < sum:
	print(-1, -1)
else:
	res = ''
	k = sum
	bit = 0
	while k > 9:
		res += '9'
		k -= 9
		bit += 1
	res += str(k)
	bit += 1
	if not bit == m:
		res += '0' * (m - bit)
	temp = ''
	if bit == m:
		for i in range(m):
			temp += res[m - i - 1]
		print('%s %s' % (temp, res))
	else:
		temp += '1'
		if m - bit >= 2:
			temp += '0' * (m - bit - 1)
		temp += str(int(res[bit - 1]) - 1)
		num = bit - 2
		while num >= 0:
			temp += res[num]
			num -= 1
		print('%s %s' % (temp, res))


(m, s) = map(int, input().split())
mi = [0] * m
ma = [0] * m
mi[0] = 1
k = s - 1
if s == 0 and m == 1:
	print(0, 0)
elif (s > 9 * m or s < 1) and m >= 1:
	print(-1, -1)
else:
	for i in range(m):
		r = min(9, k)
		k -= r
		mi[m - i - 1] += r
	k = s
	for i in range(m):
		r = min(9, k)
		k -= r
		ma[i] += r
	for i in range(m):
		ma[i] = str(ma[i])
		mi[i] = str(mi[i])
	print(''.join(mi), ''.join(ma))


inputs = input().split()
num_length = int(inputs[0])
digits_sum = int(inputs[1])
if digits_sum > 9 * num_length or (digits_sum == 0 and num_length > 1):
	print('-1 -1')
elif digits_sum == 0 and num_length == 1:
	print('0 0')
else:
	min_array = [1] + [0 for x in range(num_length - 1)]
	max_array = [1] + [0 for x in range(num_length - 1)]
	min_idx = num_length - 1
	max_idx = 0
	for x in range(1, digits_sum):
		if min_array[min_idx] == 9:
			min_idx -= 1
		min_array[min_idx] += 1
	for x in range(1, digits_sum):
		if max_array[max_idx] == 9:
			max_idx += 1
		max_array[max_idx] += 1
	print(''.join(map(str, min_array)) + ' ' + ''.join(map(str, max_array)))


def can(m, s):
	return s >= 0 and s <= 9 * m
(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print('0 0')
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	mins = ''
	maxs = ''
	x = s
	y = s
	for i in range(m):
		for j in range(10):
			if i == 0 and j == 0:
				continue
			if can(m - i - 1, x - j):
				x -= j
				mins += str(j)
				break
		for j in range(9, -1, -1):
			if can(m - i - 1, y - j):
				y -= j
				maxs += str(j)
				break
	print(mins, maxs)


line = input()
(m, s) = line.split()
m = int(m)
s = int(s)
ss = s - 1
a = []
b = []
big = ''
small = ''
if m == 1 and s == 0:
	print('0 0')
elif s > 9 * m or (s == 0 and m != 1):
	print('-1 -1')
else:
	for i in range(m):
		n = min(s, 9)
		if n >= 0:
			a.append(n)
		else:
			a.append(0)
		s = s - n
	for i in range(m, 0, -1):
		n = min(ss, 9)
		if n > 0:
			b.append(n)
		else:
			b.append(0)
		ss = ss - n
	if b[m - 1] > 0:
		b[m - 1] = b[m - 1] + 1
	else:
		b[m - 1] = 1
	for i in range(m - 1, -1, -1):
		big = big + str(b[i])
	for i in range(m):
		small = small + str(a[i])
	big = int(big)
	small = int(small)
	print(big, small)


line = input()
tokens = line.split()
(m, s) = (int(tokens[0]), int(tokens[1]))
if m == 1 and s <= 9:
	print(s, s)
	exit(0)
if s == 0 or s > m * 9:
	print(-1, -1)
	exit(0)
min_val = ''
ds = s
for i in range(m):
	d = max(0, ds - 9 * (m - i - 1))
	if i == 0:
		d = max(1, d)
	min_val += str(d)
	ds -= d
max_val = ''
ds = s
for i in range(m):
	d = min(9, ds)
	max_val += str(d)
	ds -= d
print(min_val, max_val)


(n, k) = map(int, input().split())
if n > 1 and k == 0 or k > 9 * n:
	print('-1 -1')
if n > 1 and k != 0 and (k <= 9 * n):
	m = k
	s1 = ''
	for i in range(n):
		if m >= 9:
			s1 += '9'
			m -= 9
		else:
			s1 += str(m)
			m = 0
	c = '1'
	i = n + 1
	for j in range(n):
		if s1[j] == '0' and i > n:
			i = j
	if i < n:
		s = s1[0:i - 1] + str(int(s1[i - 1]) - 1) + s1[i:n - 1] + '1'
	else:
		s = s1
	s = s[::-1]
	print(s + ' ' + s1)
if n == 1 and k < 10:
	print(k, k)


(m, c) = [int(i) for i in input().split()]
if c / m > 9:
	print(-1, -1)
elif c == 0 and m > 1:
	print(-1, -1)
elif c == 0 and m == 1:
	print(0, 0)
else:
	l = [0 for i in range(m)]
	l[0] = 1
	s = c
	s -= 1
	j = m - 1
	while s != 0 and j >= 0:
		if l[j] < 9 and s != 0:
			l[j] += 1
			s -= 1
			continue
		j -= 1
	s1 = ''
	for i in l:
		s1 += str(i)
	l1 = [0 for i in range(m)]
	k = 0
	s = c
	while s != 0 and k < m:
		if l1[k] < 9 and s != 0:
			l1[k] += 1
			s -= 1
			continue
		k += 1
	s2 = ''
	for i in l1:
		s2 += str(i)
	print(s1, s2)


n = input().split()
(m, s) = (int(n[0]), int(n[1]))
k = 0
o = 0
if s < 1 and m != 1 or s > 9 * m:
	print('-1 -1')
else:
	for i in range(1, m + 1):
		if s >= 9:
			k += 9 * 10 ** (m - i)
			s -= 9
		else:
			k += s * 10 ** (m - i)
			s = 0
	s = int(n[1])
	for i in range(m):
		if s > 9:
			o += 9 * 10 ** i
			s -= 9
		else:
			o += 10 ** (m - 1) + (s - 1) * 10 ** i
			break
	print(o, k)


(n, s) = map(int, input().split())
if s == 0 and n != 1 or s > 9 * n:
	print(-1, -1)
elif s < 10:
	if n == 1:
		print(s, s)
	else:
		print(1, end='')
		for i in range(n - 2):
			print(0, end='')
		print(s - 1, end=' ')
		print(s, end='')
		for i in range(n - 1):
			print(0, end='')
else:
	mod = s % 9
	div = s // 9
	if div >= n - 1:
		if mod != 0:
			print(mod, end='')
		for i in range(div):
			print(9, end='')
		print(' ', end='')
		for i in range(div):
			print(9, end='')
		if mod != 0:
			print(mod, end='')
	else:
		print(1, end='')
		if mod == 0:
			div0 = div - 1
		else:
			div0 = div
		for i in range(n - 2 - div0):
			print(0, end='')
		print((mod + 8) % 9, end='')
		for i in range(div0):
			print(9, end='')
		print(' ', end='')
		for i in range(div):
			print(9, end='')
		print(mod, end='')
		for i in range(n - 1 - div):
			print(0, end='')


(m, s) = [int(x) for x in input().split()]
(beg, end) = (pow(10, m - 1), int(str(9) * m))
S = s
if s == 0 and m == 1:
	print('0 0')
elif s > 9 * m or s == 0:
	print('-1 -1')
else:
	(mn, mx) = ([0] * m, [0] * m)
	mn[0] = 1
	s -= 1
	i = m - 1
	while s >= 10:
		mn[i] = 9
		s -= 9
		i -= 1
	mn[i] += s
	s = S
	i = 0
	while s >= 10:
		mx[i] = 9
		s -= 9
		i += 1
	mx[i] += s
	(ansmn, ansmx) = ('', '')
	for i in range(m):
		ansmn += str(mn[i])
		ansmx += str(mx[i])
	print(ansmn, ansmx)


(m, S) = map(int, input().split())
s = S
if m == 1 and 0 <= S <= 9:
	print(S, S)
elif s == 0 or s > 9 * m:
	print(-1, -1)
else:
	mn = [0] * m
	mn[0] = 1
	s -= 1
	for i in range(m - 1, -1, -1):
		if s > 0:
			if mn[i] + s > 9:
				mn[i] = 9
				s -= 9
			else:
				mn[i] = mn[i] + s
				s = 0
				break
	mx = [0] * m
	mx[0] = 1
	s = S - 1
	for i in range(m):
		if mx[i] + s > 9:
			s -= 9 - mx[i]
			mx[i] = 9
		else:
			mx[i] += s
			s = 0
			break
	for i in mn:
		print(i, end='')
	print(' ', end='')
	for i in mx:
		print(i, end='')


import sys

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

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

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

def sumofdigits(n):
	return sum([int(i) for i in str(n)])
(m, s) = rinput()
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 or s > m * 9:
	print(-1, -1)
else:
	cnt_9 = s // 9
	b = s - cnt_9 * 9
	if b != 0:
		high = '9' * cnt_9 + str(b) + '0' * (m - cnt_9 - 1)
		temp = ['9'] * cnt_9 + [str(b)] + ['0'] * (m - cnt_9 - 1)
		temp.reverse()
		if temp[0] == '0':
			temp[0] = '1'
			for i in range(1, len(temp)):
				if temp[i] > '0':
					temp[i] = str(int(temp[i]) - 1)
					break
		low = ''.join(temp)
	else:
		high = '9' * cnt_9 + '0' * (m - cnt_9)
		temp = ['9'] * cnt_9 + ['0'] * (m - cnt_9)
		temp.reverse()
		if temp[0] == '0':
			temp[0] = '1'
			for i in range(1, len(temp)):
				if temp[i] > '0':
					temp[i] = str(int(temp[i]) - 1)
					break
		low = ''.join(temp)
	print(int(low), int(high))


def findmax(n, s):
	a = []
	for i in range(n):
		if s >= 9:
			a.append(9)
			s -= 9
		else:
			a.append(s)
			break
	for i in range(len(a), n):
		a.append(0)
	s1 = ''
	for i in a:
		s1 += str(i)
	return s1

def findmin(n, s):
	s = s - 1
	a = [0] * n
	for i in range(n - 1, 0, -1):
		if s >= 9:
			a[i] = 9
			s -= 9
		else:
			a[i] = s
			s = 0
	a[0] = 1 + s
	s1 = ''
	for i in a:
		s1 += str(i)
	return s1
(n, s) = map(int, input().split())
flag = 1
if s <= n * 9 and s > 0:
	s1 = findmin(n, s)
	s2 = findmax(n, s)
	print(s1, s2)
elif n == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
if m == 1 and s <= 9:
	print(s, s)
elif s == 0 or s > 9 * m:
	print('-1 -1')
else:
	n_9 = s // 9
	yu = s % 9
	if n_9 == m:
		print(m * '9', m * '9')
	elif n_9 == m - 1:
		if yu == 0:
			print('18' + (n_9 - 1) * '9', n_9 * '9' + str(yu))
		else:
			print(str(yu) + n_9 * '9', n_9 * '9' + str(yu))
	elif yu == 0:
		print('1' + '0' * (m - 1 - n_9) + '8' + (n_9 - 1) * '9', n_9 * '9' + (m - n_9) * '0')
	else:
		print('1' + '0' * (m - 2 - n_9) + str(yu - 1) + n_9 * '9', n_9 * '9' + str(yu) + (m - n_9 - 1) * '0')


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif 9 * m < s or s == 0:
	print('-1 -1')
else:
	k = (s - 1) // 9
	r = s - k * 9
	l = '9' * k
	z = m - len(l)
	a = ('1' if z > 1 else '') + '0' * (z - 2) + (str(r - 1) if z > 1 else str(r)) + l
	b = l + str(r) + '0' * (z - 1)
	print(a, b)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]

def cal(n, s):
	ans = [0] * n
	for i in range(n):
		if s >= 9:
			ans[i] = 9
			s -= 9
		else:
			ans[i] += s
			break
	return ans
(n, s) = value()
if 9 * n < s or (s == 0 and n != 1):
	print(-1, -1)
	exit()
elif s == 0:
	print(0 * n, 0 * n)
	exit()
elif s < n:
	ans = '1'
	ans1 = '1' * (s - 1) + '0' * (n - s)
	print('1', *cal(n - 1, s - 1)[::-1], ' ', *cal(n, s), sep='')
	exit()
k = 1
if s - 1 > 9 * (n - 1):
	k += s - 1 - 9 * (n - 1)
ans = cal(n - 1, s - k)[::-1]
print(k, *cal(n - 1, s - k)[::-1], sep='', end=' ')
print(*cal(n, s), sep='')


def GivenLengthAndSumOfDigits(m, s):
	isPossible = NumberExists(m, s)
	if s == 0 and m == 1:
		return (str(0), str(0))
	if isPossible:
		smallest = FindSmallestNumber(m, s)
		largest = FindLargestNumber(m, s)
		return (smallest, largest)
	else:
		return (str(-1), str(-1))

def NumberExists(m, s):
	if s > 0 and s <= 9 * m:
		return True
	else:
		return False

def FindSmallestNumber(m, s):
	smallest = [0] * m
	while s > 0:
		i = 9
		while i >= 1:
			if s >= i:
				smallest[m - 1] = i
				s -= i
				m -= 1
				if m != 0 and s == 0:
					smallest[0] = 1
					smallest[m] -= 1
				break
			i -= 1
	result = ''.join((str(x) for x in smallest))
	return result

def FindLargestNumber(m, s):
	largest = [0] * m
	d = 0
	while s > 0 and d < m:
		i = 9
		while i >= 1:
			if s >= i:
				largest[d] = i
				s -= i
				d += 1
				break
			i -= 1
	result = ''.join((str(x) for x in largest))
	return result
(m, s) = [int(x) for x in input().split()]
(smallest, largest) = GivenLengthAndSumOfDigits(m, s)
print(smallest + ' ' + largest)


(n, m) = map(int, input().split())
if n == 1 and m <= 9 * n:
	print(str(m) + ' ' + str(m))
elif m == 0 or m > 9 * n:
	print('-1 ' + '-1')
else:
	a = m // 9
	b = m % 9
	if a == 0:
		x = str(b) + (n - 1) * '0'
	elif m == 9 * n:
		x = n * '9'
	else:
		x = a * '9' + str(b) + (n - 1 - a) * '0'
	if m >= 9 * n - 8:
		y = str(m + 9 - 9 * n) + (n - 1) * '9'
	else:
		m = m - 1
		n = n - 1
		c = m // 9
		d = m % 9
		if c == 0:
			y = '1' + (n - 1) * '0' + str(d)
		elif m == 9 * n:
			y = '1' + n * '9'
		else:
			y = '1' + (n - 1 - c) * '0' + str(d) + c * '9'
	print(y + ' ' + x)


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif m * 9 < s:
	print(-1, -1)
else:
	max_ = [0] * m
	min_ = [0] * m
	i = 0
	while sum(max_) < s:
		chng = min(9, s - sum(max_))
		max_[i] = chng
		i += 1
	i = -1
	min_[0] = 1
	while sum(min_) < s:
		chng = min(9, s - sum(min_))
		min_[i] += chng
		i -= 1
	print(*min_, sep='', end=' ')
	print(*max_, sep='')


(m, s) = map(int, input().split())
if m * 9 < s or (s == 0 and m != 1):
	print('-1 -1')
else:
	minimum = [0] * m
	for i in range(1, s // 9 + 1):
		minimum[-i] = 9
	if s % 9 != 0:
		minimum[-(s // 9) - 1] = s % 9
	maximum = sorted(minimum, reverse=True)
	if minimum[0] == 0:
		for j in range(1, m):
			if minimum[j] != 0:
				minimum[0] = 1
				minimum[j] -= 1
				break
	print(''.join(map(str, minimum)))
	print(''.join(map(str, maximum)))


a = input().split()
m = int(a[0])
s = int(a[1])
nein = s // 9
r = s % 9
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 and m > 1:
	print(-1, -1)
elif nein > m:
	print(-1, -1)
elif nein == m and r > 0:
	print(-1, -1)
elif nein == m and r == 0:
	b = 0
	for i in range(m):
		b += 9 * 10 ** i
	print(b, b)
else:
	bmin = 0
	bmax = 0
	if r > 0 and nein == m - 1:
		for i in range(nein):
			bmax += 9 * 10 ** (m - i - 1)
			bmin += 9 * 10 ** i
		print(bmin + r * 10 ** nein, bmax + r * 10 ** (m - nein - 1))
	elif r > 0 and nein < m - 1:
		for i in range(nein):
			bmax += 9 * 10 ** (m - i - 1)
			bmin += 9 * 10 ** i
		print(bmin + (r - 1) * 10 ** nein + 10 ** (m - 1), bmax + r * 10 ** (m - nein - 1))
	else:
		for i in range(nein):
			bmax += 9 * 10 ** (m - i - 1)
		for i in range(nein - 1):
			bmin += 9 * 10 ** i
		bmin += 8 * 10 ** (nein - 1)
		bmin += 10 ** (m - 1)
		print(bmin, bmax)


from sys import stdin

def find_largest(m, s):
	arr = [9] * m
	for i in range(m - 1, -1, -1):
		arr[i] = 0
		if sum(arr) > s:
			continue
		else:
			j = i
			while sum(arr) != s:
				arr[j] += 1
				if arr[j] == 10:
					return [-1]
			return arr
	else:
		return [-1]

def find_smallest(m, s):
	arr = [0] * m
	arr[0] = 1
	for i in range(m - 1, -1, -1):
		arr[i] = 9
		if sum(arr) < s:
			continue
		else:
			j = i
			while sum(arr) != s:
				arr[j] -= 1
				if arr[j] == -1:
					return [-1]
			return arr
	else:
		return [-1]
(m, s) = list(map(int, stdin.readline().split()))
if s == 0:
	if m == 1:
		print(0, 0)
		exit()
	print(-1, -1)
	exit()
l = find_largest(m, s)
s = find_smallest(m, s)
for i in range(len(s)):
	print(s[i], end='')
print(' ', end='')
for i in range(len(l)):
	print(l[i], end='')


(m, s) = map(int, input().split())
min = [0 for x in range(101)]
max = [0 for x in range(101)]
if s == 0 and m != 1:
	print('-1 -1')
elif 9 * m < s:
	print('-1 -1')
else:
	temp = s
	pos = m
	while s > 0:
		if s > 9:
			min[pos] = 9
			s -= 9
		else:
			min[pos] = s - 1
			min[1] += 1
			s = 0
		pos -= 1
	s = temp
	pos = 1
	while s > 0:
		if s > 9:
			max[pos] = 9
			s -= 9
			pos += 1
		else:
			max[pos] = s
			s = 0
	for i in range(1, m + 1):
		print(min[i], end='')
	print(' ', end='')
	for i in range(1, m + 1):
		print(max[i], end='')


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
elif s == 0 and m > 1:
	print(-1, -1)
elif m * 9 < s:
	print(-1, -1)
else:
	temp = s
	big = []
	while s != 0:
		if s - 9 < 0:
			big.append(str(s))
			rem = s
			break
		else:
			big.append('9')
			s -= 9
	zer = m - len(big)
	big += ['0'] * zer
	if zer == 0:
		troll = big[::-1]
	else:
		troll = big[::-1]
		troll[0] = '1'
		troll[zer] = str(int(troll[zer]) - 1)
	print(''.join(troll), ''.join(big))


import math
p = [int(i) for i in input().split()]
q = []
s = p[1] / 9
if s > p[0] or (p[1] == 0 and p[0] != 1):
	q = [-1, -1]
elif s <= p[0]:
	t = math.floor(s)
	b = (10 ** t - 1) * 10 ** (p[0] - t) + math.floor((p[1] - 9 * t) * 10 ** (p[0] - t - 1))
	if b % 10 != 0:
		a = math.floor((p[1] - 9 * t) * 10 ** (p[0] - 1) + (10 ** t - 1))
	elif t == 0:
		a = 10 ** (p[0] - 1) + p[1] - 1
	else:
		x = 10 ** (t - 1) - 1
		if x < 0:
			x = 0
		if s == t:
			a = math.floor(10 ** (p[0] - 1) + 8 * 10 ** (t - 1) + x)
		else:
			a = math.floor(10 ** (p[0] - 1) + (p[1] - 9 * t - 1) * 10 ** t + 10 ** t - 1)
	q.append(a)
	q.append(b)
for i in q:
	print(i, end=' ')


class killme(Exception):

	@classmethod
	def ssss(self):
		print(-1, -1)
(m, n) = map(int, input().split())
try:
	if 9 * m < n or (n == 0 and m > 1):
		raise killme()
	else:
		nine = n // 9
		last = n % 9
		if m == 1:
			a = n
			b = n
		elif nine == m:
			a = '9' * nine
			b = a
		elif nine + 1 == m:
			a = '9' * nine + str(last)
			b = a[::-1]
		else:
			a = '9' * nine + str(last) + '0' * (m - nine - 1)
			if last > 0:
				b = '1' + '0' * (m - 2 - nine) + str(last - 1) + '9' * nine
			elif nine > 0:
				b = '1' + '0' * (m - 1 - nine) + '8' + '9' * (nine - 1)
			else:
				b = '1' + '0' * (m - 2) + str(last - 1)
	print(int(b), int(a))
except killme:
	killme.ssss()


(m, s) = map(int, input().split())
if m != 1:
	if s > 9 and s <= m * 9:
		answerupper = str(9) * (s // 9) + str(s % 9) + str(0) * (m - s // 9 - 1)
		if (s - 1) // (m - 1) < 9:
			answerlower = str(1) + str(0) * (m - (s - 1) // 9 - 2) + str((s - 1) % 9) + str(9) * ((s - 1) // 9)
		elif s % 9 != 0:
			answerlower = str(s % 9) + str(9) * (s // 9)
		else:
			answerlower = str(9) * (s // 9)
		if len(answerupper) > m:
			answerupper = answerupper.strip(answerupper[len(answerupper) - 1])
		else:
			answerupper = answerupper
		print(answerlower, answerupper)
	elif s <= 9 and s > 0:
		answerupper = str(s) + str(0) * (m - 1)
		answerlower = str(1) + str(0) * (m - 2) + str(s - 1)
		print(answerlower, answerupper)
	else:
		print('%d %d' % (-1, -1))
if m == 1:
	if s > 9:
		print('%d %d' % (-1, -1))
	else:
		print(s, s)


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


(m, s) = [int(a) for a in input().split()]
maxx = ''
minn = ''
s1 = s
s2 = s - 1
if s == 0 and m == 1:
	print(0, 0)
elif s > 9 * m or s < 1:
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	for a in range(m):
		if s1 > 9:
			maxx += str(9)
			s1 -= 9
		elif s1 == 0:
			maxx += str(0)
		else:
			maxx += str(s1)
			s1 = 0
	for a in range(m - 1):
		if s2 > 9:
			minn = str(9) + minn
			s2 -= 9
		elif s2 == 0:
			minn = str(0) + minn
		else:
			minn = str(s2) + minn
			s2 = 0
	minn = str(s2 + 1) + minn
	print(minn, maxx)


def main():
	(m, s) = map(int, input().split())
	if s < 1 and m > 1 or s > 9 * m:
		print('-1 -1')
		return
	maxi = []
	subs = s
	for i in range(m):
		if subs >= 9:
			maxi.append('9')
			subs -= 9
		else:
			maxi.append(str(subs))
			subs -= subs
	mini = list(reversed(maxi))
	if len(mini) > 1:
		if mini[0] == '0':
			mini[0] = '1'
			for i in range(1, m):
				if mini[i] != '0':
					mini[i] = str(int(mini[i]) - 1)
					break
	print(''.join(mini) + ' ' + ''.join(maxi))
main()


a = input().split()
m = int(a[0])
n = int(a[1])
p = m
u = m
t = n
if n == 0 and m != 1 or n > 9 * m:
	print('-1 -1')
elif n == 0 and m == 1:
	print('0 0')
else:
	l = []
	while m > 0 and n > 9:
		l.append(9)
		n = n - 9
		m = m - 1
	l.append(n)
	if m > 1:
		for i in range(0, m - 1):
			l.append(0)
	y = 0
	for i in range(0, p):
		y += l[i] * 10 ** (p - 1 - i)
	lit = []
	while u > 0 and t > 9:
		lit.append(9)
		u = u - 1
		t = t - 9
	if u == 1:
		lit.append(t)
	elif u > 2:
		lit.append(t - 1)
		for i in range(0, u - 2):
			lit.append(0)
		lit.append(1)
	else:
		lit.append(t - 1)
		lit.append(1)
	x = 0
	for i in range(0, p):
		x += lit[i] * 10 ** i
	print(x, end=' ')
	print(y)


(m, s) = map(int, input().split(' '))
c_s = s - 1
if s > m * 9 or (s < 1 and m != 1):
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	mx_c = []
	for d in range(9, 0, -1):
		while s >= d:
			s -= d
			mx_c.append(str(d))
	for n in range(m - len(mx_c)):
		mx_c.append('0')
	mn_c = []
	for d in range(9, 0, -1):
		while c_s >= d:
			c_s -= d
			mn_c.insert(0, str(d))
	for n in range(m - len(mn_c) - 1):
		mn_c.insert(0, '0')
	print(int(''.join(mn_c)) + 10 ** (m - 1), int(''.join(mx_c)))


(m, s) = map(int, input().split())
a = s
b = s
c = []
d = []
f = []
if s == 0 and m == 1:
	print('0 ' * 2)
elif 9 * m < s or s == 0:
	print('-1 ' * 2)
else:
	while b > 0:
		d.append(min(b, 9))
		b -= min(b, 9)
	d.reverse()
	if len(d) == m:
		print(*d, sep='', end=' ')
	elif len(d) == 1:
		d[0] -= 1
		print('1', '0' * (m - 2), *d, sep='', end=' ')
	else:
		d[0] -= 1
		print('1', '0' * (m - len(d) - 1), *d[0:len(d)], sep='', end=' ')
	while a > 0:
		c.append(min(a, 9))
		a -= min(a, 9)
	print(*c, '0' * (m - len(c)), sep='')


import sys
(m, s) = [int(i) for i in input().split()]
if s < 1:
	if m == 1:
		print('0 0')
		sys.exit(0)
	else:
		print('-1 -1')
		sys.exit(0)
l1 = ''
s1 = s
for i in range(m):
	if s1 == 0:
		l1 += str(s1)
	elif s1 < 9:
		l1 += str(s1)
		s1 = 0
	else:
		l1 += str(9)
		s1 -= 9
if s1 > 0:
	print('-1 -1')
	sys.exit(0)
l2 = ''
s2 = s - 1
for i in range(m - 1):
	if s2 == 0:
		l2 += str(s2)
	elif s2 < 9:
		l2 += str(s2)
		s2 = 0
	else:
		l2 += str(9)
		s2 -= 9
if s2 == 0:
	l2 += '1'
else:
	l2 += str(1 + s2)
l2 = l2[::-1]
print(l2, l1)


(n, s) = map(int, input().split())
top = ''
if s > 9 * n or (s == 0 and n > 1):
	print(-1, -1)
else:
	a = s
	for i in range(n - 1, -1, -1):
		num = max(0, a - 9 * i)
		if a > 0 and i == n - 1 and (num == 0):
			num = 1
		top += str(num)
		a -= num
	a = s
	top += ' '
	for i in range(1, n + 1):
		num = min(9, a)
		top += str(num)
		a -= num
	print(top)


line = input()
temp = line.split()
m = int(temp[0])
s = int(temp[1])
if s == 0:
	if m != 1:
		print('-1 -1')
	else:
		print('0 0')
elif 9 * m < s:
	print('-1 -1')
elif m == 1:
	print(s, end=' ')
	print(s)
else:
	s1 = s
	a = [0 for i in range(m)]
	b = [0 for i in range(m)]
	i = m
	while s > 9:
		i -= 1
		a[i] = 9
		s -= 9
	if i == 1:
		a[0] = s
	elif i >= 2:
		a[0] = 1
		a[i - 1] = s - 1
	i = -1
	s = s1
	while s > 9:
		i += 1
		b[i] = 9
		s -= 9
	if i == m - 2:
		b[m - 1] = s
	elif i < m - 2:
		b[i + 1] = s
	for i in range(m - 1):
		print(a[i], end='')
	print(a[m - 1], end=' ')
	for i in range(m):
		print(b[i], end='')


def get(m, s):
	lis_1 = ['0' for i in range(m)]
	lis_2 = ['0' for i in range(m)]
	s_1 = s
	for i in range(m):
		if s >= 9:
			lis_1[i] = '9'
			s -= 9
		else:
			lis_1[i] = str(s)
			break
	s = s_1
	if s > (m - 1) * 9:
		lis_2 = [str(s - (m - 1) * 9)] + ['9' for j in range(m - 1)]
	else:
		lis_2[0] = '1'
		b = s - 1
		for i in range(1, m):
			if b >= 9:
				lis_2[-i] = '9'
				b -= 9
			else:
				lis_2[-i] = str(b)
				break
	result_1 = ''.join(lis_1)
	result_2 = ''.join(lis_2)
	return (result_2, result_1)
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > m * 9:
	print(-1, -1)
else:
	(a, b) = get(m, s)
	print(a, b)


(m, s) = map(int, input().split())
if s == 0 or s > 9 * m:
	if s == 0 and m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	sg = sd = s
	cmin = cmax = ''
	for i in range(m):
		c = 1 if i == 0 else 0
		g = max(c, sg - 9 * (m - i - 1))
		sg -= g
		d = min(9, sd)
		sd -= d
		cmin += str(g)
		cmax += str(d)
	print(cmin, cmax)


(n, sm) = input().strip().split(' ')
n = int(n)
sm = int(sm)
por1 = sm // 9
por = por1
ost = sm % 9
if ost != 0:
	por += 1
if por > n or (por <= 0 and n > 1):
	print('-1 -1')
elif por == n:
	print(ost + (1 + por1 - por) * 9, end='')
	for i in range(n - 1):
		print(9, end='')
	print(end=' ')
	for i in range(n - 1):
		print(9, end='')
	print(ost + (1 + por1 - por) * 9, end='')
else:
	if sm != 0:
		print(1, end='')
	else:
		print(0, end='')
	for i in range(n - por - 1):
		print(0, end='')
	if por != por1:
		print(ost - 1, end='')
		for i in range(por1):
			print(9, end='')
	else:
		if sm != 0:
			print(8, end='')
		for i in range(por - 1):
			print(9, end='')
	print(end=' ')
	for i in range(por1):
		print(9, end='')
	print(ost, end='')
	for i in range(n - por1 - 1):
		print(0, end='')


import sys
import collections
import math
import functools
import itertools
import bisect
import operator
import heapq
import random
true = True
false = False
null = None
tcid = 0
tcmax = 99999999

def seq(lo, hi, step=1):
	return range(lo, hi + 1, step)

def sround(val, nd):
	return f'{val:.{nd}f}'

def ceil(a, b):
	ans = a // b
	if a % b != 0:
		ans += 1
	return ans

def perr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def line():
	ln = sys.stdin.readline().strip()
	if ln == '':
		sys.exit()
	return ln

def lines(n):
	return [line() for i in range(n)]

def split(ln=None):
	return (ln or line()).split()

def nums(o=None):
	if o is not None:
		if isinstance(o, int):
			o = lines(o)
		elif isinstance(o, str):
			o = split(o)
	return list(map(eval, o or split()))

def num():
	return eval(line())

def mainloop(tcid=1):
	(m, x) = nums()

	@functools.lru_cache(None)
	def rec(mm, xx, isSmall):
		if xx < 0:
			return -1
		if mm == 0:
			return 0 if xx == 0 else -1
		zeros = 10 ** (mm - 1)
		for dd in range(10) if isSmall else range(9, -1, -1):
			if dd == 0 and mm == m and (m != 1):
				continue
			tmp = rec(mm - 1, xx - dd, isSmall)
			if tmp >= 0:
				return dd * zeros + tmp
		return -1
	print(rec(m, x, True), rec(m, x, False))
while tcid < tcmax:
	tcid += 1
	mainloop(tcid)


def findLargest(m, s):
	if (s + 8) // 9 > m or (s == 0 and m >= 2):
		largest = '-1'
	elif m > s // 9:
		largest = '9' * (s // 9) + str(s % 9) + '0' * (m - s // 9 - 1)
	else:
		largest = '9' * (s // 9)
	return largest
(m, s) = input().split()
(m, s) = (int(m), int(s))
largest = findLargest(m, s)
if largest == '-1':
	print('-1 -1')
else:
	if s == 0:
		smallest = '0'
	elif s == 1 and m >= 2:
		smallest = '1' + '0' * (m - 1)
	else:
		smallest = findLargest(m, s - 1)[::-1]
		smallest = str(int(smallest[0]) + 1) + smallest[1:]
	print(smallest + ' ' + largest)


ms = [int(i) for i in input().split()]
if ms[1] == 0:
	if ms[0] == 1:
		print('0 0')
	else:
		print('-1 -1')
elif ms[0] * 9 < ms[1]:
	print('-1 -1')
elif ms[0] == 1:
	print(ms[1], ms[1])
else:
	num = []
	for i in range(ms[1] // 9):
		num.append(9)
	if ms[1] % 9 != 0:
		num.append(ms[1] % 9)
	if len(num) == ms[0]:
		print(''.join([str(num) for num in num][::-1]), ''.join([str(num) for num in num]))
	else:
		mind = num[::-1]
		if mind[0] != 0:
			mind[0] -= 1
		else:
			mind[1] -= 1
		for i in range(ms[0] - len(num)):
			num.append(0)
			if i != 0:
				mind.insert(0, 0)
		mind.insert(0, 1)
		print(''.join([str(mind) for mind in mind]), ''.join([str(num) for num in num]))


(m, s) = map(int, input().split())
if 9 * m < s or (s == 0 and m > 1):
	print(-1, -1)
elif s == 0:
	print(0, 0)
else:
	dig9 = (s - 1) // 9
	redun = s - 9 * dig9
	if dig9 <= m - 2:
		mini = '1' + (m - 2 - dig9) * '0' + str(redun - 1) + dig9 * '9'
	else:
		mini = str(redun) + dig9 * '9'
	maxi = dig9 * '9' + str(redun) + (m - dig9 - 1) * '0'
	print(mini, maxi)


(length, sum_digits) = [int(a) for a in input().strip().split()]
l_num = 1 * 10 ** (length - 1)
lnum_list = [int(a) for a in str(l_num)]
if sum_digits > length * 9 or sum_digits == 0:
	if sum_digits == 0 and length == 1:
		print('0 0')
	else:
		print('-1 -1')
elif sum_digits == 1:
	num = 1 * 10 ** (length - 1)
	print(f'{num} {num}')
else:
	for i in range(len(lnum_list)):
		while lnum_list[i] < 9:
			if sum(lnum_list) == sum_digits:
				break
			lnum_list[i] += 1
		else:
			continue
	snum_list = lnum_list[::-1]
	if snum_list[0] != 0:
		print(''.join([str(d) for d in snum_list]), end='')
		print(' ', end='')
	else:
		snum_list[0] += 1
		for i in range(1, len(snum_list)):
			if snum_list[i] != 0:
				snum_list[i] -= 1
				break
		print(''.join([str(d) for d in snum_list]))
	print(''.join([str(d) for d in lnum_list]))


(m, s) = [int(i) for i in input().split()]
if s > 9:
	t = s % 9
	n = s // 9
	if m > n:
		large = int(n * '9' + str(t) + (m - n - 1) * '0')
		if m > n + 1 or t == 0:
			if t != 0:
				small = int('1' + (m - n - 2) * '0' + str(t - 1) + n * '9')
			else:
				small = int('1' + (m - n - 1) * '0' + str(8) + (n - 1) * '9')
		else:
			small = int(str(t) + n * '9')
	elif m == n and t == 0:
		large = int(m * '9')
		small = large
	else:
		large = '-1'
		small = large
elif s == 0 and m != 1:
	large = '-1'
	small = large
elif s <= 9 and m == 1:
	large = int(s)
	small = large
else:
	large = int(str(s) + (m - 1) * '0')
	small = int('1' + (m - 2) * '0' + str(s - 1))
print(small, large)


def can(l, s):
	if s >= 0 and s <= 9 * int(l):
		return True
	else:
		return False
(l, s) = map(int, input().split())
f = s
ans = ''
if can(l, s) == False or (s == 0 and l > 1):
	print(-1, -1)
	exit()
for i in range(l):
	for d in range(0, 10):
		if (i > 0 or d > 0 or (l == 1 and s == 0)) and can(l - i - 1, s - d) == True:
			ans += str(d)
			s -= d
			break
print(ans, end=' ')
y = ''
for i in range(l):
	for d in range(9, -1, -1):
		if can(l - i - 1, f - d) == True:
			y += str(d)
			f -= d
			break
print(y)


(m, s) = map(int, input().split())
if s == 0 and m > 1:
	print('-1 -1')
else:
	(Min, Max) = ('', '')
	t = s
	while len(Max) < m:
		if t > 9:
			Max += '9'
			t -= 9
		else:
			Max += chr(t + ord('0'))
			t -= t
	if t > 0:
		print('-1 -1')
	else:
		t = s - 1
		while len(Min) < m - 1:
			if t > 9:
				Min = '9' + Min
				t -= 9
			else:
				Min = chr(t + ord('0')) + Min
				t -= t
		if t + 1 > 9:
			print('-1 -1')
		else:
			Min = chr(t + ord('1')) + Min
			print(Min, Max)


n = input().split()
a = int(n[0])
b = int(n[1])
c = b
if a > 1 and b < 1 or b > a * 9:
	print('-1 -1')
else:
	t = 10 ** (a - 1)
	b = b - 1
	k = 0
	w = 0
	while b >= 9:
		k = 9 + 10 * k
		b = b - 9
		w = w + 1
	k = b * 10 ** w + k
	q = t + k
	if c < 9:
		p = c * 10 ** (a - 1)
	elif c == a * 9:
		p = '9' * a
	else:
		p = ''
		while c >= 9:
			p = '9' + p
			a = a - 1
			c = c - 9
		p = p + str(c)
		if c == 0:
			p = p[0:a + 1]
		for i in range(0, a - 1):
			p = p + '0'
	print(q)
	print(p)


(m, s) = map(int, input().split())

def validate(m, s):
	if m == 1 and s < 10:
		return s
	elif s == 0:
		return -1
	elif 9 * m < s:
		return -1
	return None

def prep_max(m, s):
	r = validate(m, s)
	if r is not None:
		return r
	len_9 = s // 9
	len_0 = m - len_9
	return '9' * len_9 + str(s % 9) * bool(len_0) + '0' * (len_0 - 1)

def prep_min(m, s):
	r = validate(m, s)
	if r is not None:
		return r
	head = '1' if (m - 1) * 9 >= s - 1 else str(s - (m - 1) * 9)
	s_tail = s - int(head)
	return head + (str(prep_max(m - 1, s_tail))[::-1] if s_tail else '0' * (m - 1))
print(prep_min(m, s), prep_max(m, s))


from operator import ne as ne
(n, s) = map(int, input().split(' '))
min = max = -1
if s < 1:
	if n == 1:
		print('0 0')
	else:
		print(min, max, sep=' ')
elif 9 * n < s:
	print(min, max, sep=' ')
elif n == 1:
	min = max = s
	print(min, max, sep=' ')
else:
	min = max = [0] * n
	j = n - 1
	ss = sum(min)
	SS = sum(max)
	while ne(s, ss):
		for num in range(9, -1, -1):
			if num + ss <= s:
				min[j] = num
				j -= 1
				ss += num
				break
			else:
				pass
	max = min[::-1]
	if min[0] == 0:
		for i in range(1, n):
			if min[i] > 0:
				min[i] -= 1
				min[0] = 1
				break
	print(*min, sep='', end=' ')
	print(*max, sep='')


line = input()
m = int(line.split()[0])
s = int(line.split()[1])
if s == 0 and m != 1 or s > 9 * m:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	k = 0
	while s > 9:
		s = s - 9
		k += 1
	i = 0
	maxs = 0
	t = m
	while i < k:
		maxs += 9 * 10 ** (t - 1)
		i += 1
		t -= 1
	maxs += s * 10 ** (t - 1)
	mins = 0
	j = 0
	while j < k:
		mins += 9 * 10 ** j
		j += 1
	mins += 10 ** (m - 1) + (s - 1) * 10 ** k
	print(str(mins) + ' ' + str(maxs))


(a, b) = map(int, input().split())
min = ''
max = ''
ans = 0
s = b
m = a
if m == 1 and s == 0:
	min = 0
	max = 0
elif int(s) < 1 or int(s) > 9 * int(m):
	min = -1
	max = -1
else:
	while s > 9:
		min += '9'
		m -= 1
		s -= 9
	if m != 0 and s != 0:
		if m == 1:
			min = str(s) + min
			m -= 1
		elif m > 1:
			m -= 1
			st = ''
			st += '1'
			s -= 1
			st += '0' * m
			st = int(st)
			st = st + s
			st = str(st)
			min = st + min
	elif m != 0 and s == 0:
		min += '0' * m
	max = ''
	s = b
	m = a
	while s > 9:
		max += '9'
		m -= 1
		s -= 9
	if m != 0 and s != 0:
		if m == 1:
			max = max + str(s)
		elif m > 1:
			m -= 1
			max += str(s)
			max += '0' * m
	elif m != 0 and s == 0:
		min += '0' * m
print(min, max)


(m, s) = map(int, input().split())
a = ''
b = ''
if m == 1 and s == 0:
	print('0 0')
elif m > 1 and s == 0:
	print('-1 -1')
else:
	for i in range(m):
		a += str(min(9, s))
		s -= min(9, s)
	if s != 0:
		print('-1 -1')
	else:
		b = a[::-1]
		if b[0] == '0':
			b = '1' + b[1:]
			for i in range(1, len(b)):
				if b[i] != '0':
					b = b[:i] + str(int(b[i]) - 1) + b[i + 1:]
					break
		print(b, a)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))
(m, s) = mp()
rem = s % 9
maxi = '9' * (s // 9)
if rem > 0:
	maxi += str(rem)
if len(maxi) > m or (len(maxi) == 0 and m > 1):
	cout('-1 -1')
	exit(0)
maxi += '0' * (m - len(maxi))
mini = maxi[::-1]
if len(maxi) == 1:
	cout(mini + ' ' + maxi)
else:
	k = 0
	for i in range(len(mini)):
		if mini[i] == '0' and (not k):
			k = 1
			cout('1')
		elif '0' < mini[i] <= '9' and k == 1:
			cout(str(int(mini[i]) - 1))
			k = 2
		else:
			cout(mini[i])
	cout(' ' + maxi)


(a, b) = map(int, input().split())
if b > a * 9 or (b == 0 and a > 1):
	print('-1 -1')
else:
	max = ''
	while a > 0:
		x = 9 if b > 9 else b
		b -= x
		max += str(x)
		a -= 1
	min = max[::-1]
	if min[0] == '0':
		for i in range(len(min)):
			if min[i] != '0':
				min = '1' + min[1:i] + str(ord(min[i]) - 48 - 1) + min[i + 1:]
				break
	print(min, max)


(m, s) = map(int, input().split())
if m > 1 and s < 1 or 9 * m < s:
	print(-1, -1)
	exit()
if s == 0 and m == 1:
	print(0, 0)
	exit()
k = s
for i in range(m - 1, -1, -1):
	a = max(0, k - 9 * i)
	if a == 0 and i == m - 1:
		a = 1
	k -= a
	print(a, end='')
print(' ', end='')
for i in range(m - 1, -1, -1):
	b = min(9, s)
	print(b, end='')
	s -= b


import sys, functools
import functools
(m, s) = input().strip().split(' ')
(m, s) = (int(m), int(s))
if s == 0 or m * 9 < s:
	if m == 1 and s == 0:
		print('0 0')
		exit()
	print('-1 -1')
	exit()

def f(M, S):
	if M == 0:
		return []
	if S == 0:
		return [0 for i in range(0, M)]
	temp = [9 if S >= 9 else S % 9]
	temp.extend(f(M - 1, S - temp[0]))
	return temp
maxM = f(m, s)
minM = [maxM[m - i] for i in range(1, m + 1)]
if minM[0] == 0:
	zeroNum = minM.count(0)
	minM[zeroNum] -= 1
	minM[0] = 1

def listToStr(x):
	s = ''
	for i in range(0, len(x)):
		s += str(x[i])
	return s
print(listToStr(minM), listToStr(maxM))


(m, s) = input().split()
m = int(m)
s = int(s)
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
	exit()
sumdigits = int(s - 1)
arr = [1]
for i in range(m - 1):
	arr.append(0)
for i in reversed(range(m)):
	tmp = min(9 - arr[i], sumdigits)
	arr[i] += tmp
	sumdigits -= tmp
if sumdigits != 0:
	print(-1, end='')
else:
	for i in range(m):
		print(arr[i], end='')
print(' ', end='')
sumdigits = int(s - 1)
arr = [1]
for i in range(m - 1):
	arr.append(0)
for i in range(m):
	tmp = min(9 - arr[i], sumdigits)
	arr[i] += tmp
	sumdigits -= tmp
if sumdigits != 0:
	print(-1, end='')
else:
	for i in range(m):
		print(arr[i], end='')
print('')


(m, s) = map(int, input().split())
(max_result, min_result) = (-1, -1)
data = [9 for i in range(m)]
if m == 1 and s <= 9:
	print(s, s)
	exit()

def get_max_result():
	global max_result
	_data = data[:]
	for i in range(m):
		for j in range(8, -1, -1):
			_data[-i - 1] = j
			sum_data = sum(_data)
			if sum_data == s and sum_data != 0:
				max_result = ''.join(map(str, _data))
				return

def get_min_result():
	global min_result
	_data = data[:]
	for i in range(m):
		for j in range(8, -1, -1):
			if i == 0 and j == 0:
				continue
			_data[i] = j
			sum_data = sum(_data)
			if sum_data == s and sum_data != 0:
				min_result = ''.join(map(str, _data))
				return
get_max_result()
get_min_result()
if min_result == -1 and max_result != -1:
	min_result = max_result
elif min_result == -1 and max_result == -1:
	sum_data = sum(data)
	if sum_data == s:
		join_data = ''.join(map(str, data))
		min_result = ''.join(map(str, join_data))
		max_result = ''.join(map(str, join_data))
print(min_result, max_result)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
elif s == 0 or m * 9 < s:
	print('-1 -1')
else:
	smallest = '1' + '0' * (m - s // 9 - 1) + '9' * (s // 9) if s % 9 == 1 and s // 9 + 1 < m else str(s % 9) + '9' * (s // 9) if s // 9 + 1 == m else '9' * (s // 9) if s // 9 == m else '1' + '0' * (m - 2 - (s - 1) // 9) + str((s - 1) % 9) + '9' * ((s - 1) // 9)
	largest = '9' * (s // 9) + '0' * (m - s // 9) if s % 9 == 0 else '9' * (s // 9) + str(s % 9) + '0' * (m - s // 9 - 1)
	print(smallest, largest)


import sys

def readInput():
	for line in sys.stdin:
		a = line.split(' ')
		m = int(a[0])
		s = int(a[1])
	return [m, s]

def arrayToInt(x):
	num = 0
	l = len(x)
	exp = 0
	for i in range(l, 0, -1):
		num += x[i - 1] * pow(10, exp)
		exp += 1
	return num

def findMin(m, s):
	_min = []
	k = s // 9
	l = s % 9
	if k == m:
		for i in range(1, m + 1):
			_min.append(9)
	elif k == m - 1:
		_min.append(l)
		for i in range(1, m):
			_min.append(9)
	else:
		k = (s - 1) // 9
		l = (s - 1) % 9
		_min.append(1)
		for i in range(1, m - k - 1):
			_min.append(0)
		_min.append(l)
		for i in range(1, k + 1):
			_min.append(9)
	return _min

def findMax(m, s):
	_max = []
	k = s // 9
	l = s % 9
	if k == m:
		for i in range(1, m + 1):
			_max.append(9)
	elif k == m - 1:
		for i in range(1, m):
			_max.append(9)
		_max.append(l)
	else:
		k = s // 9
		l = s % 9
		for i in range(1, k + 1):
			_max.append(9)
		_max.append(l)
		for i in range(1, m - k):
			_max.append(0)
	return _max

def solve():
	d = readInput()
	m = d[0]
	s = d[1]
	if s == 0:
		return [-1, -1] if m > 1 else [0, 0]
	if 9 * m < s:
		return [-1, -1]
	_min = findMin(m, s)
	_max = findMax(m, s)
	return [arrayToInt(_min), arrayToInt(_max)]
data = solve()
print(str(data[0]) + ' ' + str(data[1]))


(m, s) = map(int, input().split())
(a, b) = ('', '')
if s > 9 * m:
	print('-1 -1')
elif s == 0 and m != 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
elif m == 1:
	print(str(s) + ' ' + str(s))
else:
	if s % 9 == 0:
		b = '9' * (s // 9) + '0' * (m - s // 9)
	else:
		b = '9' * (s // 9) + str(s % 9) + '0' * max(0, m - s // 9 - 1)
	if s // 9 >= m - 1:
		a = b[::-1]
	else:
		a = '1' + '0' * max(0, m - (s - 1) // 9 - 2) + str((s - 1) % 9) + '9' * ((s - 1) // 9)
print(a + ' ' + b)


def get_max_number(m, s):
	max_number = 0
	for i in range(m):
		new_digit = min(9, s)
		max_number = 10 * max_number + new_digit
		s -= new_digit
	if s or len(str(max_number)) != m:
		max_number = -1
	return max_number

def get_min_number(m, s):
	if s == 0:
		return 0 if m == 1 else -1
	min_number = 0
	multiplier = 1
	for i in range(m - 1):
		new_digit = min(9, s - 1)
		min_number += multiplier * new_digit
		multiplier *= 10
		s -= new_digit
	if 1 <= s <= 9:
		min_number += multiplier * s
	else:
		min_number = -1
	return min_number
(m, s) = map(int, input().split())
print(' '.join(map(str, [get_min_number(m, s), get_max_number(m, s)])))


__author__ = 'alexandrun'
import sys

def process(m, s):
	if s == 0:
		if m == 1:
			return (0, 0)
		return (-1, -1)
	q = s // 9
	r = s % 9
	if r == 0:
		cifMin = q
	else:
		cifMin = q + 1
	if cifMin > m:
		return (-1, -1)
	if cifMin == m:
		if r == 0:
			return ('9' * q, '9' * q)
		min = str(r) + '9' * q
		max = '9' * q + str(r)
		return (min, max)
	if cifMin < m:
		min = '1'
		qmin = (s - 1) // 9
		rmin = (s - 1) % 9
		if rmin == 0:
			cifMin2 = qmin
		else:
			cifMin2 = qmin + 1
		if cifMin2 == m - 1:
			if rmin > 0:
				min += str(rmin) + '9' * qmin
			else:
				min += '9' * qmin
		elif cifMin2 < m - 1:
			if rmin > 0:
				min += '0' * (-cifMin2 + m - 1) + str(rmin) + '9' * qmin
			else:
				min += '0' * (-cifMin2 + m - 1) + '9' * qmin
		max = '9' * q + str(r) + (m - q - 1) * '0'
		return (min, max)
words = input().split()
m = int(words[0])
s = int(words[1])
res = process(m, s)
print(res[0], res[1])


import math
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(n, m) = M()
d = m
if m == 0 and n > 1 or n * 9 < m:
	print(-1, -1)
else:
	a = [0] * n
	ans = ''
	anss = ''
	for i in range(n):
		a[i] = min(m, 9)
		m -= min(m, 9)
	b = [0] * n
	b[0] = 1
	m = d
	m -= 1
	for i in range(n - 1, -1, -1):
		if i == 0:
			b[0] += m
			m -= min(m, 9)
		else:
			b[i] = min(9, m)
			m -= min(m, 9)
	for i in a:
		ans += str(i)
	for i in b:
		anss += str(i)
	print(anss, ans)


(dig, summ) = map(int, input().split())
max_sum = dig * 9

def find_max():
	quotient = summ / 9
	remainder = summ % 9
	nine = ['9'] * int(quotient)
	return (remainder, nine)
if summ > max_sum:
	print('-1 -1')
elif summ == 0 and dig == 1:
	print('0 0')
elif dig == 1:
	print(str(summ) + ' ' + str(summ))
elif summ == 0 or dig == 0:
	print('-1 -1')
else:
	(remainder, nine) = find_max()
	if remainder == 0:
		maxi = ''.join(nine)
	else:
		maxi = ''.join(nine) + str(remainder)
	for i in range(dig - len(maxi)):
		maxi = maxi + '0'
	if summ > 9 and dig == 2 and (remainder != 0):
		mini = str(remainder) + ''.join(nine)
	elif summ > 9 and dig == 2 and (remainder == 0):
		mini = ''.join(nine)
	else:
		summ = summ - 1
		(remainder, nine) = find_max()
		mini = '1'
		temp = len(mini) + len(nine) + 1
		for i in range(dig - temp):
			mini = mini + '0'
		mini = mini + str(remainder) + ''.join(nine)
		if len(mini) > dig:
			mini = str(1 + remainder) + ''.join(nine)
	print(mini + ' ' + maxi)


def can(i, m, s):
	if i == 0 and s == 0 and (m > 1):
		return False
	if s >= 0 and s <= 9 * m:
		return True
	return False
(m, s) = map(int, input().split())
if can(0, m, s):
	su = s
	out = ''
	for i in range(m):
		for d in range(0, 10):
			if (i > 0 or d > 0 or (m == 1 and s == 0)) and can(i + 1, m - i - 1, s - d):
				out += str(d)
				s -= d
				break
	out2 = ''
	s = su
	for i in range(m):
		for d in range(9, -1, -1):
			if (i > 0 or d > 0 or (m == 1 and s == 0)) and can(i + 1, m - i - 1, s - d):
				out2 += str(d)
				s -= d
				break
	print(out, out2)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
n = m
s1 = s
if s == 0 and m > 1 or s > 9 * m:
	print(-1, -1)
else:
	max = [0] * m
	min = [0] * m
	i = 0
	while s:
		if s > 9:
			max[i] = 9
			s -= 9
			i += 1
		else:
			max[i] = s
			s = 0
	while s1:
		if s1 > 9:
			min[m - 1] = 9
			m -= 1
			s1 -= 9
		elif m - 1 == 0:
			min[0] = s1
			s1 = 0
		else:
			min[m - 1] = s1 - 1
			min[0] = 1
			s1 = 0
	for j in range(n):
		print(min[j], end='')
	print(end=' ')
	for j in range(n):
		print(max[j], end='')


from sys import stdin
(m, s) = map(int, stdin.readline().rstrip().split())
if m * 9 < s:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif s == 0:
	print(-1, -1)
else:
	large = s
	largest = ''
	for x in range(m):
		step = min(9, large)
		large -= step
		largest += str(step)
	small = s
	smallest = ''
	first = max(1, small - 9 * (m - 1))
	smallest += str(first)
	small -= first
	for x in range(m - 1):
		step = max(0, small - 9 * (m - x - 2))
		small -= step
		smallest += str(step)
	print(smallest, largest)


(m, s) = [int(x) for x in input().split()]
if s == 0 and m == 1:
	print(0, 0)
elif s < 1 or s > m * 9:
	print(-1, -1)
else:
	n = s
	res1 = []
	for i in range(0, m):
		if s == 0:
			res1.append(str(0))
		elif s < 9:
			res1.append(str(s))
			s -= s
		else:
			res1.append(str(9))
			s -= 9
	res2 = []
	s = n - 1
	for i in range(0, m - 1):
		if s == 0:
			res2.append(str(0))
		elif s < 9:
			res2.append(str(s))
			s -= s
		else:
			res2.append(str(9))
			s -= 9
	res2.append(str(s + 1))
	res2.reverse()
	print(''.join(res2), end=' ')
	print(''.join(res1))


def process(cnt, sm):
	if sm == 0:
		if cnt == 1:
			return (0, 0)
		return (-1, -1)
	if sm > cnt * 9:
		return (-1, -1)
	(revno, smol) = ([0] * cnt, [0] * cnt)
	t = sm
	smol[-1] = 1
	t -= 1
	i = 0
	while t > 0:
		try:
			if smol[i] + t > 9:
				smol[i] += 9 - smol[i]
				t -= smol[i]
			else:
				smol[i] += t
				t = 0
			i += 1
		except:
			return (-1, -1)
	smol.reverse()
	i = 0
	t = sm
	while t > 0:
		try:
			if t > 9:
				revno[i] += 9
				t -= 9
			else:
				revno[i] += t
				t = 0
			i += 1
		except:
			return (-1, -1)
	return (''.join(map(str, smol)), ''.join(map(str, revno)))
(cnt, sm) = map(int, input().split())
print(*process(cnt, sm))


(l, suma) = map(int, input().split())
smallest = [0] * l
largest = [0] * l
temp = suma
if suma > 9 * l:
	print(-1, -1)
elif suma == 0 and l == 1:
	print(0, 0)
elif suma == 0:
	print(-1, -1)
else:
	smallest[0] = 1
	temp -= 1
	for i in range(l - 1, -1, -1):
		if temp > 0 and temp <= 9:
			smallest[i] += temp
			break
		elif temp > 9:
			smallest[i] = 9
			temp -= 9
		elif temp == 0:
			break
	temp = suma
	for i in range(0, l):
		if temp > 0 and temp <= 9:
			largest[i] = temp
			break
		else:
			largest[i] = 9
			temp -= 9
	print(*smallest, sep='', end=' ')
	print(*largest, sep='')


(m, s) = map(int, input().split())
if s == 1:
	res = '1' + '0' * (m - 1)
	print(res, res)
	exit(0)
arr = [0] * m
if 1 > s:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit(0)
itr = 0
while s > 0 and itr < m:
	choice = min(9, s)
	arr[itr] += choice
	s -= choice
	itr += 1
if s > 0:
	print(-1, -1)
	exit(0)
for i in range(m - 1):
	for j in range(i + 1, m):
		if arr[i] == 9:
			break
		if arr[j] >= 0:
			needed = 9 - arr[i]
			extracted = min(needed, arr[j])
			arr[i] += extracted
			arr[j] -= extracted
res_max = ''.join(map(str, arr))
if arr[-1] == 0:
	for i in range(m - 2, -1, -1):
		if arr[i] > 0:
			arr[i] -= 1
			arr[-1] = 1
			break
res_min = ''.join(map(str, arr[::-1]))
print(res_min, res_max)


import re
m = input()
r = re.split('\\s+', m)
a = int(r[0])
b = int(r[1])
if b == 0 and a >= 2 or 9 * a < b:
	print('-1 -1')
elif b == 0 and a == 1:
	print('0 0')
elif b == 1:
	p = '1'
	q = '1'
	for i in range(a - 1):
		p += str(0)
		q += str(0)
	print(q + ' ' + p)
else:
	l = []
	s = []
	i = 1
	k = 9
	while i <= a:
		if b - k >= 1 or b - k >= a - i:
			i += 1
			if k >= 1:
				l.append(k)
				b -= k
			elif i == a + 1:
				l.append(1)
			else:
				l.append(0)
		else:
			k -= 1
	b = int(r[1])
	s = []
	i = 1
	k = 9
	while i <= a:
		if b - k >= 0:
			i += 1
			s.append(k)
			b -= k
		else:
			k -= 1
	p = ''
	q = ''
	for i in range(a):
		p += str(s[i])
		q += str(l[a - i - 1])
	print(q + ' ' + p)


(m, s) = (int(x) for x in input().split())
if s == 0:
	print('0 0' if m == 1 else '-1 -1')
elif s > m * 9:
	print('-1 -1')
else:
	maxs = '9' * (s // 9) + (str(s % 9) if s % 9 else '') + '0' * (m - (s + 8) // 9)
	mins = maxs[::-1]
	if mins[0] == '0':
		nzi = mins.index(next((ch for ch in mins if ch != '0')))
		mins = '1' + mins[1:nzi] + str(int(mins[nzi]) - 1) + mins[nzi + 1:]
	print(mins, maxs)


(m, s) = map(int, input().split())
if m < s / 9:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
elif s == 0:
	print(-1, -1)
else:
	q = s // 9
	r = s - q * 9
	mul = m - (q + 1)
	if mul < 0:
		maxx = [9] * q
	else:
		maxx = [9] * q + [r] + [0] * (m - (q + 1))
	if maxx[-1] != 0:
		minn = maxx[::-1]
	else:
		minn = maxx.copy()
		minn = minn[::-1]
		minn[0] = 1
		for i in range(1, len(minn)):
			if minn[i] == 0:
				continue
			else:
				minn[i] -= 1
				break
	y = ''.join((str(i) for i in maxx))
	z = ''.join((str(i) for i in minn))
	print(int(z), int(y))


a = list(map(int, input().split()))
m = a[0]
s = a[1]
mx = []
mi = []
for i in range(1, 1 + m):
	v = s - (m - i) * 9
	if v > 0:
		mx.append(v)
		s -= v
	elif i == 1:
		mx.append(1)
		s -= 1
	else:
		mx.append(0)
s = a[1]
for i in range(1, 1 + m):
	u = s
	if u < 9:
		mi.append(u)
		s -= u
	else:
		mi.append(9)
		s -= 9
if a[1] == 0 and m != 1 or a[1] > 9 * m:
	print('-1 -1')
elif a[1] == 0 and m == 1:
	print('0 0')
else:
	mini = ''.join((str(i) for i in mx))
	mac = ''.join((str(i) for i in mi))
	print(mini, mac)


from copy import deepcopy
(m, s) = map(int, input().split())
if m == 1 and s < 9:
	print(s, s)
elif s == 0:
	print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
else:
	res = [0 for i in range(m)]
	res[0] = 1
	mini = deepcopy(res)
	maxi = deepcopy(res)
	j = m - 1
	for i in range(900):
		if sum(mini) < s:
			if mini[j] != 9:
				mini[j] += 1
			else:
				j -= 1
				mini[j] += 1
		else:
			break
	j = 0
	for i in range(900):
		if sum(maxi) < s:
			if maxi[j] != 9:
				maxi[j] += 1
			else:
				j += 1
				maxi[j] += 1
		else:
			break
	minele = ''
	maxele = ''
	for i in mini:
		minele += str(i)
	for i in maxi:
		maxele += str(i)
	print(minele, maxele)


l = input().split()
d = int(l[0])
s = int(l[1])
if d == 1 and s == 0:
	print('0 0')
elif s <= 0 or s > d * 9:
	print('-1 -1')
else:
	b1 = (9 * d - s) // 9
	b2 = (9 * d - s) % 9
	s1 = (s - 1) // 9
	s2 = (s - 1) % 9
	big = 10 ** d - (1 + b2) * 10 ** b1
	small = 10 ** (d - 1) + (1 + s2) * 10 ** s1 - 1
	print(str(small), str(big))


(m, s) = map(int, input().split())
if 9 * m < s or (s == 0 and m > 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	mx = s // 9 * '9' + (str(s % 9) if s % 9 else '') + (m - s // 9 - (s % 9 != 0)) * '0'
	mn = ''
	for i in range(m):
		for j in range(i == 0, 10):
			if 9 * (m - i - 1) >= s - j:
				mn += str(j)
				s -= j
				break
	print(mn, mx)


__author__ = 'Bian'
(m, s) = [int(x) for x in input().split()]
if s > m * 9 or s < 0 or (s == 0 and m != 1):
	print('-1 -1')
	exit()
s_bucket = s
if m == 1 and s == 0:
	print('0', end='')
else:
	pr = max(1, s_bucket - 9 * (m - 1))
	print(pr, end='')
	s_bucket -= pr
for i in range(m - 2, -1, -1):
	pr = max(0, s_bucket - i * 9)
	print(pr, end='')
	s_bucket -= pr
print(' ', end='')
s_bucket = s
for i in range(m):
	pr = min(9, s_bucket)
	print(pr, end='')
	s_bucket -= pr


(m, p) = [int(j) for j in input().split()]
s = p
min = ['1'] + list('0' * (m - 1))
max = ['1'] + list('0' * (m - 1))
if m == 1 and p == 0:
	print(0, 0)
	exit()
if s < 1 or s > 9 * m:
	print(-1, -1)
	exit()
s -= 1
p -= 1
for i in range(m - 1, 0, -1):
	if s > 9:
		min[i] = str(int(min[i]) + 9)
	else:
		min[i] = str(int(min[i]) + s)
		s = 0
		break
	s -= 9
min[0] = str(int(min[0]) + s)
if p >= 8:
	max[0] = str(int(max[0]) + 8)
	p -= 8
else:
	max[0] = str(int(max[0]) + p)
	p = 0
for i in range(1, m):
	if p > 9:
		max[i] = str(int(max[i]) + 9)
	else:
		max[i] = str(int(max[i]) + p)
		break
	p -= 9
print(''.join(min), ''.join(max))


(m, s) = map(int, input().split())
if s > m * 9 or (s == 0 and m != 1):
	print(-1, -1)
else:
	a = [0] * m
	i = m - 1
	ss = s
	while ss > 9:
		a[i] = 9
		ss -= 9
		i -= 1
	if i == 0:
		a[0] = ss
	else:
		a[i] = ss - 1
		a[0] = 1
	b = [0] * m
	ss = s
	i = 0
	while ss >= 9:
		b[i] = 9
		ss -= 9
		i += 1
	if i < m:
		b[i] = ss
	print(*a, ' ', *b, sep='')


a = [int(i) for i in input().split()]
m = a[0]
s = a[1]
if s == 0 and m == 1:
	print(s, s)
elif s == 0:
	print(-1, -1)
else:
	arr = [0 for i in range(m)]
	arr1 = [0 for i in range(m)]
	s1 = s
	for i in range(m):
		if s >= 9:
			arr[i] = 9
			arr1[m - i - 1] = 9
			s -= 9
			s1 -= 9
		else:
			arr[i] = s
			s = 0
			if i == m - 1:
				arr1[0] = s1
	if s == 0:
		if arr1[0] > 1:
			i = 1
			while i < m and arr1[i] == 0:
				i += 1
			if i != 1 and (i <= m and arr[i - 1] != 9):
				arr1[i - 1] = arr1[0] - 1
				arr1[0] = 1
		elif arr1[0] == 0:
			i = 1
			while i < m and arr1[i] != 9:
				i += 1
			arr1[0] = 1
			if i < m:
				arr1[i] -= 1
		print(int(''.join(map(str, arr1))), int(''.join(map(str, arr))))
	else:
		print(-1, -1)


(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
else:
	min = 10 ** (m - 1)
	for i in range(s - 1):
		min += 10 ** (i // 9)
	max = 0
	for j in range(s):
		max += 10 ** (m - 1 - j // 9)
	print(min, max)


a = input().split()
num = int(a[0])
s = int(a[1])

def getmin(x, y):
	c = [0 for j in range(0, x)]
	su = y
	for i in range(0, x):
		if su > 9:
			c[x - i - 1] = 9
			su = su - 9
		else:
			if i == x - 1:
				c[0] = su
			else:
				c[0] = 1
				c[x - i - 1] = su - 1
			break
	return c

def getmax(x, y):
	c = [0 for j in range(0, x)]
	su = y
	for i in range(0, x):
		if su > 9:
			c[i] = 9
			su = su - 9
		else:
			c[i] = su
			break
	return c
if s >= 1 and s <= 9 * num:
	c = getmin(num, s)
	d = getmax(num, s)
	e = ''.join((str(i) for i in c))
	f = ''.join((str(i) for i in d))
	print(int(e), int(f))
elif s == 0 and num == 1:
	print('0 0')
else:
	print('-1 -1')


(m, s) = [int(x) for x in input().split()]
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
	exit(0)
if s > m * 9:
	print(-1, -1)
	exit(0)
ans = [0] * m
tmp = s
for i in range(m):
	add = min(9 - ans[i], tmp)
	ans[i] = str(ans[i] + add)
	tmp -= add
ans = ''.join(ans)
ans2 = [0] * m
ans2[0] = 1
s -= 1
for i in range(m - 1, -1, -1):
	add = min(9 - ans2[i], s)
	ans2[i] = str(ans2[i] + add)
	s -= add
ans2 = ''.join(ans2)
print(ans2, ans)


(m, s) = map(int, input().split())
mn = mx = []
if s == 0 and m == 1:
	print(2 * '0 ')
	exit()
if s == 0 or 9 * m < s:
	print(2 * '-1 ')
	exit()
for _ in range(m):
	if s >= 9:
		mx.append(9)
		s -= 9
	else:
		mx.append(s)
		s = 0
mn = mx[::-1]
if not mn[0]:
	mn[next((i for (i, x) in enumerate(mn) if x), None)] -= 1
	mn[0] = 1
print(int(''.join((str(i) for i in mn))))
print(int(''.join((str(i) for i in mx))))


inputlist = list(map(int, input().split()))
m = inputlist[0]
s = inputlist[1]
stop = False
if s == 0 and m != 1:
	print('-1 -1')
	stop = True
elif s == 0 and m == 1:
	print('0 0')
	stop = True
elif s > 9 * m:
	print('-1 -1')
	stop = True
else:
	max = ''
	steps = 0
	while steps != m and stop == False:
		if s >= 9:
			max += '9'
			s -= 9
		else:
			max += str(s)
			for j in range(m - steps - 1):
				max += str(0)
			break
		steps += 1
	max = int(max)
	s = inputlist[1]
	min = ''
	j = 1
	while 9 * m < s - j + 9 and stop == False:
		j += 1
	min += str(j)
	m -= 1
	s -= j
	k = m
	for i in range(m):
		j = 0
		while 9 * k < s - j + 9:
			j += 1
		min += str(j)
		s -= j
		k -= 1
	print(min, max)


class Solution:

	def __init__(self):
		(self.m, self.s) = map(int, input().split())

	def solution(self):
		if self.m == 1 and self.s == 0:
			print(0, 0)
		elif self.m * 9 < self.s or self.s == 0:
			print(-1, -1)
		else:
			print(10 ** (self.m - 1) + sum((10 ** (i // 9) for i in range(self.s - 1))), sum((10 ** (self.m - 1 - i // 9) for i in range(self.s))))

def main():
	ob = Solution()
	ob.solution()
main()


def maxn(n, s):
	p = list('0' * n)
	i = 0
	while s:
		if s < 10:
			p[i] = str(s)
			s = 0
		else:
			p[i] = '9'
			s -= 9
		i += 1
	return p
(n, s) = [int(x) for x in input().split()]
if n > 1 and s == 0 or s > 9 * n:
	print('-1 -1')
else:
	p = maxn(n, s)
	q = list(reversed(maxn(n, s - 1)))
	q[0] = str(int(q[0]) + 1)
	print(''.join(q), ''.join(p))


ms = input().split()
(m, s) = (int(ms[0]), int(ms[1]))
(m1, s1) = (m, s)
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
else:
	mx = 0
	mn = 10 ** (m - 1)
	while s1 >= 9:
		mx += 9 * 10 ** (m1 - 1)
		m1 -= 1
		s1 -= 9
	if s1 > 0:
		mx += s1 * 10 ** (m1 - 1)
	(m2, s2) = (0, s - 1)
	while s2 >= 9:
		mn += 9 * 10 ** m2
		s2 -= 9
		m2 += 1
	mn += s2 * 10 ** m2
	print(mn, mx)


from sys import stdin
a = [int(i) for i in stdin.readline().split()]
max_number = ''
min_number = ''
if a[1] > 9 * a[0] or (a[0] > 1 and a[1] == 0):
	print(-1, -1)
elif a[0] == 1:
	print(a[1], a[1])
else:
	nines = (a[1] - 1) // 9
	if nines > 0:
		for i in range(nines):
			min_number += '9'
	if a[0] - len(min_number) == 1:
		number = a[1] - len(min_number) * 9
		min_number += str(number)
	else:
		next = a[1] - len(min_number) * 9 - 1
		min_number += str(next)
		length = len(min_number)
		for i in range(a[0] - length - 1):
			min_number += '0'
		min_number += '1'
	nines = a[1] // 9
	r = a[1] % 9
	for i in range(nines):
		max_number += '9'
	if a[0] == len(max_number):
		print(int(min_number[::-1]), int(max_number))
	else:
		max_number += str(r)
		if a[0] == len(max_number):
			print(int(min_number[::-1]), int(max_number))
		else:
			length = len(max_number)
			for i in range(a[0] - length):
				max_number += '0'
			print(int(min_number[::-1]), int(max_number))


(n, m) = map(int, input().split())
if 1 <= m <= n * 9:
	a = [0] * n
	j = n - 1
	i = m - 1
	while j > 0:
		if i > 9:
			a[j] = 9
			i -= 9
		else:
			a[j] = i
			i -= i
		j -= 1
	a[0] = i + 1
	s = [str(i) for i in a]
	print(''.join(s), end=' ')
	i = m
	j = 0
	while j < n:
		j += 1
		if i > 9:
			print(9, end='')
			i -= 9
		else:
			print(i, end='')
			i -= i
elif n == 1 and m == 0:
	print('0 0')
else:
	print('-1 -1')


(m, s) = input().split()
m = int(m)
s = int(s)
ls = []
if s == 0 and m == 1:
	print('0 0')
else:
	while s > 9:
		ls.append(9)
		s = s - 9
	else:
		ls.append(s)
	ls1 = [str(i) for i in ls]
	a = ''.join(ls1)
	if len(a) > m or a == '0':
		print('-1 -1')
	elif len(a) == m:
		print(a[::-1], a)
	else:
		b = '1' + (m - len(a) - 1) * '0' + str(int(a) - 1)[::-1]
		a = a + (m - len(a)) * '0'
		print(b, a)


[m, s] = list(map(int, input().split()))
if s == 0:
	if m > 1:
		print(-1, -1)
	else:
		print(0, 0)
elif s > 9 * m:
	print(-1, -1)
else:
	boro = ''
	choto = ''
	inc1 = 0
	inc2 = 0
	for i in range(m):
		for dig in range(10):
			if i == 0 and dig == 0:
				continue
			if inc1 + dig <= s and s <= inc1 + dig + 9 * (m - i - 1):
				inc1 += dig
				choto += str(dig)
				break
	inc1 = 0
	for i in range(m):
		for dig in range(9, -1, -1):
			if inc1 + dig <= s and s <= inc1 + dig + 9 * (m - i - 1):
				inc1 += dig
				boro += str(dig)
				break
	print(int(choto), int(boro))


(s, m) = map(int, input().split())
isTrue = False
if s == 100:
	b_low = int('1'.ljust(len(str(s)) + s - 3, '0'))
	b_high = int('9'.ljust(len(str(s)) + s - 3, '9'))
elif s < 10:
	b_low = int('1'.ljust(len(str(s)) + s - 1, '0'))
	b_high = int('9'.ljust(len(str(s)) + s - 1, '9'))
else:
	b_low = int('1'.ljust(len(str(s)) + s - 2, '0'))
	b_high = int('9'.ljust(len(str(s)) + s - 2, '9'))
if s == 1 and m == 0:
	print(f'{0} {0}')
else:
	for i in range(s - 1, -1, -1):
		for n in range(1, 10):
			if sum(list(map(int, str(b_low)))) == m:
				break
			b_low = int(str(b_low)[:i] + str(n) + str(b_low)[i + 1:])
		if sum(list(map(int, str(b_low)))) == m:
			break
	for i in range(s - 1, -1, -1):
		for n in range(9, -1, -1):
			if sum(list(map(int, str(b_high)))) == m:
				isTrue = True
				break
			b_high = int(str(b_high)[:i] + str(n) + str(b_high)[i + 1:])
			if sum(list(map(int, str(b_high)))) == m and (not sum(list(map(int, str(b_high)))) == 0):
				isTrue = True
				break
		if sum(list(map(int, str(b_high)))) == m:
			break
	if isTrue:
		print(f'{b_low} {b_high}')
	else:
		print(f'{-1} {-1}')


(m, s) = map(int, input().split())
res = [] * m
mes = [] * m
summ = s
if summ == 1:
	res.insert(0, '1')
	if m != 1:
		for i in range(1, m):
			res.insert(i, '0')
			maxe = mn = res
	else:
		maxe = mn = res
	print(''.join(maxe), ''.join(mn))
elif summ == 0 and m != 1 or m * 9 < s:
	print('-1 -1')
else:
	for i in range(m):
		if summ - 9 > 0:
			res.insert(i, '9')
			summ -= 9
		else:
			res.insert(i, '{}'.format(summ))
			summ = 0
	maxe = res
	summ = s
	for i in range(m - 1, -1, -1):
		if summ - 9 > 0:
			mes.insert(0, '9')
			summ -= 9
		elif summ > 1:
			if i != 0:
				mes.insert(0, '{}'.format(summ - 1))
				summ = 1
			else:
				mes.insert(0, '{}'.format(summ))
				summ = 0
		elif summ == 1:
			if i != 0:
				mes.insert(0, '0')
			else:
				mes.insert(0, '1')
		elif summ == 0:
			(mes, res) = ('0', '0')
	mn = mes
	print(''.join(mn), ''.join(maxe))


(cnt, digsum) = [int(x) for x in input().strip().split(' ')]
if digsum == 0 and cnt == 1:
	print('0 0')
elif 0 < digsum <= 9 * cnt:
	max_list = []
	max_sum = digsum
	min_list = []
	min_sum = digsum
	for x in range(cnt):
		if max_sum > 9:
			max_list.append(9)
			max_sum -= 9
		else:
			max_list.append(max_sum)
			max_sum = 0
	for x in range(cnt):
		if min_sum > 9:
			min_list.append(9)
			min_sum -= 9
		elif x == cnt - 1:
			min_list.append(min_sum)
		else:
			min_list.append(min_sum - 1)
			min_sum -= min_sum - 1
	print(*min_list[::-1], sep='', end=' ')
	print(*max_list, sep='', end=' ')
else:
	print('-1 -1')


(m, s) = map(int, input().split())
if s == 0:
	if m != 1:
		print(-1, -1)
	else:
		print(0, 0)
else:
	min = []
	max = 0
	r = s
	c = 0
	f = m - 1
	if m * 9 < s:
		print(-1, -1)
	else:
		while r > 0:
			c += 1
			if r >= 9:
				min.append(9)
				max += 9 * 10 ** f
				r -= 9
			else:
				min.append(r)
				max += r * 10 ** f
				break
			f -= 1
		for i in range(c, m):
			min[-1] -= 1
			min.append(1)
		min1 = 0
		for i in range(m):
			min1 += min[i] * 10 ** i
		print(int(min1), int(max))


(m, s) = input().split()
m = int(m)
s = int(s)
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	maximum = ''
	x = s
	while x > 0:
		if x >= 9:
			maximum += '9'
			x -= 9
		else:
			maximum += str(x)
			x = 0
	while len(maximum) < m:
		maximum += '0'
	minimum = ''
	y = s
	if (m - 1) * 9 >= s - 1:
		minimum += '1'
		y -= 1
	elif m * 9 != s:
		minimum += str(s % 9)
		y -= s % 9
	else:
		minimum += '9'
		y -= 9
	complement = ''
	if y == 0:
		while len(minimum) < m:
			minimum += '0'
	else:
		while y > 0:
			if y > 9:
				complement = '9' + complement
				y -= 9
			else:
				complement = str(y) + complement
				y = 0
	while len(minimum) + len(complement) < m:
		minimum += '0'
	minimum = minimum + complement
	print(minimum, maximum)


def main():
	(m, n) = [int(v) for v in input().split()]
	s = m
	digits1 = []
	digits2 = []
	total1 = n - 1
	total2 = n
	if n == 0 and m == 1:
		print(0, 0)
		return
	if total1 < 0:
		print(-1, -1)
		return
	if m * 9 < n:
		print(-1, -1)
		return
	s1 = [0 for i in range(m)]
	s1[0] = 1
	while total1 > 0:
		val = total1 % 9
		if val == 0:
			val = 9
		digits1.append(val)
		total1 -= val
	while total2 > 0:
		val = total2 % 9
		if val == 0:
			val = 9
		digits2.append(val)
		total2 -= val
	val1 = 0
	digits1.sort()
	for i in range(len(digits1), m):
		digits1.insert(0, 0)
	digits2.sort(reverse=True)
	for i in range(len(digits2), m):
		digits2.append(0)
	for i in range(0, m):
		val1 = val1 * 10 + s1[i] + digits1[i]
	if digits1[m - 1] == 0:
		val2 = 0
		for i in range(0, m):
			val2 = val2 * 10 + s1[i] + digits1[m - i - 1]
	else:
		val2 = 0
		for i in range(0, m):
			val2 = val2 * 10 + digits2[i]
	print(val1, val2)
main()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))
inp = inlt()
m = inp[0]
s = inp[1]
dp_min = []
dp_max = []
for r in range(m + 1):
	x = []
	y = []
	for c in range(s + 1):
		if r == 0:
			x.append(c)
			y.append(c)
		else:
			x.append(0)
			y.append(0)
	dp_min.append(x)
	dp_max.append(y)
for r in range(m + 1):
	for c in range(1, s + 1):
		if c <= 9 * r:
			i = 1
			while (c - i) % 10 >= 10:
				i += 1
			dp_min[r][c] = int(i * 10 ** (r - 1)) + dp_min[(c - i - 1) // 9 + 1][c - i]
			j = 9
			while c - j < 0:
				j -= 1
			dp_max[r][c] = int(j * 10 ** (r - 1)) + dp_max[r - 1][c - j]
if m == 1 and s == 0:
	print('0 0')
elif dp_min[m][s] == 0:
	print('-1 -1')
else:
	print(dp_min[m][s], end=' ')
	print(dp_max[m][s])


n = 0
(m, s) = map(int, input().split())
if m * 9 - 8 >= s and m > 2 and (s >= 10):
	s -= 10
	m -= 2
	while m * 9 - 9 >= s and m > 2 and (s > 8):
		s -= 9
		m -= 2
		n += 1
	if m * 9 - 9 < s:
		mini = '1' + '0' * n + str(s - m * 9 + 9) + (m + n) * '9'
		maxi = '9' * (m + n) + str(s - m * 9 + 10) + (n + 1) * '0'
	elif m == 2:
		mini = '1' + '0' * (n + 1) + str(n) + (n + 1) * '9'
		maxi = '9' + str(n + 1) + '0' * (n + 2)
	else:
		mini = '1' + '0' * (n + m - 1) + str(s) + (n + 1) * '9'
		maxi = '9' * (n + 1) + str(s + 1) + '0' * (n + m)
elif m * 9 < s or (s < 1 and m != 1):
	maxi = '-1'
	mini = '-1'
elif m == 1:
	maxi = mini = s
elif s >= 10:
	maxi = '9' * (m - 1) + str(s - 9 * m + 9)
	mini = maxi[::-1]
elif s < 10:
	maxi = str(s) + '0' * (m - 1)
	mini = '1' + '0' * (m - 2) + str(s - 1)
print(mini, maxi, sep=' ')


from functools import lru_cache
from sys import setrecursionlimit
setrecursionlimit(5000)
(a, b) = [int(x) for x in input().strip().split(' ')]

@lru_cache(maxsize=None)
def find_min(k, s, first=True):
	if k == 1:
		if s < 10 and s >= 0:
			return s
		else:
			return None
	for i in range(1 if first else 0, 10):
		t = find_min(k - 1, s - i, False)
		if t is not None:
			return (i, t)
	return None

@lru_cache(maxsize=None)
def find_max(k, s, first=True):
	if k == 1:
		if s < 10 and s >= 0:
			return s
		else:
			return None
	for i in range(9, 0 if first else -1, -1):
		t = find_max(k - 1, s - i, False)
		if t is not None:
			return (i, t)
	return None

def convert(x):
	if x is None:
		return '-1'
	if isinstance(x, tuple):
		return str(x[0]) + convert(x[1])
	return str(x)
print(convert(find_min(a, b)), convert(find_max(a, b)))


ls = input().split(' ')
l = int(ls[0])
n = int(ls[1])
if n < 0 or n > l * 9:
	print('-1 -1')
elif n == 0:
	if l == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	m = ''
	n1 = n
	while n >= 9:
		m += '9'
		n -= 9
	if len(m) != l:
		m += '%d' % n
	while len(m) != l:
		m += '0'
	m1 = ''
	if n1 <= 9 * (l - 1) + 1:
		m1 += '1'
		n1 -= 1
	while n1 <= 9 * (l - len(m1) - 1) and len(m1) != l:
		m1 += '0'
	if len(m1) != l:
		if n1 % 9:
			m1 += '%d' % (n1 % 9)
			n1 -= n1 % 9
		else:
			m1 += '9'
		while len(m1) != l:
			m1 += '9'
	print(m1, m)


(m, s) = input().split()
m = int(m)
s = int(s)
sl = ''
ss = ''
if m == 1 and s == 0:
	print('0 0')
elif m > 1 and s == 0:
	print('-1 -1')
elif m * 9 < s:
	print('-1 -1')
elif s <= 9:
	if m != 1:
		ss += str(s)
		sl += str(1)
		for i in range(1, m):
			ss = ss + '0'
		for i in range(1, m - 1):
			sl = sl + '0'
		sl += str(s - 1)
		print(sl, ss)
	if m == 1:
		print(s, s)
else:
	x = int(s / 9)
	y = int(s % 9)
	for i in range(x):
		sl += '9'
	if x < m:
		sl += str(y)
	for i in range(x + 1, m):
		sl += '0'
	if x == m:
		for i in range(m):
			ss = ss + '9'
	elif x == m - 1:
		if x * 9 != s:
			ss += str(y)
			for i in range(1, m):
				ss = ss + '9'
		else:
			ss += '9'
			for i in range(1, m - x + 1):
				ss = ss + '0'
			for i in range(m - x + 1, m):
				ss = ss + '9'
	else:
		if x * 9 != s:
			ss = ss + '1'
			for i in range(1, m - x - 1):
				ss = ss + '0'
			ss += str(y - 1)
			for i in range(m - x, m):
				ss += '9'
		if x * 9 == s:
			ss = ss + '1'
			for i in range(1, m - x):
				ss = ss + '0'
			if y != 0:
				ss += str(y - 1)
			if y == 0:
				ss += str(8)
			for i in range(m - x + 1, m):
				ss += '9'
	print(ss, sl)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(m, s) = sep()
	if s == 0 and m == 1:
		print(0, 0)
		return
	if s == 0 or s > m * 9:
		print(-1, -1)
		return
	ans1 = []
	for i in range(m):
		ans1.append(0)
	ans1[0] = 1
	currsum = 1
	for i in range(m - 1, -1, -1):
		rem = s - currsum
		if rem > 8:
			ans1[i] = 9
			if i == 0:
				currsum += 8
			else:
				currsum += 9
		else:
			if i == 0:
				ans1[i] = rem + 1
			else:
				ans1[i] = rem
			break
	ans2 = []
	for i in range(m):
		ans2.append(0)
	ans2[0] = 1
	currsum = 1
	for i in range(m):
		rem = s - currsum
		if rem > 8:
			ans2[i] = 9
			if i == 0:
				currsum += 8
			else:
				currsum += 9
		else:
			if i == 0:
				ans2[i] = rem + 1
			else:
				ans2[i] = rem
			break
	print(''.join((str(ans1[i]) for i in range(m))), end=' ')
	print(''.join((str(ans2[i]) for i in range(m))))
testcase(1)


def maximal(m, s):
	if s > 9 * m:
		return '*'
	if s == 0:
		if m == 1:
			return str(0)
		else:
			return '*'
	if m == 1:
		if s in range(0, 10):
			return str(s)
		else:
			return '*'
	elif s < 10:
		return str(s * 10 ** (m - 1))
	else:
		return str(9) + maximal(m - 1, s - 9)

def minimal(m, s, m_start):
	if s > 9 * m:
		return '*'
	if s == 0:
		if m == m_start:
			if m == 1:
				return str('0')
			else:
				return '*'
		else:
			if m == 1:
				return str('0')
			return str(0) + minimal(m - 1, s, m_start)
	if m == 1:
		if s in range(10):
			return str(s)
		else:
			return '*'
	elif m == m_start:
		index_list = [s - i <= 9 * (m - 1) for i in range(1, 10)]
		if True in index_list:
			index_ = index_list.index(True) + 1
			return str(index_) + minimal(m - 1, s - index_, m_start)
		else:
			return '*'
	else:
		index_list = [s - i <= 9 * (m - 1) for i in range(10)]
		if True in index_list:
			index_ = index_list.index(True)
			return str(index_) + minimal(m - 1, s - index_, m_start)
		else:
			return '*'
input_ = list(map(int, input().split()))
(m, s) = (input_[0], input_[1])
(out_1, out_2) = (maximal(m, s), minimal(m, s, m))
if '*' in list(out_1) or '*' in list(out_2):
	print(str(-1) + ' ' + str(-1))
else:
	print(out_2, end=' ')
	print(out_1)


(n, m) = tuple(map(int, input().split()))
if m == 0:
	if n == 0 or n > 1:
		print(-1, -1)
	else:
		print(0, 0)
elif 9 * n < m:
	print(-1, -1)
elif n == 0 and m > 1:
	print(-1, -1)
else:
	mare = ''
	mic = ''
	cn = n
	cm = m
	while cn or cm:
		if cm:
			if cm > 9:
				mare += '9'
				cm -= 9
			else:
				mare += str(cm)
				cm = 0
		else:
			mare += '0'
		cn -= 1
	mic = list(mare[::-1])
	mic = [i for i in mic if i != '0']
	g = n - len(mic)
	mici = ''
	if g == 0:
		for i in mic:
			mici += i
	else:
		mici += '1'
		g -= 1
		mic[0] = str(int(mic[0]) - 1)
		while g:
			g -= 1
			mici += '0'
		for i in mic:
			mici += i
	print(mici, mare)


from copy import copy
(m, s) = map(int, input().split())
k = s
if m == 1:
	if not 0 <= s <= 9:
		print(-1, -1)
	else:
		print(s, s)
elif not 1 <= s <= 9 * m:
	print(-1, -1)
else:
	max_digits = []
	while k > 9:
		max_digits.append(9)
		k -= 9
	if k > 0:
		max_digits.append(k)
		while len(max_digits) < m:
			max_digits.append(0)
	if not 0 in max_digits:
		min_digits = copy(max_digits)
		min_digits.reverse()
	else:
		min_digits = [0] * m
		min_digits[0] = 1
		s -= 1
		compt = m - 1
		while s > 9:
			min_digits[compt] = 9
			compt -= 1
			s -= 9
		min_digits[compt] += s
	(mn, mx) = ('', '')
	for i in range(m):
		mx += str(max_digits[i])
		mn += str(min_digits[i])
	print(mn, mx)


(m, s) = list(map(int, input().split()))
cs = s
if s == 0 and m > 1 or s > m * 9:
	print('-1 -1')
else:
	largest = [0] * m
	i = 0
	while i < m:
		x = min(9, s)
		largest[i] = x
		s = s - x
		i = i + 1
	smallest = largest[::-1]
	s = cs
	if s > 0 and smallest[0] == 0:
		i = 0
		while i < m:
			if smallest[i] != 0:
				break
			i = i + 1
		smallest[0] = 1
		smallest[i] -= 1
	largest = ''.join(map(str, largest))
	smallest = ''.join(map(str, smallest))
	print(smallest, largest)


def get_pairs(summ, m):

	def char(arr):
		return int(''.join(map(str, arr)))
	if summ == 0 and m == 1:
		print(0, 0)
		return
	if summ > 9 * m or summ < 1:
		print(-1, -1)
		return
	min_array = [0] * m
	min_array[0] = 1
	for i in range(m):
		diff = summ - sum(min_array)
		index = m - i - 1
		if diff == 0:
			break
		elif diff >= 9:
			min_array[index] = 9
		else:
			min_array[index] += diff
	max_array = [0] * m
	for i in range(m):
		diff = summ - sum(max_array)
		index = i
		if diff == 0:
			break
		elif diff >= 9:
			max_array[index] = 9
		else:
			max_array[index] += diff
	print(char(min_array), char(max_array))
m = input('')
(m, summ) = m.split(' ')
get_pairs(int(summ), int(m))


number1 = []
number2 = []
(m, s) = (int(x) for x in input().split())
y = s
for i in range(m):
	for j in range(1, 11):
		if s - 10 + j >= 0:
			number1.append(10 - j)
			s = s - 10 + j
			break
s = y
for l in range(1, 10):
	if s - l <= 9 * (m - 1) and s - l >= 0:
		number2.append(l)
		s = s - l
		break
for k in range(m - 1):
	for c in range(10):
		if s - c <= 9 * (m - k - 2):
			number2.append(c)
			s = s - c
			break
if len(number2) == m and len(number1) == m:
	for v in range(len(number1)):
		number1[v] = str(number1[v])
		number2[v] = str(number2[v])
	print(''.join(number2), ''.join(number1))
elif m == 1 and s == 0:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
if s > 9 * m:
	print('-1 -1')
elif s == 0 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	a = s // 9
	b = s % 9
	d = int(10 ** (m - a) * (10 ** a - 1)) + int(b * 10 ** (m - a - 1))
	if a + 1 < m:
		if b != 0:
			c = 10 ** (m - 1) + b * 10 ** a - 1
		else:
			c = 10 ** (m - 1) + 9 * 10 ** (a - 1) - 1
	else:
		c = (b + 1) * 10 ** a - 1
	print(int(c), d)


def solve(m, s):
	if (m, s) == (1, 0):
		ret = '0 0'
	elif s > 9 * m or s == 0:
		ret = '-1 -1'
	else:
		mxs = [1] + [0] * (m - 1)
		mns = [1] + [0] * (m - 1)
		(i, j) = (-1, 0)
		while s > 1:
			if mns[i] >= 9:
				i -= 1
			if mxs[j] >= 9:
				j += 1
			mns[i] += 1
			mxs[j] += 1
			s -= 1
		ret = ''.join(map(str, mns + [' '] + mxs))
	return ret
(m, s) = map(int, input().split())
print(solve(m, s))


(l, s) = map(int, input().split())
if s == 0 and l == 1:
	print(0, 0)
elif s < 1 or 9 * l < s:
	print(-1, -1)
else:
	a = [0] * l
	b = [0] * l
	m = s
	for q in range(l):
		if s >= 9:
			a[q] = 9
			s -= 9
		else:
			a[q] = s
			s = 0
	s = m
	j = 0
	for q in range(l - 1, -1, -1):
		if s > 9:
			b[q] = 9
			s -= 9
		else:
			b[q] = s - 1
			s = 1
			j = 1
	b[0] += j
	for q in b:
		print(q, end='')
	print(' ', end='')
	for q in a:
		print(q, end='')
	print()


import sys
(m, s) = list(map(int, input().split()))
if m == 1 and s == 0:
	print('0 0')
	sys.exit()
if s > 9 * m or s <= 0:
	print('-1 -1')
	sys.exit()
(max, min) = ('', '')
minS = s
for i in range(m):
	if s - 9 >= 0:
		max = max + '9'
		s = s - 9
	else:
		max = max + '{0}'.format(s)
		s = 0
s = minS
for i in range(m - 1):
	if s - 1 >= 9:
		min = min + '9'
		s = s - 9
	else:
		min = min + '{0}'.format(s - 1)
		s = 1
if s == 1:
	min = min + '1'
else:
	min = min + '{0}'.format(s)
print(min[::-1], max)


(m, s) = map(int, input().split())
remainder_str = str(s % 9) if s % 9 > 0 else ''
min_num = remainder_str + '9' * (s // 9)
max_num = '9' * (s // 9) + remainder_str
if len(min_num) == 0:
	min_num = max_num = 0 if m == 1 else -1
elif len(min_num) > m:
	min_num = max_num = -1
elif len(min_num) < m:
	min_num = '1' + '0' * (m - len(min_num) - 1) + str(int(min_num[0]) - 1) + min_num[1:]
	max_num = max_num + '0' * (m - len(max_num))
print(min_num, max_num)


a = map(int, input().split())
b = list(a)
m = b[0]
s = b[1]
c = []
d = []
x = ''
n = ''
if s == 0 and m != 1 or s > 9 * m:
	print(-1, -1)
else:
	for i in range(m):
		if s >= 9:
			c.append(9)
			s -= 9
		else:
			c.append(s)
			s = 0
	for i in range(m):
		x += str(c[i])
	s = b[1]
	for i in range(m):
		if s > 9:
			d.append(9)
			s -= 9
		elif s <= 9 and i == m - 1:
			d.append(s)
		elif s <= 9 and s > 1:
			d.append(s - 1)
			s = 1
		elif s == 1 and i != m - 1:
			d.append(0)
		else:
			d.append(0)
	for i in range(m):
		n += str(d[m - 1 - i])
	print(n, x)


(m, s) = [int(i) for i in input().split()]
if s > 9 * m or (s == 0 and m > 1):
	print(-1, -1)
elif m == 1:
	print(s, s)
else:
	m1 = ''
	m2 = ''
	bit = s // 9
	m1 = '9' * bit
	if m != bit:
		m1 += str(s % 9) + (m - 1 - bit) * '0'
	if m == bit:
		m2 = m1
	elif m - bit == 1:
		if m1[m - 1] == '0':
			m2 = '1' + '8' + '9' * (bit - 1)
		else:
			m2 = m1[m - 1] + m1[:m - 1]
	elif s % 9 == 0:
		m2 = '1' + (m - bit - 1) * '0' + '8' + '9' * (bit - 1)
	else:
		m2 = '1' + (m - bit - 2) * '0' + str(s % 9 - 1) + bit * '9'
	print(m2, m1)


(m, s) = [int(x) for x in input().split()]
if s > 9 * m:
	print('-1 -1')
elif s == 0 and m != 1:
	print('-1 -1')
else:
	L = []
	for i in range(0, m):
		k = 9
		while s - k < 0:
			k = k - 1
			if k == 0:
				break
		K = str(k)
		L.append(K)
		s = s - k
	MAX = ''.join(L)
	N = L[::-1]
	if N[0] == '0':
		for n in range(0, m):
			if N[n] != '0':
				N[n] = str(int(N[n]) - 1)
				N[0] = '1'
				break
	MIN = ''.join(N)
	print('%s %s' % (MIN, MAX))


(m, s1) = map(int, input().split())
if s1 == 0 and m == 1:
	print('0 0')
elif s1 == 0 or s1 > 9 * m:
	print('-1 -1')
else:
	(l1, l2) = ([0] * m, [0] * m)
	for i in range(m):
		if s1 >= 9:
			l1[i] = 9
			s1 -= 9
		else:
			l1[i] = s1
			break
	l2 = l1[::-1]
	if l2[0] == 0:
		l2[0] = 1
		i = 1
		while i <= m - 1:
			if l2[i] != 0:
				l2[i] -= 1
				break
			i += 1
	print(''.join([str(x) for x in l2]), ' ', ''.join([str(x) for x in l1]))


st = input().split()
a = int(st[0])
b = int(st[1])
if b == 0:
	if a == 1:
		print('0 0')
	else:
		print('-1 -1')
elif 9 * a < b:
	print('-1 -1')
else:
	mini = int(10 ** (a - 1))
	aux = b
	b -= 1
	i = 0
	while b > 9:
		mini += 9 * 10 ** i
		i += 1
		b -= 9
	mini += b * 10 ** i
	b = aux
	i = a - 1
	maxi = 0
	while b > 9:
		maxi += 9 * 10 ** i
		i -= 1
		b -= 9
	maxi += b * 10 ** i
	print(str(mini) + ' ' + str(maxi))


(n, s) = [int(i) for i in input().split()]

def pos(n, s):
	if s >= 0 and s <= 9 * n:
		return True
	return False
if n == 1:
	if s > 9:
		print(-1, -1)
	else:
		print(s, s)
elif s == 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	temp = s
	minn = ''
	for i in range(n):
		for j in range(10):
			if (i > 0 or j > 0 or (n == 1 and j == 0)) and pos(n - i - 1, s - j):
				minn += str(j)
				s -= j
				break
	maxx = ''
	for i in range(n):
		for j in range(9, -1, -1):
			if (i > 0 or j > 0 or (n == 1 and j == 0)) and pos(n - i - 1, temp - j):
				maxx += str(j)
				temp -= j
				break
	if minn and maxx:
		print(minn, maxx)
	else:
		print(-1, -1)


import sys
import math
_inputs = [x for x in '1 0\n'.split('\n') if bool(x)]
if '--debug' not in sys.argv:
	_inputs = [input() for _ in range(len(_inputs))]
(m, s) = [int(x) for x in _inputs[0].split()]
if s > m * 9 or (m > 1 and s < 1):
	print('-1 -1')
	exit()

def calculate_sum(number_string):
	return sum([int(x) for x in number_string])

def find_smallest(m, s):
	result = ['1'] + ['0'] * (m - 1)
	pos = -1
	while calculate_sum(result) != s:
		difference = s - calculate_sum(result)
		to_add = 9 if difference >= 9 else difference
		result[pos] = str(int(result[pos]) + to_add)
		pos -= 1
	return result

def find_biggest(m, s):
	result = ['9'] * m
	pos = -1
	while calculate_sum(result) != s:
		difference = calculate_sum(result) - s
		to_remove = 9 if difference >= 9 else difference
		result[pos] = str(int(result[pos]) - to_remove)
		pos -= 1
	return result
print(''.join(find_smallest(m, s)))
print(''.join(find_biggest(m, s)))


(N, s) = [int(i) for i in input().split()]
if s > 9 * N or (s < 1 and N > 1):
	print('-1 -1')
elif s == 9 * N:
	print('9' * N + ' ' + '9' * N)
else:
	print()
	a = s // 9
	b = s % 9
	max = '9' * a + str(b) + '0' * (N - 1 - a)
	if N == a + 1:
		min = str(b) + '9' * a
	elif b != 0:
		min = '1' + '0' * (N - 2 - a) + str(b - 1) + '9' * a
	else:
		min = '1' + '0' * (N - a - 1) + '8' + '9' * (a - 1)
	print(min + ' ' + max)


(m, s) = map(int, input().split())
if 0 < s and s <= m * 9:
	mins = [0] * m
	mins[0] = 1
	t = s - 1
	it = m - 1
	while it >= 0 and t > 0:
		if t > 9:
			mins[it] = 9
			t -= 9
			it -= 1
		else:
			mins[it] += t
			it -= 1
			t -= t
	maxs = [0] * m
	t = s
	it = 0
	while it < m and t > 0:
		if t > 9:
			maxs[it] = 9
			t -= 9
			it += 1
		else:
			maxs[it] = t
			t -= t
			it += 1
	for el in mins:
		print(el, end='')
	print(end=' ')
	for el in maxs:
		print(el, end='')
elif m == 1 and 0 <= s <= 9:
	print(s, s)
else:
	print(-1, -1)


n = input().split()
m = int(n[0])
s = int(n[1])
l = m
k = s
min = ''
max = ''
x = []
x2 = []
y = []
if 9 * m >= s >= 1:
	if 9 * m > s > (m - 1) * 9:
		x.append(s - 9 * (s // 9))
		s = 9 * (s // 9)
		m = m - 1
	elif s == 9 * m:
		x.append(9)
		s = s - 9
		m = m - 1
	elif s == 0:
		x.append(0)
		m = m - 1
	else:
		x.append(1)
		s = s - 1
		m = m - 1
	for i in range(m):
		if s // 9 > 0:
			x2.append(9)
			s = s - 9
		elif s // 9 == 0:
			x2.append(s)
			s = 0
		elif k == 0:
			x2.append(0)
			s = 0
	x2.reverse()
	x = x + x2
	for i in x:
		min = min + str(i)
	for i in range(l):
		if k // 9 > 0:
			y.append(9)
			k = k - 9
		elif k // 9 == 0:
			y.append(k)
			k = 0
		elif k == 0:
			y.append(0)
			k = 0
	for i in y:
		max = max + str(i)
	print(min, max)
elif s == 0 and m == 1:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
a = [0] * m
a[0] = 1
sum = 1
if s == 0 and m == 1:
	print(0, 0)
elif s - sum < 0:
	print('-1 -1')
elif s - sum == 0:
	for _ in range(len(a)):
		print(a[_], end='')
	print(' ', end='')
	for _ in range(len(a)):
		print(a[_], end='')
else:
	k = (s - sum) // 9
	j = (s - sum) % 9
	if k >= m:
		print('-1 -1')
	else:
		for _ in range(k):
			a[len(a) - _ - 1] = 9
		a[len(a) - k - 1] += j
		b = [0] * m
		b[0] = 1
		sum = 1
		if 9 < s:
			b[0] = 9
			k = (s - 9) // 9
			j = (s - 9) % 9
			if k > m - 1:
				print('-1 -1')
			elif k == m - 1:
				for _ in range(len(a)):
					print(a[_], end='')
				print(' ', end='')
				for _ in range(len(a)):
					print(a[_], end='')
			else:
				for _ in range(k):
					b[_ + 1] = 9
				b[1 + k] += j
				for _ in range(len(a)):
					print(a[_], end='')
				print(' ', end='')
				for _ in range(len(b)):
					print(b[_], end='')
		elif 9 == s:
			for _ in range(len(a)):
				print(a[_], end='')
			print(' ', end='')
			print('9' + '0' * (m - 1))
		else:
			b[0] = s
			for _ in range(len(a)):
				print(a[_], end='')
			print(' ', end='')
			for _ in range(len(b)):
				print(b[_], end='')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

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

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	(m, s) = mi()
	if s == 0:
		if m == 1:
			print(0, 0)
		else:
			print(-1, -1)
	elif 9 * m < s:
		print(-1, -1)
	else:
		tmp = s - 1
		if tmp > 0 and m - 1 > 0:
			x = ''
			for i in range(m - 1):
				if tmp >= 9:
					x += str(9)
					tmp -= 9
				else:
					x += str(tmp)
					tmp = 0
			if tmp == 0:
				x = '1' + x[::-1]
			else:
				x = str(tmp + 1) + x[::-1]
		else:
			x = str(s) + '0' * (m - 1)
		j = m
		while s - 9 * j < 0:
			j -= 1
		mx = str(9) * j
		if s - 9 * j > 0:
			mx += str(s - 9 * j)
		if len(mx) < m:
			mx += '0' * (m - len(mx))
		print(x, mx)
main()


line = input()
ll = line.split()
n = int(ll[0])
m = int(ll[1])
if n != 1 and m == 0 or 9 * n < m:
	print('-1 -1')
else:
	h = ''
	for i in range(n):
		if m - 9 <= 0:
			break
		m -= 9
		h += '9'
	h1 = h + str(m)
	H = len(h)
	for i in range(n - H - 1):
		h1 += '0'
	if n - H == 1:
		h2 = str(m) + h
	if n - H > 1:
		h2 = str(m - 1) + h
		for i in range(n - H - 2):
			h2 = '0' + h2
		h2 = '1' + h2
	print(h2, h1)


import math
(m, s) = input().split()
m = int(m)
s = int(s)
minn = []
maxn = []
m1 = 9 * m - s
m2 = s
if (m == 1) & (s == 0):
	print('0 0')
elif (s == 0) | (s > 9 * m):
	print('-1 -1')
else:
	for i in range(m):
		t = min(9, m2)
		m2 -= t
		maxn.append(t)
		u = min(9 - (i == 0), m1)
		m1 -= u
		minn.append(9 - u)
	mins = []
	for x in minn:
		mins.append(str(x))
	print(''.join(mins), end=' ')
	maxs = []
	for x in maxn:
		maxs.append(str(x))
	print(''.join(maxs))


import sys
import math
from collections import defaultdict

def main():
	(m, s) = list(map(int, sys.stdin.readline().strip().split(' ')))
	if s == 0 and m > 1 or s > m * 9:
		sys.stdout.write('-1 -1')
		return
	a = [0] * m
	rs = s
	rm = m
	while rs > 0:
		t = rs - 1 if rm > 1 else rs
		if t == 0:
			a[0] = 1
			rs = 0
		for i in range(9, 0, -1):
			if t >= i:
				rs -= i
				a[rm - 1] = i
				rm -= 1
				break
	min_res = ''.join(map(str, a))
	ra = list(reversed(a))
	if ra[-1] == 1:
		for i in range(len(ra) - 1):
			if ra[i] < 9:
				ra[i] += 1
				ra[-1] = 0
				break
	max_res = ''.join(map(str, ra))
	sys.stdout.write('%s %s' % (min_res, max_res))
main()


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


(m, s) = map(int, input().split())
list1 = ['0'] * m
list2 = ['0'] * m
list1[-1] = '1'
list2[0] = '1'
if m == 1 and s == 0:
	print('0 0')
	exit()
if m * 9 < s or s == 0:
	print('-1 -1')
elif m * 9 == s:
	list1 = ['9'] * m
	print(''.join(list1), ''.join(list1))
	exit()
elif m == 1:
	print(s, s)
else:
	for i in range(0, (s - 1) // 9):
		list1[i] = '9'
		list1[(s - 1) // 9] = str((s - 1) % 9)
	for i in range(0, s // 9):
		list2[i] = '9'
		list2[s // 9] = str(s % 9)
	if s == 1:
		print(''.join(list2), ''.join(list2))
	elif s > 9 * (m - 1):
		list1[-1] = str(s % 9)
		print(''.join(list(reversed(list1))), ''.join(list2))
	elif m > 2 and s > 9:
		print(''.join(list(reversed(list1))), ''.join(list2))
	elif m > 2 and s <= 9:
		list1[0] = str(s - 1)
		list2[0] = str(s)
		print(''.join(list(reversed(list1))), ''.join(list2))
	elif m == 2 and s > 9:
		print(''.join(list(reversed(list2))), ''.join(list2))
	else:
		list1 = ['1', str(s - 1)]
		list2 = [str(s), '0']
		print(''.join(list1), ''.join(list2))


(a, s) = map(int, input().split())
if a == 1 and s == 0:
	print(0, 0)
elif s < 1 or 9 * a < s:
	print(-1, -1)
else:
	ans = ['0'] * a
	t = s
	for i in range(len(ans) - 1, 0, -1):
		if t >= 10:
			t -= 9
			ans[i] = '9'
		else:
			ans[i] = str(t - 1)
			ans[0] = '1'
			break
	else:
		ans[0] = str(t)
	print(''.join(ans), end=' ')
	ans = ['0'] * a
	t = s
	for i in range(len(ans)):
		if t >= 9:
			t -= 9
			ans[i] = '9'
		else:
			ans[i] = str(t)
			break
	print(''.join(ans))


def main():
	(m, s) = map(int, input().split())
	if s == 0:
		if m == 1:
			print(0, 0)
		else:
			print(-1, -1)
		exit()
	for i in range(1, 10):
		if 0 <= s - i <= (m - 1) * 9:
			k = s - i
			a = []
			for j in range(m - 1):
				a.append(min(9, k))
				k -= min(9, k)
			print(''.join(map(str, [i] + a[::-1])))
			break
	else:
		print(-1)
	k = s
	a = []
	for j in range(m):
		a.append(min(9, k))
		k -= min(9, k)
	if k:
		print(-1)
	else:
		print(''.join(map(str, a)))
main()


(m, s) = input().split()
(m, s) = (int(m), int(s))
a = s
x = 0
y = 0
n = 0
if s == 0:
	if m == 1:
		x = 0
		y = 0
	else:
		x = -1
		y = -1
elif s > 9 * m:
	x = -1
	y = -1
else:
	while s > 0:
		if s > 9:
			y += 9 * 10 ** n
			s -= 9
		elif s == 1:
			y += 10 ** (m - 1)
			s = 0
		else:
			y += (s - 1) * 10 ** n
			n += 1
			s = 1
		n += 1
	s = a
	del a, n
	while s > 0:
		if s >= 9:
			x += 9 * 10 ** (m - 1)
			m -= 1
			s -= 9
		else:
			x += s * 10 ** (m - 1)
			s = 0
print(y, x)


def findmaxnum(a, b):
	strmax = ''
	strmin = ''
	for i in range(a):
		if b - 9 > 0:
			strmax += '9'
			b -= 9
		else:
			strmax += str(b)
			if a - 1 - i > 0:
				strmin = '1' + '0' * (a - i - 2)
				for j in range(len(strmax)):
					if j == 0:
						strmin += str(int(strmax[len(strmax) - 1]) - 1)
					else:
						strmin += str(strmax[len(strmax) - 1 - j])
			else:
				for j in range(len(strmax)):
					strmin += strmax[len(strmax) - 1 - j]
			strmax += '0' * (a - 1 - i)
			break
	return strmin + ' ' + strmax

def findminnum(a, b):
	strmin = ''
(a, b) = map(int, input().split())
if a == 1 and b == 0:
	print('0 0')
elif b > 9 * a or b == 0:
	print('-1 -1')
else:
	print(findmaxnum(a, b))


(m, s) = [int(x) for x in input().split()]
if m > 1 and s < 1 or s > 9 * m:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif s <= 9:
	min_num = [s, 10 + s - 1]
	max_num = [s, 10 * s]
	for i in range(2, m):
		min_num.append(min_num[i - 1] - 10 ** (i - 1) + 10 ** i)
		max_num.append(max_num[i - 1] * 10)
	print('%d %d' % (min_num[m - 1], max_num[m - 1]))
elif s > 9:
	start_m = int(s / 9)
	nines = sum([9 * 10 ** i for i in range(start_m)])
	min_num = [nines + (s - 9 * start_m) * 10 ** start_m]
	if s % 9 != 0:
		delta = min(1, m - start_m)
		max_num = [nines * 10 ** delta + s - 9 * start_m]
		for i in range(start_m + 1, m):
			min_num.append(min_num[i - start_m - 1] - 10 ** (i - 1) + 10 ** i)
			max_num.append(max_num[i - start_m - 1] * 10)
		print('%d %d' % (min_num[-1], max_num[-1]))
	else:
		max_num = [nines]
		for i in range(start_m + 1, m + 1):
			min_num.append(min_num[i - start_m - 1] - 10 ** (i - 2) + 10 ** (i - 1))
		max_num.append(nines * 10 ** (m - start_m))
		print('%d %d' % (min_num[-1], max_num[-1]))


import sys
import math
import bisect

def query_minimum_value(n, m):
	A = [0] * n
	if n > 1:
		A[0] = 1
		m -= 1
	for i in range(n - 1, -1, -1):
		while m and A[i] < 9:
			A[i] += 1
			m -= 1
	return int(''.join(list((str(a) for a in A))))

def query_maximum_value(n, m):
	A = [0] * n
	if n > 1:
		A[0] = 1
		m -= 1
	for i in range(n):
		while m and A[i] < 9:
			A[i] += 1
			m -= 1
	return int(''.join(list((str(a) for a in A))))

def solve(n, m):
	if n > 1 and m == 0:
		return [-1, -1]
	if m > n * 9:
		return [-1, -1]
	min_val = query_minimum_value(n, m)
	max_val = query_maximum_value(n, m)
	return [min_val, max_val]

def main():
	(n, m) = map(int, input().split())
	ans = solve(n, m)
	print(' '.join(list((str(a) for a in ans))))
main()


(m, s) = map(int, input().split())
if s == 0 and m == 1:
	print(0, 0)
else:
	(lsts, lstl) = ([1] + (m - 1) * [0], [1] + (m - 1) * [0])
	s -= 1
	t = s
	for i in range(m - 1, -1, -1):
		if s >= 9 - lsts[i]:
			k = lsts[i]
			lsts[i] = 9
			s -= 9 - k
		elif s >= 0:
			lsts[i] += s
			s = 0
			break
	for i in range(m):
		if t >= 9 - lstl[i]:
			k = lstl[i]
			lstl[i] = 9
			t -= 9 - k
		elif t >= 0:
			lstl[i] += t
			t = 0
			break
	if s == 0 and t == 0:
		for i in lsts:
			print(i, end='')
		print(' ', end='')
		for i in lstl:
			print(i, end='')
		print('')
	else:
		print(-1, -1)


(n, s) = map(int, input().split())
l = [0] * n
h = [0] * n
p = s % n
if s > 9 * n:
	print('-1 -1')
elif s == 0 and n != 1:
	print('-1 -1')
else:
	nines = s // 9
	k = nines
	remainder = s % 9
	i = -1
	while nines:
		l[i] = 9
		i -= 1
		nines -= 1
	index = n + i
	if index == 0:
		if remainder != 0:
			l[0] = remainder
		if remainder == 0:
			l[0] = 1
			l[i + 1] -= 1
	elif index > 0:
		if remainder - 1 >= 0:
			l[index] = remainder - 1
		else:
			l[i + 1] -= 1
		l[0] = 1
	v = 0
	while k:
		h[v] = 9
		v += 1
		k -= 1
	if v < n:
		h[v] = remainder
	low = ''
	high = ''
	for i in range(n):
		low += str(l[i])
		high += str(h[i])
	print(low, high)


(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print('0 0')
	exit()
if m * 9 < s or s == 0:
	print(str(-1) + ' ' + str(-1))
	exit()
max_n = ''
t = s
for _ in range(m):
	n = min(t, 9)
	max_n += str(n)
	t -= n
min_n_r = ''
t = s
for i in range(m):
	n = min(t, 9)
	t -= n
	if t == 0 and i != m - 1:
		min_n_r += str(n - 1)
		t += 1
	else:
		min_n_r += str(n)
min_n = ''
for c in reversed(min_n_r):
	min_n += c
print(min_n, max_n)


(m, s) = map(int, input().split())
sn = ''
ln = ''
a = s
t = 0
k = s
for i in range(1, m):
	if s >= 10:
		sn = sn + str(9)
		ln = str(9) + ln
		s = s - 9
		k = s
	elif t != 1:
		sn = str(s - 1) + sn
		ln = ln + str(k)
		k = 0
		t = 1
		s = 1
	else:
		sn = '0' + sn
		ln = ln + '0'
sn = str(s) + sn
ln = ln + str(k)
if a == 0:
	sn = '0'
	ln = '0'
if len(sn) != m:
	print(-1, end=' ')
else:
	print(sn, end=' ')
if len(ln) != m:
	print(-1, end=' ')
else:
	print(ln, end=' ')


(n, s) = map(int, input().split())
s2 = ''

def large(s, n):
	s1 = ''
	k = s
	while k > 9:
		k -= 9
		s1 += str(9)
	s1 += str(k)
	for i in range(n - len(s1)):
		s1 += '0'
	return s1
if (s != 0 or n == 1) and s <= 9 * n:
	s1 = large(s, n)
	s2 = ''
	kk = n
	ss = s
	if (n - 1) * 9 > s:
		s2 += '1'
		kk = n - 1
		ss = s - 1
	s3 = large(ss, kk)
	for i in range(kk):
		s2 += s3[kk - 1 - i]
else:
	s1 = s2 = '-1'
print(s2, s1)


from math import *
from collections import *
(n, m) = map(int, input().split())
m1 = m
s = []
s1 = []
if n == 1 and m == 0:
	print('0 0')
elif m == 0 or 9 * n < m:
	print('-1 -1')
else:
	for i in range(n):
		if m1 >= 9:
			s.append('9')
			m1 -= 9
		else:
			s.append(str(m1))
			m1 = 0
	for i in range(n):
		if i == 0:
			if (n - i - 1) * 9 > m - 1:
				s1.append('1')
				m -= 1
			else:
				s1.append(str(m - (n - i - 1) * 9))
				m -= m - (n - i - 1) * 9
		elif (n - i - 1) * 9 > m:
			s1.append('0')
		else:
			s1.append(str(m - (n - i - 1) * 9))
			m -= m - (n - i - 1) * 9
	print(''.join(s1), ''.join(s))


s = input()
s = s.split()
l = int(s[0])
su = int(s[1])
if su < 1 or su > 9 * l:
	if su == 0 and l == 1:
		print(0, 0)
	else:
		print('-1 -1')
else:
	list1 = l * ['0']
	list2 = l * ['0']
	su1 = su
	su2 = su
	i = 0
	while su1 > 9:
		list1[i] = str(9)
		i = i + 1
		su1 -= 9
	list1[i] = str(su1)
	k = l - 1
	list2[0] = '1'
	su2 -= 1
	while su2 > 9:
		list2[k] = str(9)
		k -= 1
		su2 -= 9
	list2[k] = str(int(list2[k]) + su2)
	print(''.join(list2), ''.join(list1))


import sys
(m, s) = map(int, sys.stdin.readline().split())
if s == 0 and m == 1:
	print(0, 0)
elif s >= 1 and s <= 9 * m:
	if s == 9 * m:
		print('9' * m, '9' * m)
	elif s >= 9 * m - 8:
		print(str(s % 9) + '9' * (m - 1), '9' * (m - 1) + str(s % 9))
	else:
		t = (s - 1) // 9
		i = s - 9 * t - 1
		s_min = '1' + '0' * (m - t - 2) + str(i) + '9' * t
		t2 = s // 9
		i2 = s % 9
		s_max = '9' * t2 + str(i2) + '0' * (m - t2 - 1)
		print(s_min, s_max)
else:
	print(-1, -1)


__author__ = 'user'
(m, s) = map(int, input().split())
if s == 0 and m > 1 or s > 9 * m:
	min_num = max_num = -1
elif m == 1:
	min_num = max_num = s
else:
	nns1 = s // 9
	d = s % 9
	max_num = '9' * nns1
	if nns1 != m:
		max_num += str(d) + '0' * (m - nns1 - 1)
	if s <= (m - 1) * 9:
		nns2 = (s - 1) // 9
		d = (s - 1) % 9
		min_num = '1' + '0' * (m - nns2 - 1 - 1)
		if nns2 != m:
			min_num += str(d) + '9' * nns2
	else:
		min_num = ''
		if s // 9 != m:
			min_num = str(s % 9)
		min_num += '9' * (s // 9)
print(min_num, max_num)


(n, m) = map(int, input().split())
if m <= 0:
	if n == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	a = 9 * n
	if m > a:
		print(-1, -1)
	else:
		s = int('1' + '0' * (n - 1))
		k = m
		m = m - 1
		t = 1
		s = ''
		for i in reversed(range(0, n)):
			if m > 9:
				s += '9'
				m = m - 9
			else:
				if i == 0:
					s += str(m + 1)
				else:
					s += str(m)
				m = 0
		s1 = ''
		m = k
		for i in range(0, n):
			if m > 9:
				s1 += '9'
				m -= 9
			else:
				s1 += str(m)
				m = 0
		print(s[::-1], s1)


(x, y) = map(int, input().split())
if x == 1 and y == 0:
	print(0, 0)
	exit()
if y > 9 * x or y == 0:
	print(-1, -1)
else:
	s = ''
	t = []
	while y >= 9:
		s = s + '9'
		y = y - 9
	if len(s) != x:
		s = s + str(y)
		if len(s) != x:
			while len(s) != x:
				s = s + '0'
	ans = s[::-1]
	if s.count('0') != 0:
		t = list(ans)
		for i in range(len(t)):
			if t[i] != '0':
				break
		t[0] = 1
		t[i] = int(t[i]) - 1
		print(''.join(map(str, t)), s)
	else:
		print(''.join(map(str, ans)), s)


(n, s) = map(int, input().split())
if s == 0 and n > 1 or s > 9 * n:
	print('-1 -1')
elif s == 0 and n == 1:
	print('0 0')
else:
	l = ''
	min = ''
	k = s
	for _ in range(n):
		if k > 9:
			l += str(9)
			k = k - 9
		else:
			l += str(k % 10)
			k = k - k % 10
	while s > 9:
		min += str(9)
		s -= 9
	if len(min) < n - 1:
		s = s - 1
	min += str(s % 10)
	for _ in range(0, n - len(min) - 1):
		min += str(0)
	if len(min) < n:
		min += str(1)
	print(min[::-1], l)


(m, s) = map(int, input().split())
ch = ''
ch1 = ''
x = s
if m * 9 < s or (s == 0 and m != 1):
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	for i in range(m):
		ch += str(min(x, 9))
		x -= min(x, 9)
	ch1 = ch[::-1]
	if ch1.count('0') == 0:
		print(ch1, ' ', ch, sep='')
	else:
		ch2 = list(ch1)
		(ch2[ch1.count('0')], ch2[0]) = (ch2[0], ch2[ch1.count('0')])
		ch2[ch1.count('0')] = str(max(int(ch2[0]) - 1, 0))
		ch2[0] = '1'
		print(''.join(ch2), ' ', ch)


line = str(input()).split()
length = int(line[0])
sum_digit = int(line[1])
sum_digit2 = sum_digit
A = []
B = []
C = []
if sum_digit == 1:
	A.append('1')
	for i in range(length - 1):
		A.append('0')
	print(''.join(A), ''.join(A))
elif sum_digit != 0 and length * 9 >= sum_digit:
	while sum_digit >= 9:
		A.append('9')
		sum_digit = sum_digit - 9
	if sum_digit != 0:
		A.append(str(sum_digit))
	last_num = length - len(A)
	for i in range(last_num):
		A.append('0')
	max_num = ''.join(A)
	if '0' in A:
		sum_digit2 = sum_digit2 - 1
		while sum_digit2 >= 9:
			B.append('9')
			sum_digit2 = sum_digit2 - 9
		if sum_digit2 != 0:
			B.append(str(sum_digit2))
		last_num = length - len(B)
		for i in range(last_num - 1):
			B.append('0')
		B.append('1')
		for j in range(length):
			C.append(B[length - j - 1])
	else:
		for i in range(length):
			C.append(A[length - i - 1])
	min_num = ''.join(C)
	print(min_num, max_num)
elif length == 1 and sum_digit == 0:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
if not m == 1 and s == 0:
	print(-1, -1)
elif s > 9 * m:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif s == 9 * m:
	te = ''
	for i in range(m):
		te = te + '9'
	print(te, te)
elif s > 9 * (m - 1) and s < 9 * m:
	max = ''
	min = str(s % 9)
	for i in range(m - 1):
		max = max + '9'
		min = min + '9'
	max = max + str(s % 9)
	print(min, max)
elif s // 9 == 0:
	min = '1'
	for i in range(m - 2):
		min = min + '0'
	min = int(min) * 10 + s - 1
	print(min, s % 9 * 10 ** (m - 1))
else:
	n = s // 9
	dyu = str(s % 9)
	ma = []
	for i in range(n):
		ma.append('9')
	ma.append(dyu)
	for i in range(m - n - 1):
		ma.append('0')
	max = ''
	for i in ma:
		max = max + i
	x = (s - 1) // 9
	xyu = str((s - 1) % 9)
	mi = ['1']
	for i in range(m - 2 - x):
		mi.append('0')
	mi.append(xyu)
	for i in range(x):
		mi.append('9')
	min = ''
	for i in mi:
		min = min + i
	print(int(min), int(max))


(m, s) = [int(i) for i in input().split()]
if s > m * 9:
	print('-1 -1')
elif s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	Max = []
	n9 = s // 9
	if n9 > 0:
		for i in range(n9):
			Max.append(9)
	others = s - 9 * n9
	if others > 0:
		Max.append(others)
	n0 = m - len(Max)
	if n0 > 0:
		for i in range(n0):
			Max.append(0)
	N9 = (s - 1) // 9
	if m == N9 + 1:
		first = s - 9 * N9
		Min = [first]
		if N9 > 0:
			for i in range(N9):
				Min.append(9)
	else:
		Others = s - 1 - 9 * N9
		N0 = m - N9 - 2
		if n0 > 0:
			Min = [1]
			for i in range(N0):
				Min.append(0)
			Min.append(Others)
			for i in range(N9):
				Min.append(9)
		else:
			Min = [1, Others]
			for i in range(N9):
				Min.append(9)
	xiao = []
	for i in Min:
		xiao.append(str(i))
	da = []
	for i in Max:
		da.append(str(i))
	print(''.join(xiao), end=' ')
	print(''.join(da))


(m, s) = input().split()
m = int(m)
s = int(s)
if s > 9 * m:
	print('-1 -1')
elif s < 1 and m > 1:
	print('-1 -1')
elif s == 0 and m == 1:
	print('0 0')
else:
	a = s // 9
	b = s % 9
	max = ''
	max += a * '9'
	if a < m:
		max += str(b)
	while len(max) < m:
		max += '0'
	a = (s - 1) // 9
	b = (s - 1) % 9
	min = ''
	min += a * '9'
	min += str(b)
	while len(min) < m:
		min += '0'
	min = list(str(int(min) + 1))
	if s - 1 == 0:
		min2 = max
	else:
		min2 = ''
		for i in range(m):
			min2 += min[m - i - 1]
	print(min2, max)


a = list(map(int, input().split()))
summ = a[1]
leng = a[0]
if leng == 1 and summ == 0:
	print('0 0')
	exit()
if summ == 0 or leng * 9 < summ:
	print('-1 -1')
	exit()
maximum = ''
tmp = summ
for i in range(9, 0, -1):
	if a[1] / i > 0:
		maximum += str(i) * int(tmp / i)
		tmp -= int(tmp / i) * i
maximum += '0' * (leng - len(maximum))
minimum = list(reversed(maximum))
if minimum[0] == '0':
	minimum[0] = '1'
	for i in range(1, len(minimum)):
		if int(minimum[i]) > 0:
			minimum[i] = str(int(minimum[i]) - 1)
			break
print(''.join(minimum) + ' ' + maximum)


(q, w) = map(int, input().split())
r = 9 * q - w
if q == 1 and w == 0:
	print('0 0')
elif r < 0 or w == 0:
	print('-1 -1')
else:
	t = '9' * (q - r // 9 - 1) + str(9 - r % 9) + '0' * (r // 9)
	if r // 9 > 0:
		if 9 - r % 9 > 0:
			e = '1' + '0' * (r // 9 - 1) + str(9 - r % 9 - 1) + '9' * (q - r // 9 - 1)
		else:
			e = '1' + '0' * (r // 9) + str(9 - 1) + '9' * (q - r // 9 - 2)
	else:
		e = str(9 - r % 9) + '9' * (q - r // 9 - 1)
	print(e + ' ' + t)


(n, s) = map(int, input().split())
s1 = s
s2 = s
maxs = ''
mins = ''
maxcount = 0
mincount = 0
if s < 1 or n * 9 < s:
	if n == 1 and s == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	while s1 > 0:
		if s1 >= 9:
			s1 -= 9
			maxcount += 1
			maxs = maxs + '9'
		else:
			maxs = maxs + str(s1)
			s1 = 0
			maxcount += 1
	if maxcount < n:
		maxs = maxs + '0' * (n - maxcount)
	while s2 > 1 and mincount < n - 1:
		if s2 > 9:
			s2 -= 9
			mincount += 1
			mins = '9' + mins
		else:
			mins = str(s2 - 1) + mins
			mincount += 1
			s2 = 1
	if mincount < n - 1:
		mins = '1' + '0' * (n - 1 - mincount) + mins
	elif mincount == n - 1:
		mins = str(s2) + mins
	print(mins + ' ' + maxs)


j = [int(i) for i in input().split(' ')]
leng = j[0]
summ = j[1]
if leng == 1 and summ == 0:
	print('0 0')
elif leng * 9 < summ or summ <= 0:
	print('-1 -1')
else:
	mi = []
	ma = []
	for i in range(leng):
		mi.append(0)
		ma.append(0)
	i = 0
	while summ > 9:
		mi[leng - 1 - i] = 9
		ma[i] = 9
		summ = summ - 9
		i += 1
	if summ <= 9:
		ma[i] = summ
		if ma.count(0) > 0:
			mi[leng - 1 - i] = summ - 1
			mi[0] = 1
		else:
			mi[leng - 1 - i] = summ
	mi = ''.join((str(x) for x in mi))
	ma = ''.join((str(x) for x in ma))
	print(mi, ma)


(l, s) = map(int, input().split())
if l == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > 9 * l:
	print(-1, -1)
else:
	mystr = ''
	for x in range(l):
		if s >= 9 and s != 0:
			mystr = mystr + '9'
			s -= 9
		elif s < 9 and s != 0:
			mystr = mystr + str(s)
			s = 0
		else:
			mystr = mystr + '0'
	rev = mystr[::-1]
	pos = mystr.find('0')
	if pos == -1:
		print(rev, end=' ')
	else:
		pos = l - pos
		rev = '1' + rev[1:pos] + str(int(rev[pos]) - 1) + rev[pos + 1:]
		print(rev, end=' ')
	print(mystr)


d = False
f = False
[a, b] = [int(i) for i in input().split()]
if a == 1 and b == 0:
	f = True
ma = [0] * a
if b == 0:
	d = True
for i in range(a):
	ma[i] = min(9, b)
	b = b - ma[i]
if b > 0:
	d = True
maa = ''.join([str(i) for i in ma])
if ma[-1] == 0:
	for i in range(len(ma)):
		if ma[i] == 0:
			ma[i - 1] -= 1
			break
	ma.reverse()
	ma[0] = 1
else:
	ma.reverse()
mii = ''.join([str(i) for i in ma])
if d:
	maa = -1
	mii = -1
if f:
	maa = 0
	mii = 0
print(mii, maa)


def least(n, m, s):
	if m == 0 and s == 0:
		return n
	if n == '':
		beg = 1
	else:
		beg = 0
	if m * 9 < s:
		return ''
	for i in range(beg, 10):
		ans = least(n + str(i), m - 1, s - i)
		if ans != '':
			return ans

def most(n, m, s):
	if m == 0 and s == 0:
		return n
	if s < 0:
		return ''
	for i in range(9, -1, -1):
		ans = most(n + str(i), m - 1, s - i)
		if ans != '':
			return ans
(m, s) = map(int, input().split())
if m * 9 < s:
	print('-1 -1')
elif s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	print(least('', m, s), most('', m, s))


(a, b) = input().split()
a = int(a)
b = int(b)
f = b
if a == 1 and b <= 9:
	print(b, end=' ')
	print(b)
	exit()
if a > 1 and b == 0:
	print(-1, end=' ')
	print(-1)
	exit()
if 9 * a < b:
	print(-1, end=' ')
	print(-1)
	exit()
if 9 * (a - 1) > b:
	c = 1
else:
	c = b - 9 * (a - 1)
b = b - c
d = str(c)
for i in range(1, a):
	if b < 9 and i != a - 1:
		d = d + '0'
	elif 9 * (a - 1 - i) > b:
		d = d + '0'
	elif 9 * (a - 1 - i) <= b:
		c = b - 9 * (a - 1 - i)
		b = b - c
		d = d + str(c)
e = ''
for i in range(1, a + 1):
	if f >= 9:
		e = e + '9'
		f = f - 9
	else:
		e = e + str(f)
		f = 0
print(d, end=' ')
print(e)


import sys

def sol(s):
	s1 = '1'
	t = True
	for i in range(1, len(s)):
		if s[i] != '0' and t:
			s1 += str(int(s[i]) - 1)
			t = False
		else:
			s1 += s[i]
	return s1
(m, s) = map(int, input().split())
n = s
ans = ''
for i in range(m):
	if s >= 9:
		ans += '9'
		s -= 9
	else:
		ans += str(s)
		s = 0
if m == 1 and n == 0:
	print(0, 0)
	sys.exit()
if s != 0 or n == 0:
	print('-1 -1')
	sys.exit()
ans1 = ans[::-1]
if ans1[0] == '0':
	ans1 = sol(ans1)
print(ans1, ans)


while True:
	try:
		(m, s) = [int(i) for i in input().split()]
		if s == 0 and m == 1:
			print('0 0')
		elif s < 1 or s > 9 * m:
			print('-1 -1')
		else:
			if 9 * (m - 1) >= s:
				min = [1]
			else:
				min = [s - 9 * (m - 1)]
			if s > 9:
				max = [9]
			else:
				max = [s]
			for i in range(m - 1):
				m -= 1
				s1 = s - sum(min)
				s2 = s - sum(max)
				if 9 * (m - 1) > s1:
					min.append(0)
				else:
					min.append(s1 - 9 * (m - 1))
				if s2 >= 9:
					max.append(9)
				else:
					max.append(s2)
			min = [str(i) for i in min]
			max = [str(i) for i in max]
			print(''.join(min) + ' ' + ''.join(max))
	except EOFError:
		break


def main():
	(length, sum_of_digits) = map(int, input().split())
	min_number = max_number = -1
	arr = []
	if sum_of_digits == 0 and length != 1 or sum_of_digits > length * 9:
		print('-1 -1')
		return 0
	elif length == 1:
		print(sum_of_digits, sum_of_digits, sep=' ')
		return 0
	temp = sum_of_digits - 1
	for i in range(length - 1):
		arr.append(min(9, temp))
		temp -= min(temp, 9)
	arr.append(temp + 1)
	arr = reversed(arr)
	min_number = ''.join(map(str, arr))
	arr = []
	for i in range(length):
		arr.append(min(sum_of_digits, 9))
		sum_of_digits -= min(sum_of_digits, 9)
	max_number = ''.join(map(str, arr))
	print(min_number, max_number, sep=' ', end='\n')
main()


(length, total) = [int(x) for x in input().split()]
min_num = -1
max_num = -1
if total <= 9 and length == 1:
	min_num = total
	max_num = total
elif total <= 9 * length and total != 0:
	q = total // 9
	rem = total % 9
	num = ['0'] * length
	if q == length:
		num = ['9'] * length
	else:
		num[q] = str(rem)
	for i in range(q):
		num[i] = '9'
	max_num = int(''.join(num))
	first_digit = 0
	q = total // 9
	rem = total % 9
	num = ['0'] * length
	s1 = 0
	if q == length - 1 and rem != 0:
		num = ['9'] * length
		num[0] = str(rem)
	elif q + 1 < length:
		s1 = total - 1
		first_digit = 1
		rem = s1 % 9
		q = s1 // 9
		for i in range(length - q, length):
			num[i] = '9'
		num[0] = str(first_digit)
		num[length - 1 - q] = str(rem)
	elif q == length - 1 and rem == 0:
		q -= 1
		first_digit = 1
		num[0] = str(first_digit)
		num[1] = '8'
		for i in range(length - q, length):
			num[i] = '9'
	elif q == length:
		num = '9' * length
	min_num = int(''.join(num))
print(min_num, max_num)


import sys
import math
import time
(m, s) = [int(j) for j in input().split()]
if s == 0 and m != 1:
	print('-1 -1')
	exit()
if s == 0 and m == 1:
	print('0 0')
	exit()
if s <= m * 9:
	r = s % 9
	ns = math.floor(s / 9)
	lo = m - 1 - ns
	if r != 0:
		max_a = '9' * ns + str(r)
	else:
		max_a = '9' * ns
	max_a = max_a.ljust(m, '0')
else:
	print('-1 -1')
	exit()
if s <= m * 9:
	ds = [1] + [0] * (m - 1)
	its = s - 1
	ix = m - 1
	while its > 0:
		if ix < 0:
			print('-1 -1')
			exit()
		if ix != 0:
			mn = 9
		else:
			mn = 8
		if its >= mn:
			its -= mn
			ds[ix] += mn
		else:
			ds[ix] += its
			its = 0
		ix -= 1
	min_a = ''.join([str(g) for g in ds])
else:
	print('-1 -1')
	exit()
print(f'{min_a} {max_a}')


(m, s) = [int(x) for x in input().split()]
r = ''
rx = ''
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or s > 9 * m:
	print(-1, -1)
elif m == 1:
	print(s, s)
elif s < 10:
	print('1' + '0' * (m - 2) + str(s - 1), str(s) + '0' * (m - 1))
elif s == m * 9:
	print('9' * m, '9' * m)
else:
	for i in range(1000):
		r += '9'
		s -= 9
		if s <= 9:
			break
	rx = r
	r += str(s)
	if len(r) < m:
		r += '0' * (m - len(r))
	if len(rx) < m - 1:
		rx = '1' + (m - len(rx) - 2) * '0' + str(s - 1) + rx
	else:
		rx = str(s) + rx
	print(rx, r)


from math import log10
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print(0, 0)
	else:
		print(-1, -1)
else:
	maxx = 0
	i1 = 0
	for _ in range(s, 8, -9):
		maxx = maxx * 10 + 9
		i1 += 1
	if i1 > m:
		print(-1, -1)
	elif i1 == m:
		if s % 9 == 0:
			print(maxx, maxx)
		else:
			print(-1, -1)
	else:
		maxx = maxx * 10 + s % 9
		i1 += 1
		for _ in range(i1, m):
			maxx *= 10
		minn = list(reversed(str(maxx)))
		for i in range(0, len(minn) - 1):
			if minn[i] == '0' and minn[i + 1] != '0':
				minn[0] = '1'
				minn[i + 1] = str(int(minn[i + 1]) - 1)
				break
		print(''.join(minn), maxx)


def ss(n, m):
	if m > n * 9:
		return '-1 -1'
	if m < n:
		if m == 0:
			if n == 1:
				return '0 0'
			else:
				return '-1 -1'
	slist = ['9'] * ((m - 1) // 9) + [str((m - 1) % 9)]
	if len(slist) == n:
		k = int(slist.pop())
		slist.append(str(k + 1))
		small = ''.join(sorted(slist))
	else:
		while True:
			if len(slist) >= n - 1:
				break
			slist.append('0')
		small = '1' + ''.join(sorted(slist))
	blist = ['9'] * (m // 9) + [str(m % 9)]
	if m % 9 == 0:
		del blist[-1]
	while True:
		if len(blist) >= n:
			break
		blist.append('0')
	big = ''.join(sorted(blist, reverse=True))
	return small + ' ' + big
s = input()
k = list(map(int, s.split()))
n = k[0]
m = k[1]
print(ss(n, m))


def maxn(a, b):
	ans = ''
	if b < 9:
		ans += str(b)
		ans += '0' * (a - 1)
	else:
		ans += '9'
		b = b - 9
		a = a - 1
		if a > 0:
			d = b // 9
			os = b % 9
			ans += '9' * d
			if os % 9 != 0:
				ans += str(os)
			if a - len(ans) + 1 > 0:
				ans += '0' * (a - len(ans) + 1)
	return ans

def minn(a, b):
	ans = ''
	if b > (a - 1) * 9:
		if b % 9 != 0:
			ans += str(b % 9)
		else:
			ans += '9'
		ans += '9' * (a - 1)
	else:
		ans += '1'
		b = b - 1
		a = a - 1
		if a > 0:
			d = b // 9
			os = b % 9
			if a - d - 1 > 0:
				ans += '0' * (a - d - 1)
			ans += str(os)
			ans += '9' * d
	return ans
(x, y) = map(int, input().split(' '))
if x == 1 and y == 0:
	print('0 0')
elif 9 * x < y or y == 0:
	print('-1 -1')
else:
	print(minn(x, y), maxn(x, y))


(m, s) = map(int, input().split(' '))
st = [0] * m
st[0] = 1
mx = [0] * m
b = s - 1
z = s
if s > 1:
	i = m - 1
	while i > -1:
		if b > 9:
			st[i] += 9
			b -= 9
		else:
			st[i] += b
			b = 0
			break
		i -= 1
st2 = 0
mx2 = 0
j = 0
while j < m:
	if s > 9:
		mx[j] = 9
		s -= 9
	else:
		mx[j] = s
		s = 0
	j += 1
sm = sum(mx)
for i in range(m):
	st2 = st2 * 10 + st[i]
	mx2 = mx2 * 10 + mx[i]
st1 = str(st2)
mx1 = str(mx2)
if b != 0:
	if m == 1 and b == -1:
		print('0 0')
	else:
		print('-1 -1')
elif sm != z:
	print('-1 -1')
else:
	print(st1 + ' ' + mx1)


def can(m, s):
	return s >= 0 and s <= 9 * m
s = input().split(' ')
l = int(s[0])
s = int(s[1])
a1 = ''
a2 = ''
s1 = s
s2 = s
if s != 0 and l * 9 >= s or (s == 0 and l == 1):
	for i in range(l):
		if s1 >= 9:
			a1 += '9'
			s1 -= 9
		else:
			a1 += chr(s1 + ord('0'))
			s1 = 0
	for i in range(l):
		for d in range(10):
			if (i > 0 or d > 0 or (l == 1 and d == 0)) and can(l - i - 1, s2 - d):
				a2 += chr(ord('0') + d)
				s2 -= d
				break
	print(a2, a1)
else:
	print(-1, -1)


a = input().split()
m = int(a[0])
s = int(a[1])
if m == 1 and s == 0:
	print('0 0')
elif s < 1 or s > m * 9:
	print('-1 -1')
else:
	r = s % 9
	rk = str(r)
	l = s // 9
	list1 = []
	list2 = []
	if m - l == 1:
		list1.append(rk)
		for i in range(l):
			list1.append('9')
		word1 = ''.join(list1)
	elif m - l == 0:
		for i in range(l):
			list1.append('9')
		word1 = ''.join(list1)
	else:
		if r > 0:
			x = '1' + '0' * (m - l - 2)
			list1.append(x)
			rl = str(r - 1)
			list1.append(rl)
			for i in range(l):
				list1.append('9')
		if r == 0:
			x = '1' + '0' * (m - l - 1)
			list1.append(x)
			list1.append('8')
			for i in range(l - 1):
				list1.append('9')
		word1 = ''.join(list1)
	for i in range(l):
		list2.append('9')
	if m - l > 0:
		list2.append(rk)
	if m - l - 1 > 0:
		for i in range(m - l - 1):
			list2.append('0')
	word2 = ''.join(list2)
	print(word1, word2)


(m, s) = [int(x) for x in input().split()]

def imax(m, s):
	if s > 9 * m:
		return -1
	elif s == 0:
		if m == 1:
			return 0
		else:
			return -1
	else:
		k = s // 9
		l = s - k * 9
		if l == 0:
			return (10 ** k - 1) * 10 ** (m - k)
		else:
			return (10 ** (k + 1) - 10 + l) * 10 ** (m - k - 1)

def imin(m, s):
	if s > 9 * m:
		return -1
	elif s == 0:
		if m == 1:
			return 0
		else:
			return -1
	elif s > m * 9 - 8:
		l = s - 9 * m + 9
		return (l + 1) * 10 ** (m - 1) - 1
	else:
		k = (s - 1) // 9
		l = s - 1 - k * 9
		return 10 ** (m - 1) + (l + 1) * 10 ** k - 1
print(int(imin(m, s)), int(imax(m, s)))


(m, s) = map(int, input().split())
min_num = 1
max_num = 2
if s == 0 and m > 1 or s > 9 * m:
	print('-1 -1')
elif s == 0:
	print('0 0')
elif s <= 9:
	min_num = 1 * 10 ** (m - 1) + s - 1
	max_num = s * 10 ** (m - 1)
	print(min_num, max_num)
else:
	min_list = [1] + [0] * (m - 1)
	max_list = [9] + [0] * (m - 1)
	k = s - 1
	s -= 9
	j = m - 1
	i = 1
	while s != 0:
		if s >= 9:
			max_list[i] = 9
			s -= 9
			i += 1
		else:
			max_list[i] = s
			s = 0
	while k != 0:
		if k >= 9:
			min_list[j] = 9
			j -= 1
			k -= 9
		else:
			min_list[j] += k
			k = 0
	min_num = ''.join(map(str, min_list))
	max_num = ''.join(map(str, max_list))
	print(min_num, max_num)


x = input().split()
x[0] = int(x[0])
x[1] = int(x[1])
if x[0] * 9 < x[1] or (x[0] > 1 and x[1] == 0):
	print(-1, -1)
else:
	a = int(x[1] / 9)
	b = x[1] - 9 * a
	if a == x[0]:
		for i in range(x[0]):
			print(9, end='')
	elif b == 0 and a != 0:
		print(1, end='')
		t = 2
		while 1 < t < x[0] - a + 1:
			print(0, end='')
			t += 1
		while t == x[0] - a + 1:
			print(8, end='')
			t += 1
		while x[0] - a + 1 < t <= x[0]:
			print(9, end='')
			t += 1
	elif b == 0 and a == 0:
		print(0)
	elif b != 0 and a < x[0] - 1:
		print(1, end='')
		t = 2
		while 1 < t <= x[0] - a - 1:
			print(0, end='')
			t += 1
		while t == x[0] - a:
			print(b - 1, end='')
			t += 1
		while x[0] - a < t <= x[0]:
			print(9, end='')
			t += 1
	elif b != 0 and a == x[0] - 1:
		print(b, end='')
		t = 2
		while x[0] - a <= t <= x[0]:
			print(9, end='')
			t += 1
	print(end=' ')
	for i in range(x[0]):
		if i < a:
			print(9, end='')
		elif a < i <= x[0] - 1:
			print(0, end='')
		else:
			print(b, end='')


a = input().split(' ')
m = int(a[0])
s = int(a[1])
if m == 1 and s < 10:
	print(str(s) + ' ' + str(s))
elif s < 1 or s > m * 9:
	print('-1 -1')
else:
	n1 = [0] * m
	n1[0] = 1
	e = s - 1
	pos = m - 1
	while e > 9:
		n1[pos] += 9
		e -= 9
		pos -= 1
	n1[pos] += e
	ans = ''
	for i in range(m):
		ans += str(n1[i])
	ans += ' '
	n2 = [0] * m
	n2[0] = 1
	e = s - 1
	pos = 0
	if e >= 8:
		n2[0] += 8
		e -= 8
		pos += 1
	while e > 9:
		n2[pos] += 9
		e -= 9
		pos += 1
	if pos < m:
		n2[pos] += e
	for i in range(m):
		ans += str(n2[i])
	print(ans)


def prov(n, s):
	if s == 0:
		if n == 1:
			return 1
		else:
			return 0
	elif n * 9 < s:
		return 0
	else:
		return 2

def prov2(s):
	i = 0
	f = 0
	while i < len(s):
		if s[i] != 0:
			f = 1
			break
		i += 1
	if f == 1 and 0 in s:
		s[i] -= 1
		s[0] = 1
	return s

def main():
	(n, s) = [int(i) for i in input().split()]
	res = prov(n, s)
	if res == 0:
		print(-1, -1)
		return 0
	elif res == 1:
		print(0, 0)
		return 0
	d1 = s // 9
	p1 = s % 9
	q1 = n - d1 - (p1 > 0) * 1
	st = d1 * [9]
	if p1:
		st = [p1] + st
	if q1:
		st = [0] * q1 + st
	ans2 = st[::-1] * 1
	ans1 = prov2(st)
	print(*ans1, sep='', end=' ')
	print(*ans2, sep='', end=' ')
main()


from typing import *
from math import *
TESTING = False
if TESTING:

	def input():
		return stdin.readline().strip()
if TESTING:
	stdin = open('TEST\\1.in')
(m, s) = map(int, input().split())
if s == 0:
	if m == 1:
		print('0 0')
	else:
		print('-1 -1')
else:
	n = [0] * m
	n[0] = 1
	index = 0
	ns = []
	min_value = ['-1']
	max_value = ['-1']
	if sum(n) == s:
		ns = map(str, n)
		min_value = ''.join(ns)
		print(min_value, min_value)
		exit()
	while not all((v == 9 for v in n)):
		if n[m - 1 - index] != 9:
			n[m - 1 - index] += 1
		else:
			index += 1
			n[m - 1 - index] += 1
		if sum(n) == s:
			ns = map(str, n)
			min_value[0] = ''.join(ns)
			n.sort(reverse=True)
			if 1 in n:
				for i in range(len(n)):
					if n[i] != 9:
						n[i] += 1
						if 1 in n:
							n[len(n) - 1 - n[::-1].index(1)] = 0
						else:
							n[len(n) - 1 - n[::-1].index(2)] = 1
						break
			ns = map(str, n)
			max_value[0] = ''.join(ns)
			break
	print(min_value[0], max_value[0])


(n, s) = map(int, input().split())
r = ''
s1 = s
if s == 0 and n == 1:
	print('0' * n, '0' * n)
elif s == 0:
	print('-1 -1')
else:
	while s > 0:
		a = min(s, 9)
		s = s - a
		r = r + str(a)
	if len(r) > n:
		r = -1
	else:
		z = n - len(r)
		r = r + '0' * z
		if r[0] == '0' and r[-1] != '0':
			r = -1
	if r == -1:
		print('-1', end=' ')
	else:
		r = str(r)
		if r[-1] != '0':
			print(r[::-1], end=' ')
		else:
			a = list(r[::-1])
			for i in range(1, len(a)):
				if a[i] == '0':
					pass
				else:
					a[i] = str(int(a[i]) - 1)
					break
			a[0] = '1'
			p = ''.join(a)
			print(p, end=' ')
	print(r, end=' ')


def solve(m, s):
	if s == 0:
		return (0, 0) if m == 1 else (-1, -1)
	if s > 9 * m:
		return (-1, -1)
	if s == 1:
		return ('1' + '0' * (m - 1), '1' + '0' * (m - 1))
	maxnum = []
	while s > 9:
		maxnum.append('9')
		s -= 9
	maxnum.append(str(s))
	n = len(maxnum)
	maxnum.extend(['0' for i in range(m - n)])
	minnum = list(reversed(maxnum))
	if m > n:
		minnum[0] = '1'
		if s > 0:
			minnum[-n] = str(s - 1)
		else:
			minnum[-n - 1] = str('8')
	return (''.join(minnum), ''.join(maxnum))
(m, s) = [int(x) for x in input().split()]
ans = solve(m, s)
print(ans[0], ans[1])


[m, s] = [int(x) for x in input().split()]

def min_and_max(som, l):
	if som == 0 and l > 1:
		return [-1, -1]
	if som <= 9:
		return [1 * 10 ** (l - 1) + som - 1, som * 10 ** (l - 1)]
	if som > l * 10 - l:
		return [-1, -1]
	else:
		[k1, k2] = min_and_max(som - 9, l - 1)
		return [9 + k1 * 10, 9 * 10 ** (l - 1) + k2]
print(*min_and_max(s, m), sep=' ')


data = [int(i) for i in input().split()]
(n, s) = data
if 0 < s < n * 9:
	a = s // 9
	b = s % 9
	if a == 0:
		s1 = 10 ** (n - 1) + b - 1
		s2 = b * 10 ** (n - 1)
	elif a < n - 1:
		if b == 0:
			s1 = ['1', '0' * (n - a - 1), '8', '9' * (a - 1)]
			s2 = ['9' * a, '0' * (n - a)]
		else:
			s1 = ['1', '0' * (n - a - 2), str(b - 1), '9' * a]
			s2 = ['9' * a, str(b), '0' * (n - a - 1)]
		s1 = ''.join(s1)
		s2 = ''.join(s2)
	else:
		s1 = [str(b), '9' * a]
		s2 = ['9' * a, str(b)]
		s1 = ''.join(s1)
		s2 = ''.join(s2)
	print(s1, s2)
elif s == n * 9:
	s1 = s2 = '9' * n
	print(s1, s2)
elif n == 1 and s <= 9:
	s1 = s2 = s
	print(s1, s2)
else:
	print('-1 -1')


(a, b) = [int(i) for i in input().split()]
a1 = a2 = a
b1 = b2 = b
if 9 * a < b:
	print('-1 -1')
elif b == 0:
	if a == 1:
		print('0', '0')
	else:
		print('-1 -1')
else:
	d = ''
	e = ''
	while a1 > 0:
		c = b1
		if c >= 9:
			c = 9
		d += str(c)
		a1 -= 1
		b1 -= c
	while a2 > 0:
		c = b2 - 9 * a2 + 9
		if c < 1:
			if e == '':
				c = 1
			else:
				c = 0
		e += str(c)
		a2 -= 1
		b2 -= c
	print(e, d)


A = input()
num = A.split(' ')
numreal = [int(i) for i in num]
resultmax = ''
resultmin = ''
if numreal[1] > numreal[0] * 9 or numreal[1] < 0 or (numreal[1] == 0 and numreal[0] != 1):
	print('-1 -1')
else:
	digi9 = numreal[1] // 9
	digix = numreal[1] % 9
	for i in range(0, digi9):
		resultmax += '9'
	a = numreal[0] - 1 - digi9
	if a >= 0:
		resultmax += str(digix)
	while a > 0:
		resultmax += '0'
		a -= 1
	if digix != 0:
		a = numreal[0] - 1 - digi9
		if a > 0:
			resultmin += '1'
			a -= 1
			for i in range(0, a):
				resultmin += '0'
			resultmin += str(digix - 1)
			for i in range(0, digi9):
				resultmin += '9'
		else:
			resultmin += str(digix)
			for i in range(0, digi9):
				resultmin += '9'
	elif digi9 != 0:
		a = numreal[0] - 1 - digi9
		if a >= 0:
			resultmin += '1'
			for i in range(0, a):
				resultmin += '0'
			resultmin += '8'
			for i in range(0, digi9 - 1):
				resultmin += '9'
		else:
			for i in range(0, digi9):
				resultmin += '9'
	else:
		resultmin = '0'
	print(resultmin, resultmax)


(n, s) = list(map(int, input().split()))
if n != 1 and s == 0 or s > 9 * n:
	print(-1, -1)
else:
	a = s // 9
	b = s % 9
	ls = ['9'] * a + [str(b)] * bool(n - a) + ['0'] * (n - a - 1)
	if a + 1 >= n:
		lt = [str(b)] + ['9'] * a
	elif b != 0:
		lt = ['1'] + ['0'] * (n - 2 - a) + [str(b - 1)] + ['9'] * a
	else:
		lt = ['1'] + ['0'] * (n - a - 1) + ['8'] + ['9'] * (a - 1)
	print(int(''.join(lt)), int(''.join(ls)))


a = input().split()
l = int(a[0])
m = int(a[1])
if m > 9 * l or (m == 0 and l != 1):
	print('-1 -1')
elif m == 9 * l:
	for i in range(l):
		print(9, end='')
	print(' ', end='')
	for i in range(l):
		print(9, end='')
	print(' ', end='')
elif l == 1:
	print(m, m)
else:
	b = [0 for i in range(l)]
	b[0] = 1
	t = (m - 1) // 9
	for i in range(l - t, l):
		b[i] = 9
	if l - t - 1 == 0:
		b[l - t - 1] = m % 9
	else:
		b[l - t - 1] = (m - 1) % 9
	for i in range(l):
		print(b[i], end='')
	print(' ', end='')
	if b[l - 1] == 0:
		for i in range(l):
			print(b[i], end='')
	elif b[0] == 1:
		b[0] = 0
		b[l - t - 1] += 1
		for i in range(l - 1, -1, -1):
			print(b[i], end='')
	else:
		for i in range(l - 1, -1, -1):
			print(b[i], end='')


(m, s) = map(int, input().split())
if 9 * m < s:
	print(-1, -1)
elif m >= 2 and s == 0:
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	mi = ''
	s1 = s - 1
	while s1 > 0:
		if s1 <= 9:
			mi += str(s1)
			s1 = 0
		else:
			mi += '9'
			s1 -= 9
	while len(mi) < m - 1:
		mi += '0'
	if len(mi) == m:
		mi = str(int(mi[-1]) + 1) + mi[-2::-1]
	else:
		mi = '1' + mi[::-1]
	ma = ''
	while s > 9:
		ma += '9'
		s -= 9
	ma += str(s)
	while len(ma) < m:
		ma += '0'
	print(mi, ma)


(n, j) = map(int, input().split())
p = j % 9
q = j // 9
if n < q or (n == q and p != 0) or (j == 0 and n != 1):
	print('-1 -1')
elif n == 1 and j == 0:
	print('0 0')
elif p == 0 and q == n:
	print('9' * q, '9' * q)
else:
	t = j % 9
	w = j // 9
	if n > w + 1:
		t = t - 1
		if t < 0:
			t = 9 + t
			w = w - 1
		else:
			w = w
		k = 1
		x = n - w - k - 1
	else:
		w = w
		(x, k) = (0, 0)
	print('1' * k, end='')
	print('0' * x, end='')
	print(t, end='')
	print('9' * w, end=' ')
	r = n - q - 1
	print('9' * q, end='')
	print(p, end='')
	print('0' * r, end=' ')


(a, s) = map(int, input().split())
if s == 0 and a > 1 or s > 9 * a:
	print(-1, -1)
else:
	maxx = ''
	s1 = s
	for i in range(a):
		if s1 >= 9:
			s1 -= 9
			maxx += '9'
		else:
			maxx += str(s1)
			s1 -= s1
	minn = ''
	if s == 0:
		minn = 0
	else:
		s -= 1
		for i in range(a - 1, 0, -1):
			if s >= 9:
				s -= 9
				minn = '9' + minn
			else:
				minn = str(s) + minn
				s -= s
		minn = str(1 + s) + minn
	print(minn, maxx)


(m, s) = list(map(int, input().split()))
if 9 * m < s or (s == 0 and m > 1):
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	(x, y) = divmod(s, 9)
	postfix = ''
	if y != 0:
		postfix = str(y)
	biggest = '9' * x + postfix + (m - x - len(postfix)) * '0'
	smallest = biggest[::-1]
	if m - x - len(postfix) > 0:
		if y > 0:
			y -= 1
			smallest = '1' + '0' * (m - x - 2) + str(y) + '9' * x
		else:
			smallest = '1' + '0' * (m - x - 2) + '08' + '9' * (x - 1)
	print(smallest, biggest)


(m, s) = map(int, input().split())
maxi = 0
t1 = m
t2 = s
a = []
while t1 > 0:
	if t2 == 0:
		maxi *= 10
		a.append(0)
	else:
		temp = min(9, t2)
		maxi = maxi * 10 + temp
		a.append(temp)
		t2 -= temp
	t1 -= 1
a.reverse()
i = 0
while i < m:
	if a[i] != 0:
		break
	i += 1
if t2 != 0:
	print('-1 -1')
elif i == 0:
	print(''.join(map(str, a)), maxi)
elif i == m:
	if m == 1 and s == 0:
		print('0 0')
	else:
		print('-1 -1')
else:
	a[0] += 1
	a[i] -= 1
	print(''.join(map(str, a)), maxi)


(m, s) = map(int, input().split())
c = s // 9 * '9'
if s % 9:
	c += str(s % 9)
c += '0' * (m - len(c))
c2 = c[::-1]
if c.count('0') and s != 0:
	c2 = list(c)
	i = c2.index('0') - 1
	c2[i] = str(int(c2[i]) - 1)
	c2[-1] = '1'
	c2 = ''.join(c2[::-1])
if int(m) * 9 < s or (s == 0 and m > 1):
	print('-1', '-1')
else:
	print(c2, c)


arr = [int(i) for i in filter(None, input().split(' '))]
k = arr[0]
sum = arr[1]
num = ''
if sum == 0 or sum > k * 9:
	if k == 1 and sum == 0:
		print(0, 0)
	else:
		print('-1 -1')
else:
	while sum >= 9:
		num += '9'
		sum -= 9
		k -= 1
	if k >= 1:
		num += str(sum)
		k -= 1
	while k >= 1:
		num += '0'
		k -= 1
	ans = []
	min_num = num[::-1]
	if int(min_num[0]) > 0:
		print(min_num, num)
	else:
		for i in min_num:
			ans.append(int(i))
		for i in range(len(ans)):
			if ans[i] > 0:
				ans[i] -= 1
				ans[0] = 1
				break
		min_num = ''
		for i in ans:
			min_num += str(i)
		print(min_num, num)


(m, s) = map(int, input().split())
if s > 9 * m:
	print(-1, -1)
elif s == 0 and m > 1:
	print(-1, -1)
elif s == 0 and m == 1:
	print(0, 0)
else:
	maxn = []
	for i in range(m):
		if s > 9:
			maxn.append(9)
			s = s - 9
		elif s != 0:
			maxn.append(s)
			s = 0
		else:
			maxn.append(0)
	minn = []
	for i in range(m):
		minn.append(maxn[m - i - 1])
	i = 0
	while minn[i] == 0:
		i += 1
	if i != 0:
		minn[0] = 1
		minn[i] -= 1
	minn = map(str, minn)
	maxn = map(str, maxn)
	print(''.join(minn), ''.join(maxn))


(m, s) = [int(i) for i in input().split()]
if m > 1 and s < 1 or s > m * 9:
	print('-1 -1')
else:
	a1 = 10 ** (m - 1)
	q = (s - 1) // 9
	p = (s - 1) % 9
	a2 = (p + 1) * 10 ** q - 1
	mi = a1 + a2
	if s < 10:
		ma = s * 10 ** (m - 1)
	else:
		w = s // 9
		x = s % 9
		if w == m:
			ma = mi
		else:
			c = (10 - x) * 10 ** (m - w - 1)
			ma = 10 ** m - c
	print('%i %i' % (mi, ma))


line = input()
(a, b) = [int(i) for i in line.split()]
if b == 0 and a > 1 or b > 9 * a:
	print('-1 -1')
else:
	nummax = ''
	numnin = ''
	for i in range(a):
		digit = min(9, b)
		b = b - digit
		nummax += str(digit)
	nummin = nummax[::-1]
	if nummin[0] == '0':
		count = 0
		for i in range(a):
			if nummin[i] == '0':
				count += 1
		if a == 1:
			nummin = 0
		if a == 2:
			nummin = '1' + (count - 1) * '0' + str(int(nummin[count]) - 1)
		if a > 2:
			c = int(nummin[count])
			nummin = '1' + (count - 1) * '0' + str(c - 1) + nummin[count + 1:]
	print(int(nummin), int(nummax))


[m, s] = [int(s) for s in input().split()]
a = [0 for i in range(m)]
b = [0 for i in range(m)]
sa = s
i = m - 1
while i >= 0:
	if sa > 9:
		a[i] = 9
		sa = sa - 9
	else:
		a[i] = sa
		sa = 0
	i -= 1
fail = sa > 0
if not fail:
	if m > 1 and a[0] == 0:
		a[0] = 1
		found = False
		for i in range(1, m):
			if a[i] > 0:
				a[i] -= 1
				found = True
				break
		fail = not found
if fail:
	print(-1, -1)
else:
	sb = s
	for i in range(m):
		if sb > 9:
			b[i] = 9
			sb = sb - 9
		else:
			b[i] = sb
			sb = 0
	print('{0} {1}'.format(''.join(map(str, a)), ''.join(map(str, b))))


def findSmallest(m, s):
	if s == 0:
		if m == 1:
			print('0', end=' ')
		else:
			print('-1', end=' ')
		return
	if s > 9 * m:
		print('-1', end=' ')
		return
	res = [0 for i in range(m + 1)]
	s -= 1
	for i in range(m - 1, 0, -1):
		if s > 9:
			res[i] = 9
			s -= 9
		else:
			res[i] = s
			s = 0
	res[0] = s + 1
	for i in range(m):
		print(res[i], end='')
	print(end=' ')

def findLargest(m, s):
	if s == 0:
		if m == 1:
			print('0')
		else:
			print('-1')
		return
	if s > 9 * m:
		print('-1')
		return
	res = [0] * m
	for i in range(0, m):
		if s >= 9:
			res[i] = 9
			s = s - 9
		else:
			res[i] = s
			s = 0
	for i in range(0, m):
		print(res[i], end='')
(m, s) = map(int, input().split())
findSmallest(m, s)
findLargest(m, s)


import math

def facts(n):
	ans = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	ans = sorted(list(dict.fromkeys(ans)))
	if ans[-1] == n:
		ans = ans[:-1]
	return ans
(m, s) = map(int, input().split())
if m == 1 and s == 0:
	print(0, 0)
elif s == 0 or m * 9 < s:
	print(-1, -1)
elif s == 1 and m > 1:
	print(int(10 ** (m - 1)), int(10 ** (m - 1)))
else:
	arr = [1] + [0 for i in range(m - 1)]
	arrs = [0 for i in range(m)]
	(s1, s2) = (s - 1, 0)
	(pnt1, pnt2) = (-1, 0)
	while s1:
		while arr[pnt1] < 9 and s1:
			arr[pnt1] += 1
			s1 -= 1
		pnt1 -= 1
	while s2 < s:
		while arrs[pnt2] < 9 and s2 < s:
			arrs[pnt2] += 1
			s2 += 1
		pnt2 += 1
	for i in range(len(arr)):
		arr[i] = str(arr[i])
		arrs[i] = str(arrs[i])
	print(''.join(arr), ''.join(arrs))


(n, s) = map(int, input().rstrip().split())

def can(m, s):
	if s >= 0 and s <= 9 * m:
		return True
	else:
		return False
su = s
s2 = s
minn = ''
maxx = ''
count = 0
for i in range(0, n):
	for j in range(0, 10):
		if (i > 0 or j > 0 or (n == 1 and j == 0)) and can(n - 1 - i, su - j):
			minn += chr(ord('0') + j)
			su -= j
			break
	for j in range(9, -1, -1):
		if (i > 0 or j > 0 or (n == 1 and j == 0)) and can(n - 1 - i, s - j):
			maxx += chr(ord('0') + j)
			s -= j
			break
if s2 == 0 and n != 1 or s > 9 * n:
	print('-1 -1')
else:
	print(minn, maxx)


s = input().split()
m = int(s[0])
tot = int(s[1])
ans = []
if m == 1 and tot == 0:
	print('0 0')
	exit()
for i in range(m):
	if tot <= 9:
		ans.append(tot)
		tot = 0
	else:
		ans.append(9)
		tot = tot - 9
if ans[0] == 0 or tot > 0:
	print('-1 -1')
	exit()
if ans[m - 1] == 0:
	boo = True
	print('1', end='')
	for i in range(m - 1):
		if boo == True and ans[m - 2 - i] > 0:
			boo = False
			print(ans[m - 2 - i] - 1, end='')
		else:
			print(ans[m - 2 - i], end='')
else:
	for i in range(m):
		print(ans[m - 1 - i], end='')
print(' ', end='')
for i in range(m):
	print(ans[i], end='')
print()


import math, sys

def can(m, s):
	return s >= 0 and s <= 9 * m
(m, s) = map(int, input().split())
su = s
if s == 0 and m != 1 or (m == 0 and s != 0):
	print(-1, -1)
	sys.exit(0)
minn = 0
for i in range(m):
	for d in range(10):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, su - d):
			minn = minn * 10 + d
			su -= d
			break
su = s
maxx = 0
for i in range(m):
	for d in range(9, -1, -1):
		if (i > 0 or d > 0 or (m == 1 and d == 0)) and can(m - i - 1, su - d):
			maxx = maxx * 10 + d
			su -= d
			break
if minn == maxx == 0 and s != 0:
	print(-1, -1)
	sys.exit(0)
print(minn, maxx)


import sys
from math import log2, floor, ceil, sqrt, gcd
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 998244353
(n, m) = Ri()
arr = []
for i in range(n):
	val = min(9, m)
	arr.append(val)
	m -= val
if arr[0] == 0 and n != 1 or m > 0:
	print(-1, -1)
else:
	arr2 = arr[::-1]
	if arr2[0] != 0:
		print(''.join(map(str, arr2)), ''.join(map(str, arr)))
	else:
		flag = -1
		for i in range(len(arr2)):
			if arr2[i] != 0:
				flag = i
				break
		arr2[0] += 1
		arr2[i] -= 1
		print(''.join(map(str, arr2)), ''.join(map(str, arr)))


import sys
(d, s) = map(int, sys.stdin.readline().split())
(w, h) = (s + 1, d + 1)
m = [[-1 for x in range(w)] for y in range(h)]
n = [[-1 for x in range(w)] for y in range(h)]
for i in range(1, min(9, s) + 1):
	n[1][i] = m[1][i] = i
n[1][0] = 0
m[1][0] = 0
for i in range(2, d + 1):
	for j in range(1, min(9 * i, s) + 1):
		if j - 9 >= 1:
			m[i][j] = m[i - 1][j - 9] * 10 + 9
		else:
			m[i][j] = m[i - 1][1] * 10 + (j - 1)
		if n[i - 1][j] > 0:
			n[i][j] = n[i - 1][j] * 10
		else:
			n[i][j] = n[i][j - 1] + 1
print(m[d][s], n[d][s])


(m, s) = (1, 0)
(m, s) = [int(x) for x in input().split(' ')]
if s == 0 and m != 1 or m * 9 < s:
	print('-1 -1')
	exit(0)
target = s
result_max = ''
for i in range(m):
	for digit in reversed(range(0, 10)):
		if target >= digit:
			target -= digit
			result_max += str(digit)
			break
		if target == 0:
			break
	if len(result_max) != i + 1:
		result_max += '0'
target = s
result_min = ''
for i in range(m):
	for digit in reversed(range(0, 10)):
		if target - 1 >= digit:
			target -= digit
			result_min = str(digit) + result_min
			break
		if target == 0:
			break
	if len(result_min) != i + 1:
		result_min = '0' + result_min
if target == 1:
	result_min = str(int(result_min[0]) + 1) + result_min[1:]
print('{} {}'.format(result_min, result_max))


import sys
a = sys.stdin.readline()
a = a.split(' ')
m = int(a[0])
s = int(a[1])
if s > 9 * m or (s == 0 and m > 1):
	print('-1 -1')
elif m == 1:
	print(s, '', s)
else:
	Big = [0 for x in range(m)]
	p = 0
	while s > 9:
		s -= 9
		Big[p] = 9
		p += 1
	Big[p] = s
	Smal = [0 for x in range(m)]
	for x in range(m):
		Smal[x] = Big[x]
	Smal[p] -= 1
	Smal[m - 1] += 1
	for x in range(m):
		print(Smal[m - 1 - x], end='')
	print(' ', end='')
	for x in range(m):
		print(Big[x], end='')


maxnum = [0 for i in range(110)]
minnum = [0 for i in range(110)]
(m, s) = list(map(int, input().split()))
length = m
sum_num = s
if m * 9 < s:
	print('-1 -1')
else:
	m = m - 1
	while s > 9:
		minnum[m] = 9
		m = m - 1
		s = s - 9
	if m == 0:
		minnum[m] = s
	else:
		minnum[m] = s - 1
		minnum[0] = 1
	if minnum[m] < 0:
		print('-1', end='')
	else:
		for i in range(0, length):
			print(minnum[i], end='')
	print(' ', end='')
	m = 0
	s = sum_num
	while s > 9:
		maxnum[m] = 9
		s = s - 9
		m = m + 1
	maxnum[m] = s
	if maxnum[0] == 0 and length > 1:
		print('-1', end='')
	else:
		for j in range(0, length):
			print(maxnum[j], end='')


(m, s) = list(map(int, input().split()))
ans_min = ''
ans_max = ''
if s == 0 and m > 1 or s > m * 9:
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	mark_value = s
	mark_length = m - 2
	i = 1
	while len(ans_min) < 1:
		if (m - 1) * 9 + i >= s:
			ans_min += str(i)
			mark_value -= i
			break
		else:
			i += 1
	i = 0
	while len(ans_min) < m:
		if mark_length * 9 + i >= mark_value:
			ans_min += str(i)
			mark_length -= 1
			mark_value -= i
		else:
			i += 1
	mark_value = s
	mark_length = m - 2
	i = 9
	while len(ans_max) < 1:
		if i <= s:
			ans_max += str(i)
			mark_value -= i
			break
		else:
			i -= 1
	i = 9
	while len(ans_max) < m:
		if i <= mark_value:
			ans_max += str(i)
			mark_length -= 1
			mark_value -= i
		else:
			i -= 1
	print(ans_min, ans_max)


[m, s] = [int(i) for i in input().split()]
if s > 9 * m or (m != 1 and s == 0):
	print(-1, -1)
elif m == 1 and s == 0:
	print(0, 0)
else:
	max1 = min1 = 0
	if s <= 9:
		if not m == 1:
			max1 = str(s) + (m - 1) * '0'
			min1 = '1' + (m - 2) * '0' + str(s - 1)
		else:
			max1 = min1 = str(s)
	else:
		bit = s // 9
		if s != bit * 9:
			max1 = bit * '9' + str(s - 9 * bit) + (m - bit - 1) * '0'
			if m - bit - 1 == 0:
				min1 = str(s - 9 * bit) + bit * '9'
			else:
				min1 = '1' + (m - bit - 2) * '0' + str(s - 9 * bit - 1) + bit * '9'
		elif m == bit:
			max1 = min1 = bit * '9'
		else:
			max1 = bit * '9' + (m - bit) * '0'
			min1 = '1' + (m - bit - 1) * '0' + '8' + (bit - 1) * '9'
	print(min1, max1)


from math import *
(a, b) = map(int, input().split())
if a == 1 and b > 9:
	print(-1, -1)
elif a == 1 and b <= 9:
	print(b, b)
elif b == 0 and a > 1:
	print(-1, -1)
elif b == 0 and a == 1:
	print(0, 0)
else:
	small = []
	large = []
	val = int(ceil(b / 9))
	if val > a:
		print(-1, -1)
	else:
		if b % 9 != 0:
			val -= 1
		mod = b % 9
		if mod == 0 and a * 9 != b:
			print('1' + '0' * (a - val - 1) + '8' + '9' * (a - 2 - (a - val - 1)), '9' * val + '0' * (a - val))
			exit()
		if mod > 0 and val > 0 and (1 + val == a):
			small.append(mod * 10 ** val + int('9' * val))
		else:
			if mod > 0:
				small.append(1)
			for i in range(val):
				small.append(9)
			x = len(small)
			if x < a:
				small.insert(1, mod - 1)
				x += 1
			while x < a:
				small.insert(1, 0)
				x += 1
		for i in range(val):
			large.append(9)
		if mod > 0:
			large.append(mod)
		for i in range(a - val - 1):
			large.append(0)
		print(''.join(map(str, small)), ''.join(map(str, large)))


(n, s) = map(int, input().split())
S1 = ['0' for i in range(n)]
S2 = ['0' for i in range(n)]
j = 0
c = 0
if s == 0 and n != 1 or n * 9 < s:
	print(-1, -1)
	c = 1
if s == 0 and n == 1:
	print(0, 0)
	c = 1
for i in range(s):
	if c == 1:
		break
	S1[j] = str(int(S1[j]) + 1)
	if S1[j] == '9':
		j = j + 1
j = 0
for i in range(s):
	if c == 1:
		break
	S2[j] = str(int(S2[j]) + 1)
	if S2[j] == '9':
		j = j + 1
for i in range(1, n):
	if c == 1:
		break
	if S1[0] == '1':
		break
	while S1[i] != '9' and S1[0] != '1':
		S1[i] = str(int(S1[i]) + 1)
		S1[0] = str(int(S1[0]) - 1)
for i in range(1, n - 1):
	if c == 1:
		break
	for j in range(i + 1, n):
		while S1[j] != '9' and S1[i] != '0':
			S1[j] = str(int(S1[j]) + 1)
			S1[i] = str(int(S1[i]) - 1)
if c == 0:
	print(''.join(S1), ''.join(S2))


def main():
	(m, s) = map(int, input().split())
	if not s:
		print(('0 0', '-1 -1')[m > 1])
	elif s > 9 * m:
		print('-1 -1')
	else:
		l = ['9'] * (s // 9)
		if s % 9:
			l.append(str(s % 9))
		l += ['0'] * (m - len(l))
		ma = ''.join(l)
		l.reverse()
		if l[0] == '0':
			for (i, c) in enumerate(l):
				if c != '0':
					l[i] = chr(ord(c) - 1)
					break
			l[0] = '1'
		print(''.join(l), ma)
main()


q = input().split()
le = int(q[0])
su = int(q[1])
i = 10 ** (le - 1)
ma = 0
mi = 0
ri = 0
if su == 0 and le != 1:
	print('-1 -1')
elif su > 9 * le:
	print('-1 -1')
elif le == 1 and su == 0:
	print('0 0')
elif su <= 9:
	print(i + su - 1, i * su)
else:
	q = int(su / 9)
	p = su % 9
	if q == le:
		mi = ma = 10 ** le - 1
	elif q == le - 1:
		mi = i * p + i - 1
		ma = 10 ** le - 10 + p
	elif p == 0:
		for j in range(q):
			mi += 10 ** j * 9
			ma += 10 ** (le - 1 - j) * 9
		mi += i - 10 ** (q - 1)
		ma += 10 ** (le - 1 - q) * p
	else:
		for j in range(q):
			mi += 10 ** j * 9
			ma += 10 ** (le - 1 - j) * 9
		mi += i + 10 ** q * ((p + 8) % 9)
		ma += 10 ** (le - 1 - q) * p
	print(mi, ma)


def solve(m, left):
	s = left
	if s == 0 and m >= 2 or s > 9 * m:
		print(-1, -1)
		return
	if m == 1:
		print(s, s)
		return
	cnt = 9
	ans = []
	for i in range(m, 0, -1):
		if s // 9 != 0:
			ans.append(cnt)
			s -= cnt
		else:
			cnt = s % 9
			ans.append(cnt)
			s -= cnt
			cnt = 0
	maxi = ''.join(map(str, ans))
	ans = []
	s = left
	cnt = 0
	for i in range(m):
		if i == m - 1:
			cnt = s % 10
			ans.append(cnt)
		elif s >= 10:
			cnt = 9
			ans.append(cnt)
			s -= cnt
		elif s == 1:
			cnt = 0
			ans.append(cnt)
		else:
			ans.append(s - 1)
			s = 1
	track = []
	for i in range(len(ans) - 1, -1, -1):
		track.append(ans[i])
	mini = ''.join(map(str, track))
	print(mini, maxi)
(m, left) = map(int, input().split())
solve(m, left)


(m, s) = map(int, input().split())
s1 = s
if m == 1 and s == 0:
	print(0, 0)
	exit()
if s == 0 or s > 9 * m:
	print(-1, -1)
	exit()
if s == 1:
	print(1 * 10 ** (m - 1), 1 * 10 ** (m - 1))
	exit()
ans = 1 * 10 ** (m - 1)
s -= 1
i = 0
while s:
	if s <= 9:
		ans += s * 10 ** i
		s -= s
	else:
		ans += 9 * 10 ** i
		i += 1
		s -= 9
ans2 = 0
i = m - 1
while s1:
	if s1 <= 9:
		ans2 += s1 * 10 ** i
		s1 -= s1
	else:
		ans2 += 9 * 10 ** i
		s1 -= 9
		i -= 1
print(ans, ans2)


(m, s) = input().split()
m = int(m)
s = int(s)
if s == 0 and m != 1 or s > 9 * m:
	nummin = -1
	nummax = -1
	print('-1', '-1')
else:
	nummin = m * [0]
	nummax = m * [0]
	for i in range(m):
		a = s - i * 9
		if a > 9:
			nummax[i] = 9
		else:
			nummax[i] = max(0, a)
		b = s - 1 - i * 9
		if b > 9:
			nummin[m - i - 1] = 9
		else:
			nummin[m - i - 1] = max(0, b)
	if not (s == 0 and m == 1):
		nummin[0] += 1
	print(''.join((str(i) for i in nummin)), ''.join((str(i) for i in nummax)))


(m, s) = [int(i) for i in input().split()]
max_num = [0] * m
if m == 1 and s == 0:
	print(0, 0)
elif s < 1 or m * 9 < s:
	print(-1, -1)
else:
	s1 = s
	for i in range(m):
		if s - 9 > 0:
			max_num[i] += 9
			s -= 9
		else:
			max_num[i] += s
			s -= s
			break
	min_num = [0] * m
	for i in range(m - 1, -1, -1):
		if s1 - 9 > 0:
			min_num[i] = 9
			s1 -= 9
		elif s1 > 0:
			min_num[i] = s1
			s1 = 0
		else:
			for j in range(i + 1, m):
				if min_num[j] > 0:
					min_num[j] -= 1
					min_num[i] += 1
					break
	min_num_value = ''
	max_num_value = ''
	for i in max_num:
		max_num_value += str(i)
	for i in min_num:
		if min_num_value or i:
			min_num_value += str(i)
	print(min_num_value, max_num_value)


(m, s) = list(map(int, input().split()))
n = s
_max = 0
if s != 0 and s / 9 <= m:
	for i in range(m):
		if s > 9:
			_max += 9
			_max *= 10
			s -= 9
		else:
			_max += s
			_max *= 10 ** (m - 1 - i)
			break
	_min = 0
	k = 1
	for i in range(m):
		if n > 9:
			_min += 9 * k
			k *= 10
			n -= 9
		elif i < m - 1:
			_min += (n - 1) * k
			_min = 10 ** (m - 1) + _min
			break
		else:
			_min += n * k
	print(_min, _max)
elif m == 1 and s / 9 <= m:
	print(0, 0)
else:
	print(-1, -1)


(m, s) = map(int, input().split())
temp = s
largest = [-1] * m
for i in range(m):
	if temp >= 9:
		largest[i] = 9
		temp -= 9
	else:
		largest[i] = temp
		temp = 0
tempTwo = s - 1
smallest = [0] * m
smallest[0] = 1
for i in range(m - 1, 0, -1):
	if tempTwo < 0:
		break
	elif tempTwo >= 9:
		smallest[i] = 9
		tempTwo -= 9
	else:
		smallest[i] = tempTwo
		tempTwo = 0
smallest[0] += tempTwo
if temp != 0 or (largest[0] == 0 and (s > 0 or m > 1)):
	print(-1, -1)
else:
	answerOne = ''
	answerTwo = ''
	for i in range(m):
		answerOne += str(largest[i])
		answerTwo += str(smallest[i])
	print(answerTwo, answerOne)