The sum of digits of a non-negative integer $a$ is the result of summing up its digits together when written in the decimal system. For example, the sum of digits of $123$ is $6$ and the sum of digits of $10$ is $1$. In a formal way, the sum of digits of $\displaystyle a=\sum_{i=0}^{\infty} a_i \cdot 10^i$, where $0 \leq a_i \leq 9$, is defined as $\displaystyle\sum_{i=0}^{\infty}{a_i}$.

Given an integer $n$, find two non-negative integers $x$ and $y$ which satisfy the following conditions.

$x+y=n$, and

the sum of digits of $x$ and the sum of digits of $y$ differ by at most $1$.

It can be shown that such $x$ and $y$ always exist.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10000$).

Each test case consists of a single integer $n$ ($1 \leq n \leq 10^9$)


-----Output-----

For each test case, print two integers $x$ and $y$.

If there are multiple answers, print any.


-----Examples-----

Input
5
1
161
67
1206
19
Output
1 0
67 94
60 7
1138 68
14 5


-----Note-----

In the second test case, the sum of digits of $67$ and the sum of digits of $94$ are both $13$.

In the third test case, the sum of digits of $60$ is $6$, and the sum of digits of $7$ is $7$.

Difficulty: EASY
Tags: Probability

Constructive algorithms

Implementation

Greedy algorithms

Mathematics
Skill types: Greedy algorithms

Starter code:

Solutions:
import sys, math, cmath, time
from bisect import bisect_left
start_time = time.time()

def sod(n):
	n = str(n)
	s = 0
	for i in n:
		s = s + int(i)
	return s

def solve(t):
	n = inp()
	s = ''
	s1 = ''
	c = 1
	while n > 0:
		d = n % 10
		if d % 2 == 0:
			s = str(d // 2) + s
			s1 = str(d // 2) + s1
		elif c == 1:
			s = str(d // 2) + s
			s1 = str(d // 2 + 1) + s1
			c -= 1
		else:
			s = str(d // 2 + 1) + s
			s1 = str(d // 2) + s1
			c += 1
		n = n // 10
	print(int(s), int(s1))

def main():
	testcases = 1
	testcases = inp()
	for each_testcase in range(testcases):
		solve(each_testcase)

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

def inps():
	return input().split()
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


for n in [*open(0)][1:]:
	r = ''
	f = 0
	for x in map(int, n[:-1]):
		y = x + f >> 1
		r += f'{y}{x - y}'
		f ^= x & 1
	print(int(r[::2]), int(r[1::2]))


for _ in range(int(input())):
	(a, b) = (0, 0)
	for c in input():
		v = ord(c) - ord('0')
		a = a * 10 + v // 2
		b = b * 10 + (v + 1) // 2
		if v % 2:
			(a, b) = (b, a)
	print('{} {}'.format(a, b))


def digits_sum(num):
	val = 1
	(n1, n2) = (0, 0)
	bit = 0
	while num:
		k = num % 10
		if k % 2 == 0:
			n1 += k // 2 * val
			n2 += k // 2 * val
		elif bit:
			n2 += (k // 2 + 1) * val
			n1 += k // 2 * val
			bit = 0
		else:
			n1 += (k // 2 + 1) * val
			n2 += k // 2 * val
			bit = 1
		val *= 10
		num //= 10
	return (n1, n2)
for _ in range(int(input())):
	n = int(input())
	(n1, n2) = digits_sum(n)
	print(n1, n2)


import sys
input = sys.stdin.readline

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

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

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

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

def solve():
	k = inp()
	digits = []
	while k > 0:
		digits.append(k % 10)
		k = k // 10
	digits = list(reversed(digits))

	def num(a):
		r = 0
		while len(a):
			r = r * 10 + a[0]
			a.pop(0)
		return r
	(num_a, num_b, dis) = ([], [], 0)
	for (_, v) in enumerate(digits):
		if v % 2 == 0:
			num_a.append(v // 2)
			num_b.append(v // 2)
		elif dis == 1:
			num_a.append(v // 2 + 1)
			num_b.append(v // 2)
			dis = 0
		else:
			num_a.append(v // 2)
			num_b.append(v // 2 + 1)
			dis = 1
	return (num(num_a), num(num_b))
for i in range(t):
	(a, b) = solve()
	print(str(a) + ' ' + str(b))


import sys
input = sys.stdin.readline

def solve():
	n = input().strip()
	(ans1, ans2) = (0, 0)
	(d1, d2) = (0, 0)
	for i in range(len(n)):
		if int(n[i]) % 2:
			if d1 == d2:
				d1 += int(n[i]) // 2
				d2 += int(n[i]) // 2 + 1
				ans1 = ans1 * 10 + int(n[i]) // 2
				ans2 = ans2 * 10 + int(n[i]) // 2 + 1
			elif d1 > d2:
				d1 += int(n[i]) // 2
				d2 += int(n[i]) // 2 + 1
				ans1 = ans1 * 10 + int(n[i]) // 2
				ans2 = ans2 * 10 + int(n[i]) // 2 + 1
			elif d2 > d1:
				d1 += int(n[i]) // 2 + 1
				d2 += int(n[i]) // 2
				ans1 = ans1 * 10 + int(n[i]) // 2 + 1
				ans2 = ans2 * 10 + int(n[i]) // 2
		else:
			ans1 = ans1 * 10 + int(n[i]) // 2
			ans2 = ans2 * 10 + int(n[i]) // 2
	print(ans1, ans2)
for _ in range(int(input().strip())):
	solve()


for _ in range(int(input())):
	n = input()
	x = 0
	y = 0
	curOdd = 1
	for digit in n:
		digit = int(digit)
		if digit & 1:
			curOdd = 1 - curOdd
			digit >>= 1
			x = 10 * x + digit + curOdd
			y = 10 * y + digit + 1 - curOdd
		else:
			digit >>= 1
			x = 10 * x + digit
			y = 10 * y + digit
	print(x, y)


def print_combin(n):
	num = n
	num1 = ''
	num2 = ''
	is_first = True
	while num > 0:
		digit = num % 10
		if digit % 2 == 1:
			if is_first == True:
				num1 = f'{digit // 2 + 1}' + num1
				is_first = False
				num2 = f'{digit // 2}' + num2
			else:
				num2 = f'{digit // 2 + 1}' + num2
				is_first = True
				num1 = f'{digit // 2}' + num1
		else:
			num1 = f'{digit // 2}' + num1
			num2 = f'{digit // 2}' + num2
		num = num // 10
	print(int(num1), int(num2))

def main():
	for i in range(int(input())):
		n = int(input())
		print_combin(n)
main()


for _ in range(int(input())):
	num = int(input())
	status = True
	(a, b) = (0, 0)
	elements = list(map(int, str(num).strip()))
	for val in elements:
		if val % 2 == 0:
			a = a * 10 + val // 2
			b = b * 10 + val // 2
		elif status:
			a = a * 10 + val // 2 + 1
			b = b * 10 + val // 2
			status = False
		else:
			a = a * 10 + val // 2
			b = b * 10 + val // 2 + 1
			status = True
	print(a, b)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

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

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

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

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = inp()
for i in range(t):
	n = inp()
	(l, l1, l2) = ([], [], [])
	while n > 0:
		l.append(n % 10)
		n = n // 10
	flag = 0
	for i in range(len(l)):
		if l[i] % 2 != 0:
			l1.append(l[i] // 2 + flag)
			l2.append(l[i] // 2 - flag + 1)
			if flag == 0:
				flag = 1
			else:
				flag = 0
		else:
			l1.append(l[i] // 2)
			l2.append(l[i] // 2)
	(a, b) = (0, 0)
	f = 1
	for i in range(len(l)):
		a += l1[i] * f
		b += l2[i] * f
		f *= 10
	print(a, b)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 0
	b = 0
	s = 0
	y = 1
	while n:
		x = n % 10
		n //= 10
		if x % 2 == 0:
			a += x // 2 * y
			b += x // 2 * y
		elif s >= 0:
			a += (x + 1) // 2 * y
			b += (x - 1) // 2 * y
			s -= 1
		else:
			a += (x - 1) // 2 * y
			b += (x + 1) // 2 * y
			s += 1
		y *= 10
	print(a, b)


t = int(input())
for _ in range(t):
	n = str(input())
	is_equal = 1
	(n1, n2) = (0, 0)
	for i in n:
		num_i = int(i)
		n1 *= 10
		n2 *= 10
		if num_i % 2 == 0:
			tmp = num_i // 2
			n1 += tmp
			n2 += tmp
		else:
			tmp1 = num_i // 2
			tmp2 = num_i - tmp1
			if is_equal:
				n1 += tmp2
				n2 += tmp1
				is_equal = 0
			else:
				n1 += tmp1
				n2 += tmp2
				is_equal = 1
	print(n1, n2)


n = int(input())
data = []
for i in range(n):
	data.append(int(input()))
for i in data:
	first_num = str()
	second_num = str()
	st = str(i)
	k = 0
	for i in st:
		q = int(i)
		if q % 2 == 0:
			first_num += str(q // 2)
			second_num += str(q // 2)
		elif k == 0:
			first_num += str(q // 2 + 1)
			second_num += str(q // 2)
			k += 1
		else:
			first_num += str(q // 2)
			second_num += str(q // 2 + 1)
			k -= 1
	print(int(first_num), int(second_num))


def solve():
	(a, b, cur) = ('', '', 0)
	for d in x:
		d = int(d)
		if d % 2 == 0:
			a += str(d // 2)
			b += str(d // 2)
		else:
			if cur == 1:
				(a, b) = (b, a)
			a += str(d // 2)
			b += str((d + 1) // 2)
			cur ^= 1
	return [int(a), int(b)]
for testcase in range(int(input())):
	x = input()
	print(*solve())


for _ in range(int(input())):
	num = int(input())
	multiplier = 1
	(num1, num2) = (0, 0)
	diff = 0
	while num:
		last_digit = num % 10
		if diff == 0:
			num1 += (last_digit - last_digit // 2) * multiplier
			num2 += last_digit // 2 * multiplier
			diff += last_digit - 2 * (last_digit // 2)
		elif diff > 0:
			num2 += (last_digit - last_digit // 2) * multiplier
			num1 += last_digit // 2 * multiplier
			diff -= last_digit - 2 * (last_digit // 2)
		multiplier *= 10
		num = num // 10
	print(num1, num2)


def solve():
	n = input()
	a = ''
	b = ''
	flag = True
	for c in n:
		now = int(c)
		if now & 1:
			if flag:
				a = a + str(now // 2 + 1)
				b = b + str(now // 2)
			else:
				a = a + str(now // 2)
				b = b + str(now // 2 + 1)
			flag = not flag
		else:
			a = a + str(now // 2)
			b = b + str(now // 2)
	print(int(a), int(b))
t = int(input())
for _ in range(t):
	solve()


total = int(input())

def func():
	s = input()
	to_l = True
	(l, r) = ('', '')
	for c in s:
		num = int(c)
		if num % 2 == 0:
			l += str(num // 2)
			r += str(num // 2)
		else:
			(big, small) = (str(num // 2 + 1), str(num // 2))
			if to_l:
				l += big
				r += small
			else:
				l += small
				r += big
			to_l = not to_l
	print('{} {}'.format(int(l), int(r)))
for _ in range(total):
	func()


from typing import List
from bisect import *
from collections import *
from functools import *
from itertools import *
from math import *
from queue import PriorityQueue
INF = 2 ** 64 - 1
MOD = 10 ** 9 + 7
mi = lambda : map(int, input().split())
li = lambda : list(mi())

def digit(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n //= 10
	return ans

def main(n):
	small = True
	a = 0
	b = 0
	add = 1
	src = n
	while n > 0:
		temp = n % 10
		if temp % 2 == 0:
			a += add * (temp - temp // 2)
			b += add * (temp // 2)
		else:
			if small and temp % 2 != 0:
				a += add * (temp // 2)
				b += add * (temp - temp // 2)
			else:
				a += add * (temp - temp // 2)
				b += add * (temp // 2)
			small = not small
		n //= 10
		add *= 10
	print(a, b)
	return
caseNum = int(input())
for i in range(0, caseNum):
	n = int(input())
	main(n)


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	a = 0
	b = 0
	i = 1
	while n:
		r = n % 10
		if r & 1:
			r //= 2
			if a <= b:
				a += i * (r + 1)
				b += i * r
			else:
				b += i * (r + 1)
				a += i * r
		else:
			r //= 2
			a += i * r
			b += i * r
		i *= 10
		n //= 10
	print(a, b)


import sys, os
import math
TC = True

def solve():
	n = int(input())
	i = 0
	flag = 0
	nDigits = [0] * 10
	while n:
		nDigits[i] = n % 10
		n //= 10
		i += 1
	a = [0] * 10
	b = [0] * 10
	for j in range(i):
		if nDigits[j] & 1:
			a[j] = nDigits[j] // 2 + flag
			b[j] = nDigits[j] // 2 + 1 - flag
			flag = 1 - flag
		else:
			a[j] = b[j] = nDigits[j] // 2
	x = 0
	y = 0
	m = 1
	for j in range(i):
		y += b[j] * m
		x += a[j] * m
		m *= 10
	print(x, y)
if os.path.exists('input.txt'):
	debug = True
	sys.stdin = open('input.txt', 'r')
if TC:
	for _ in range(int(input())):
		solve()
else:
	solve()


num_tests = int(input().strip())
for _ in range(num_tests):
	num = int(input().strip())
	first_half = []
	second_half = []
	toggle = 0
	while num:
		digit = num % 10
		if digit & 1:
			first_half.append(digit // 2 + toggle)
			second_half.append(digit // 2 + 1 - toggle)
			toggle = 1 - toggle
		else:
			first_half.append(digit // 2)
			second_half.append(digit // 2)
		num = num // 10
	first_result = 0
	second_result = 0
	for i in range(len(first_half) - 1, -1, -1):
		first_result = first_result * 10 + first_half[i]
		second_result = second_result * 10 + second_half[i]
	print(first_result, second_result)


for t in range(int(input())):
	n = list(map(int, list(input())))
	(a, b) = ([], [])
	a_turn = True
	for elem in n:
		if elem % 2 == 0:
			a.append(elem // 2)
			b.append(elem // 2)
		elif a_turn:
			a.append((elem + 1) // 2)
			b.append((elem - 1) // 2)
			a_turn = False
		else:
			a.append((elem - 1) // 2)
			b.append((elem + 1) // 2)
			a_turn = True
	print(int(''.join(map(str, a))), int(''.join(map(str, b))))


N = int(input())
for i in range(N):
	num = int(input())
	ans1 = ans2 = 0
	flag = 0
	base = 1
	while num != 0:
		tmp = num % 10
		x = tmp // 2
		y = tmp - x
		if x != y:
			if flag == 1:
				tt = x
				x = y
				y = tt
			flag ^= 1
		ans1 += x * base
		ans2 += y * base
		num = num // 10
		base *= 10
	print(ans1, ans2)


for _ in range(int(input())):
	n = input()
	a = []
	b = []
	flag = 0
	for i in n:
		i = int(i)
		if i % 2 == 0:
			a.append(i // 2)
			b.append(i // 2)
		elif flag == 1:
			a.append(i // 2)
			b.append(i // 2 + 1)
			flag = 0
		else:
			b.append(i // 2)
			a.append(i // 2 + 1)
			flag = 1
	ans = 0
	ans2 = 0
	for i in a:
		ans *= 10
		ans += i
	for i in b:
		ans2 *= 10
		ans2 += i
	print(ans, ans2)


for n in [*open(0)][1:]:
	a = ['', '']
	f = 0
	for x in map(int, n[:-1]):
		a[f] += str(x >> 1)
		a[f ^ 1] += str(x + 1 >> 1)
		f ^= x & 1
	print(*map(int, a))


for _ in range(int(input())):
	n = input()
	d1 = d2 = 0
	c = 10 ** (len(n) - 1)
	j = 1
	co1 = 0
	co2 = 1
	for i in n:
		if i == '9':
			if co1 % 2:
				d1 += 4 * c
				d2 += 5 * c
			else:
				d1 += 5 * c
				d2 += 4 * c
			co1 += 1
		elif int(i) % 2:
			if co2 % 2:
				d1 += int(i) // 2 * c
				d2 += (int(i) // 2 + 1) * c
			else:
				d1 += (int(i) // 2 + 1) * c
				d2 += int(i) // 2 * c
			co2 += 1
		else:
			d1 += int(i) // 2 * c
			d2 += int(i) // 2 * c
		c //= 10
		j += 1
	print(d1, d2)


t = int(input())
for i in range(t):
	n = input().strip()
	a = '0'
	b = '0'
	p = 0
	for k in n:
		num = int(k)
		if p:
			a += str(num // 2)
			b += str(num - num // 2)
		else:
			b += str(num // 2)
			a += str(num - num // 2)
		if num % 2:
			p = (p + 1) % 2
	print(int(a), int(b))


import sys
import socket
hostnames = ['N551J', 'FVFH32CDQ05N', 'X553M']
input_file = 'b1.in'
if socket.gethostname() in hostnames:
	sys.stdin = open(input_file)

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

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

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

def read_str():
	return input()

def solve():
	t = read_int()
	res = [''] * t
	for i in range(t):
		n = read_int()
		p = 1
		while 10 * p <= n:
			p *= 10
		j = 0
		r = [0, 0]
		while n > 0:
			while p > n:
				p //= 10
			n -= p
			r[j] += p
			j = 1 - j
		res[i] = str(r[0]) + ' ' + str(r[1])
	return res

def main():
	res = solve()
	print(*res, sep='\n')
main()


t = int(input())
for i in range(t):
	m = input()
	f = True
	a = b = 0
	for x in m:
		if f:
			a = a * 10 + int(x) // 2
			b = b * 10 + int(x) - int(x) // 2
		else:
			b = b * 10 + int(x) // 2
			a = a * 10 + int(x) - int(x) // 2
		if int(x) % 2 == 1:
			f = not f
	print(a, b)


import os
import math
import collections
import bisect
import functools
import itertools
import heapq

def solve(n):
	a = [int(c) for c in str(n)]
	m = len(a)
	x = [0] * m
	y = [0] * m
	s = 0
	for i in range(m):
		if a[i] % 2 == 0:
			x[i] = a[i] // 2
			y[i] = a[i] // 2
		elif s <= 0:
			x[i] = a[i] // 2 + 1
			y[i] = a[i] // 2
			s += 1
		else:
			x[i] = a[i] // 2
			y[i] = a[i] // 2 + 1
			s -= 1
	return (int(''.join(map(str, x))), int(''.join(map(str, y))))
t = int(input())
for _ in range(t):
	n = int(input())
	(x, y) = solve(n)
	print(x, y)


test = int(input())
while test:
	n = int(input())
	st = str(n)
	x = ''
	y = ''
	greater = 0
	for i in st:
		k = int(i)
		if k % 2 == 0:
			x = x + str(k // 2)
			y = y + str(k // 2)
		elif greater == 0:
			x = x + str(k // 2 + 1)
			y = y + str(k // 2)
			greater = 1
		else:
			x = x + str(k // 2)
			y = y + str(k // 2 + 1)
			greater = 0
	print(int(x), int(y))
	test -= 1


for _ in range(int(input())):
	n = input()
	a = list((int(i) for i in n))
	x = list()
	y = list()
	d = 0
	for i in a:
		if i % 2 == 0:
			x.append(i // 2)
			y.append(i // 2)
		elif d == 0:
			x.append(i // 2 + 1)
			y.append(i // 2)
			d = 1
		else:
			x.append(i // 2)
			y.append(i // 2 + 1)
			d = 0
	xn = 0
	yn = 0
	for i in range(len(x)):
		xn = xn * 10 + x[i]
		yn = yn * 10 + y[i]
	print(xn, yn)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(input())
	x = ''
	y = ''
	adx = 0
	s = str(n)
	for j in s:
		ele = int(j)
		if ele % 2 == 0:
			x += str(ele // 2)
			y += str(ele // 2)
		elif adx == 0:
			adx += 1
			x += str(ele // 2 + 1)
			y += str(ele // 2)
		else:
			adx = 0
			y += str(ele // 2 + 1)
			x += str(ele // 2)
	print(int(x), int(y))


for _ in range(int(input())):
	n = input()
	ans1 = []
	ans2 = []
	turn = 0
	for i in n:
		e = int(i)
		if e % 2 == 0:
			ans1.append(str(e // 2))
			ans2.append(str(e // 2))
		else:
			e1 = e // 2
			e2 = e // 2 + 1
			if turn == 0:
				ans1.append(str(e2))
				ans2.append(str(e1))
				turn = 1
			else:
				ans1.append(str(e1))
				ans2.append(str(e2))
				turn = 0
	ans1 = ''.join(ans1)
	ans2 = ''.join(ans2)
	print(int(ans1), int(ans2))


n = int(input())
for bb in range(n):
	x = int(input())
	s = str(x)
	temp = 1
	re1 = 0
	re2 = 0
	for b in s:
		re1 *= 10
		re2 *= 10
		if temp == 1:
			if int(b) % 2 == 0 and int(b) != 1:
				re2 += int(b) // 2
				re1 += int(b) // 2
			else:
				re1 += int(b) // 2 + 1
				re2 += int(b) // 2
				temp = 0
		elif int(b) % 2 == 0 and int(b) != 1:
			re2 += int(b) // 2
			re1 += int(b) // 2
		else:
			re2 += int(b) // 2 + 1
			re1 += int(b) // 2
			temp = 1
	print(re1, end=' ')
	print(re2)


xyz = int(input())
for _ in range(xyz):
	n = int(input())
	base = 1
	a1 = 0
	a2 = 0
	c1 = 0
	c2 = 0
	while n > 0:
		rem = n % 10
		n = n // 10
		if rem % 2 == 0:
			a1 = a1 + rem // 2 * base
			a2 = a2 + rem // 2 * base
			c1 += 1
			c2 += 1
		elif c1 > c2:
			a2 = a2 + (rem + 1) // 2 * base
			c2 += 1
			a1 = a1 + (rem - 1) // 2 * base
		else:
			a1 = a1 + (rem + 1) // 2 * base
			c1 += 1
			a2 = a2 + (rem - 1) // 2 * base
		base = base * 10
	print(a1, ' ', a2)


def prod(a, b):
	return a * b
for _ in range(int(input())):
	n = int(input())
	ll = [1]
	it = 1
	num1 = 0
	num2 = 0
	while n > 0:
		rem = n % 10
		f = 0
		if rem % 2 in ll:
			f = 1
		rem = rem // 2
		if f:
			if num1 > num2:
				num2 = num2 + prod(it, rem + 1)
				num1 = num1 + prod(it, rem)
			else:
				num1 = num1 + prod(it, rem + 1)
				num2 = num2 + prod(it, rem)
		else:
			num1 = num1 + prod(it, rem)
			num2 = num2 + prod(it, rem)
		it = prod(it, 10)
		n = n // 10
	print(num1, num2)


for i in range(int(input())):
	a = input()
	(x, y) = ('', '')
	flag = False
	for i in range(len(a)):
		n = int(a[i])
		n1 = n >> 1
		n2 = n - n1
		if n % 2 != 0:
			if flag:
				x += str(n1)
				y += str(n2)
				flag = False
			else:
				x += str(n2)
				y += str(n1)
				flag = True
		else:
			x += str(n1)
			y += str(n2)
	print(int(x), int(y))


def sum_of_two_numbers(num_str):
	num_list = [int(i) for i in num_str]
	num_a = []
	num_b = []
	odd = 0
	for number in num_list:
		if number % 2 == 0:
			num_a.append(number // 2)
			num_b.append(number // 2)
		else:
			odd += 1
			if odd % 2 == 0:
				num_a.append(number // 2 + 1)
				num_b.append(number // 2)
			else:
				num_a.append(number // 2)
				num_b.append(number // 2 + 1)
	num_a_r = num_a[::-1]
	num_b_r = num_b[::-1]
	a = 0
	b = 0
	for i in range(len(num_str)):
		a += num_a_r[i] * 10 ** i
		b += num_b_r[i] * 10 ** i
	print(a, b)
tests = int(input())
for i in range(tests):
	sum_of_two_numbers(str(input()))


def x_y(N):
	li = ['', '']
	n = str(N)
	(p, q, x) = (0, 0, 0)
	for i in n:
		p = int(i) // 2
		q = (int(i) + 1) // 2
		if p == q:
			li[0] += str(p)
			li[1] += str(q)
		else:
			li[x] += str(p)
			li[1 - x] += str(q)
			x = 1 - x
	print(int(li[0]), int(li[1]))
t = int(input())
while t:
	N = int(input())
	x_y(N)
	t -= 1


import heapq
from collections import Counter, deque, defaultdict

class Solution:

	def solve(self, n):
		(l, r) = ([], [])
		sum = 0
		for i in n:
			ni = int(i)
			if ni % 2 == 0:
				l.append(ni // 2)
				r.append(ni // 2)
			else:
				mid = (ni + 1) // 2
				if sum > 0:
					l.append(mid)
					r.append(mid - 1)
					sum = 0
				elif sum < 0:
					l.append(mid - 1)
					r.append(mid)
					sum = 0
				else:
					l.append(mid)
					r.append(mid - 1)
					sum = -1
		l = ''.join(map(str, l))
		r = ''.join(map(str, r))
		print(int(l), int(r))
		return
ob = Solution()
for _ in range(int(input())):
	n = input().strip()
	ob.solve(n)


def solve(n):
	arr = [int(i) for i in str(n)]
	x = []
	y = []
	j = 0
	for num in arr:
		if num % 2 == 0:
			x.append(num // 2)
			y.append(num // 2)
		else:
			if j % 2 == 0:
				x.append(num // 2 + 1)
				y.append(num // 2)
			else:
				x.append(num // 2)
				y.append(num // 2 + 1)
			j += 1
	return (x, y)
t = int(input())
for _ in range(t):
	n = int(input())
	(x, y) = solve(n)
	x = int(''.join(map(str, x)))
	y = int(''.join(map(str, y)))
	print(x, y)


n1 = int(input())
ns = []
ans = []
for i in range(n1):
	ns.append(int(input()))
for n2 in ns:
	s = str(n2)
	le = len(s)
	t = 0
	q = 0
	for i in range(le):
		i1 = int(s[i])
		if i1 % 2 == 1:
			t += (i1 - 1) * 10 ** (le - i - 1)
			q += 1 * 10 ** (le - i - 1)
		else:
			t += i1 * 10 ** (le - i - 1)
	t1 = t // 2
	t2 = t // 2
	sq = str(q)
	le2 = len(sq)
	j = 1
	for i in range(le2):
		i2 = int(sq[i])
		if i2 == 1 and j % 2 == 1:
			t1 += 1 * 10 ** (le2 - i - 1)
			j += 1
		elif i2 == 1 and j % 2 == 0:
			t2 += 1 * 10 ** (le2 - i - 1)
			j += 1
	ans.append(str(t1) + ' ' + str(t2))
for i in ans:
	print(i)


t = int(input())
for j in range(t):
	n = int(input())
	s = str(n)
	x1 = ''
	x2 = x1
	a = 1
	for i in range(len(s)):
		u = int(s[i])
		if u % 2 == 0:
			x1 += str(u // 2)
			x2 += str(u // 2)
		elif a == 1:
			x1 += str(u // 2 + 1)
			x2 += str(u // 2)
			a = 2
		else:
			x2 += str(u // 2 + 1)
			x1 += str(u // 2)
			a = 1
	while x1[0] == '0' and x2 != '0':
		x1 = x1[1:]
	while x2[0] == '0' and x2 != '0':
		x2 = x2[1:]
	print(x1, x2)


def helper(n):
	s = str(n)
	(a, b) = ('', '')
	ind = 1
	for i in range(len(s)):
		if int(s[i]) / 2 % 1 == 0:
			a += str(int(s[i]) // 2)
			b += str(int(s[i]) // 2)
		else:
			if ind == 1:
				a += str((int(s[i]) + 1) // 2)
				b += str((int(s[i]) - 1) // 2)
			else:
				b += str((int(s[i]) + 1) // 2)
				a += str((int(s[i]) - 1) // 2)
			ind *= -1
	return str(int(a)) + ' ' + str(int(b))
for i in range(int(input())):
	print(helper(int(input())))


for _ in range(int(input())):
	n = [int(x) for x in input()]
	a = list(n)
	b = list(n)
	par = 0
	for i in range(len(n)):
		if n[i] % 2 == 0:
			a[i] = b[i] = n[i] // 2
			continue
		par += 1
		if par % 2:
			a[i] = (n[i] - 1) // 2
			b[i] = (n[i] + 1) // 2
		else:
			a[i] = (n[i] + 1) // 2
			b[i] = (n[i] - 1) // 2
	print(int(''.join([str(x) for x in a])), int(''.join([str(x) for x in b])))