Petya and Vasya decided to play a little. They found n red cubes and m blue cubes. The game goes like that: the players take turns to choose a cube of some color (red or blue) and put it in a line from left to right (overall the line will have n + m cubes). Petya moves first. Petya's task is to get as many pairs of neighbouring cubes of the same color as possible. Vasya's task is to get as many pairs of neighbouring cubes of different colors as possible. 

The number of Petya's points in the game is the number of pairs of neighboring cubes of the same color in the line, the number of Vasya's points in the game is the number of neighbouring cubes of the different color in the line. Your task is to calculate the score at the end of the game (Petya's and Vasya's points, correspondingly), if both boys are playing optimally well. To "play optimally well" first of all means to maximize the number of one's points, and second — to minimize the number of the opponent's points.


-----Input-----

The only line contains two space-separated integers n and m (1 ≤ n, m ≤ 10^5) — the number of red and blue cubes, correspondingly.


-----Output-----

On a single line print two space-separated integers — the number of Petya's and Vasya's points correspondingly provided that both players play optimally well.


-----Examples-----
Input
3 1

Output
2 1

Input
2 4

Output
3 2



-----Note-----

In the first test sample the optimal strategy for Petya is to put the blue cube in the line. After that there will be only red cubes left, so by the end of the game the line of cubes from left to right will look as [blue, red, red, red]. So, Petya gets 2 points and Vasya gets 1 point. 

If Petya would choose the red cube during his first move, then, provided that both boys play optimally well, Petya would get 1 point and Vasya would get 2 points.

Difficulty: EASY
Tags: Game theory

Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
(n, m) = input().split()
n = int(n)
m = int(m)
if n == m:
	print(n - 1, n)
else:
	print(min(n, m) + abs(n - m) - 1, min(n, m))


(a, b) = sorted(map(int, input().split()))
print(b - 1, a)


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

def solve(start, r, b):
	i = 0
	while r and b:
		i += 1
		if i % 2 == 0:
			if start[-1] == 'r':
				start.append('r')
				r -= 1
			else:
				start.append('b')
				b -= 1
		elif start[-1] == 'r':
			start.append('b')
			b -= 1
		else:
			start.append('r')
			r -= 1
	if r:
		start.extend(['r'] * r)
	if b:
		start.extend(['b'] * b)
	return (len([1 for (f, s) in zip(start[:-1], start[1:]) if f == s]), len([1 for (f, s) in zip(start[:-1], start[1:]) if f != s]))
print(*max(solve(['r'], n - 1, m), solve(['b'], n, m - 1)))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
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

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 6 + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(10 ** 6 + 1):
		if prime[i]:
			for j in range(2 * i, 10 ** 6 + 1, i):
				prime[j] = 0
	return prime
(n, m) = sorted(map(int, input().split()))
print(m - 1, n)
endtime = time.time()


(n, m) = map(int, input().split())
print(max(n, m) - 1, min(n, m))


(n, m) = list(map(int, input().split()))
(n1, m1, n2, m2) = (n - 1, m, n, m - 1)
(s1, s2) = ('R', 'B')
turn = 2
for i in range(n + m - 1):
	if turn == 1:
		if s1[-1] == 'R' and n1 >= 1:
			n1 -= 1
			s1 += 'R'
		elif m1 >= 1:
			m1 -= 1
			s1 += 'B'
		else:
			n1 -= 1
			s1 += 'R'
		if s2[-1] == 'R' and n2 >= 1:
			n2 -= 1
			s2 += 'R'
		elif m2 >= 1:
			m2 -= 1
			s2 += 'B'
		else:
			n2 -= 1
			s2 += 'R'
	else:
		if s1[-1] == 'R' and m1 >= 1:
			m1 -= 1
			s1 += 'B'
		elif n1 >= 1:
			n1 -= 1
			s1 += 'R'
		else:
			m1 -= 1
			s1 += 'B'
		if s2[-1] == 'R' and m2 >= 1:
			m2 -= 1
			s2 += 'B'
		elif n2 >= 1:
			n2 -= 1
			s2 += 'R'
		else:
			m2 -= 1
			s2 += 'B'
	turn = 3 - turn
ans1 = sum([1 for i in range(n + m - 1) if s1[i] == s1[i + 1]])
ans2 = sum([1 for i in range(n + m - 1) if s2[i] == s2[i + 1]])
ans = max(ans1, ans2)
print(ans, n + m - 1 - ans)


def fun(r, b, col):
	P = 0
	R = 0
	lst = [col]
	chance = 'R'
	if col == 'red':
		(d1, d2) = (r - 1, b)
	else:
		(d1, d2) = (r, b - 1)
	i = 0
	while d1 > 0 and d2 > 0:
		if chance == 'P':
			if lst[i] == 'blue':
				lst.append('blue')
				d2 -= 1
			else:
				lst.append('red')
				d1 -= 1
			P += 1
			chance = 'R'
		if chance == 'R':
			if lst[i] == 'red':
				lst.append('blue')
				d2 -= 1
			else:
				lst.append('red')
				d1 -= 1
			R += 1
			chance = 'P'
		i += 1
	if d1 > 0:
		if lst[i] == 'red':
			P += 1
		else:
			R += 1
		P += d1 - 1
	if d2 > 0:
		if lst[i] == 'blue':
			P += 1
		else:
			R += 1
		P += d2 - 1
	return str(P) + ' ' + str(R)
	pass
(r, b) = [int(i) for i in input().split()]
(P1, R1) = [int(i) for i in fun(r, b, 'red').split()]
(P2, R2) = [int(i) for i in fun(r, b, 'blue').split()]
if P1 > P2:
	print(P1, R1)
else:
	print(P2, R2)


(n, m) = map(int, input().split())
if min(n, m) == 1:
	print(n + m - 2, 1)
else:
	x = min(n, m)
	a = x // 2 + x // 2 - 1
	b = 2 * (x // 2)
	x = x % 2
	y = max(n, m) - 2 * (x // 2)
	a = a + 1
	y = y - 1
	if x == 1:
		b = b + 1
	a = a + (n + m - 1 - a - b)
	print(a, b)


arr = input().split()
a = int(arr[0])
b = int(arr[1])
if a % 2 == 1 and b % 2 == 1:
	if a < b:
		a -= 1
		flag = 1
	else:
		b -= 1
		flag = 2
elif a % 2 == 1:
	a -= 1
	flag = 1
elif b % 2 == 1:
	b -= 1
	flag = 2
elif a > b:
	a -= 1
	flag = 1
else:
	b -= 1
	flag = 2
if flag == 1:
	s = 'a'
else:
	s = 'b'
play = 2
while a > 0 and b > 0:
	if flag == 1:
		if play == 2:
			s += 'b'
			b -= 1
			play = 1
			flag = 2
		else:
			s += 'a'
			a -= 1
			play = 2
	elif play == 2:
		s += 'a'
		a -= 1
		play = 1
		flag = 1
	else:
		s += 'b'
		b -= 1
		play = 2
while a > 0:
	s += 'a'
	a -= 1
while b > 0:
	s += 'b'
	b -= 1
s = list(s)
prev = s[0]
n = len(s)
a = 0
b = 0
for i in range(1, n):
	if s[i] == prev:
		a += 1
	else:
		b += 1
	prev = s[i]
print(str(a) + ' ' + str(b))


from sys import stdin
import functools
import math

def read():
	return list(map(int, stdin.readline().split()))
(n, m) = read()
b = min(n, m)
a = n + m - 1 - b
print('{0} {1}'.format(a, b))


def solve(init, n, m):
	nm = [n, m]
	row = [init]
	nm[init == 1] -= 1
	while sum(nm) > 0:
		if row[-1] == 0:
			row.append(1 if nm[1] > 0 else 0)
		else:
			row.append(0 if nm[0] > 0 else 1)
		nm[row[-1] == 1] -= 1
		if sum(nm) > 0:
			if row[-1] == 0:
				row.append(0 if nm[0] > 0 else 1)
			else:
				row.append(1 if nm[1] > 0 else 0)
			nm[row[-1] == 1] -= 1
	petya_points = sum((row[i] == row[i - 1] for i in range(1, len(row))))
	vasya_points = n + m - 1 - petya_points
	return (petya_points, vasya_points)

def main():
	(n, m) = map(int, input().split())
	(pa, va) = solve(0, n, m)
	(pb, vb) = solve(1, n, m)
	if pa > pb:
		print(pa, va)
	else:
		print(pb, vb)
main()


(red, blue) = [int(x) for x in input().split()]

def red_first():
	(n, m, score) = (red - 1, blue, 0)
	diff = min(n // 2, m // 2) * 2
	n -= diff
	m -= diff
	score += diff
	if m == 0:
		score += n
	elif m == 1:
		score += max(n - 1, 0)
	elif n == 0:
		score += m - 1
	else:
		score += 1 + max(m - 3, 0)
	return score

def blue_first():
	(n, m, score) = (red, blue - 1, 0)
	diff = min(n // 2, m // 2) * 2
	n -= diff
	m -= diff
	score += diff
	if n == 0:
		score += m
	elif n == 1:
		score += max(m - 1, 0)
	elif m == 0:
		score += n - 1
	else:
		score += 1 + max(n - 3, 0)
	return score
res = max(red_first(), blue_first())
print(res, red + blue - 1 - res)


(n, m) = sorted(map(int, input().split()))
print(m - 1, n)


def t(b, pr):
	(i, p) = (1, [0, 0])
	while b[0] or b[1]:
		if i == 0:
			c = pr if b[pr] else 1 - pr
		else:
			c = 1 - pr if b[1 - pr] else pr
		p[c != pr] += 1
		b[c] -= 1
		(i, pr) = (1 - i, c)
	return p
(n, m) = list(map(int, input().split()))
(v1, v2) = (t([n - 1, m], 0), t([n, m - 1], 1))
print(' '.join(map(str, v1 if v1[0] >= v2[0] else v2)))


(n, m) = map(int, input().split())
if n < m:
	(n, m) = (m, n)
print(n - 1, m)


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	mx = int()
	mn = int()
	if n > m:
		mx = n
		mn = m
	else:
		mx = m
		mn = n
	ans = 0
	if mx % 2 == 1 and mn % 2 == 0:
		mx -= 1
		ans += mn
		mx -= ans
		ans += mx
	else:
		mn -= 1
		ans += mn
		mx -= ans
		ans += mx - 1
	print(ans, m + n - ans - 1)
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()


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

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

def solve():
	(n, m) = read_line()
	print(max(n, m) - 1, min(n, m))
t = 1
while t > 0:
	solve()
	t -= 1


[n, m] = [int(x) for x in input().split()]
x = min(n, m)
y = max(n, m)
ans1 = x - 1 + (y - x)
ans2 = x
print(str(ans1) + ' ' + str(ans2))


s = [int(i) for i in input().split()]
if s[0] >= s[1]:
	print(str(s[0] - 1) + ' ' + str(s[1]))
else:
	print(str(s[1] - 1) + ' ' + str(s[0]))


def test(begin, r, b):
	bl = b
	rl = r
	if begin == 'b':
		bl -= 1
	else:
		rl -= 1
	last = begin
	pt = 0
	for i in range(r + b - 1):
		if i % 2 == 0:
			if last == 'b':
				if rl > 0:
					rl -= 1
					last = 'c'
				else:
					bl -= 1
					pt += 1
			elif bl > 0:
				bl -= 1
				last = 'b'
			else:
				rl -= 1
				pt += 1
		elif last == 'b':
			if bl > 0:
				bl -= 1
				pt += 1
			else:
				rl -= 1
				last = 'c'
		elif rl > 0:
			rl -= 1
			pt += 1
		else:
			bl -= 1
			last = 'b'
	return pt
inp = input().split(' ')
r = int(inp[0])
b = int(inp[1])
best = max(test('b', r, b), test('r', r, b))
print(best, r + b - best - 1)


(a, b) = (int(x) for x in input().split())
print(max(a, b) - 1, min(a, b))


(n, m) = [int(i) for i in input().split()]
print(m + n - 1 - min(n, m), min(n, m))


(N, M) = map(int, input().split())
print(max(N, M) - 1, min(N, M))


(a, b) = list(map(int, input().split()))
print(max(a, b) - 1, min(a, b))


(n, m) = map(int, input().split())
p1 = 0
p2 = 0
if n == m:
	p1 = n
	p2 = n - 1
	print(p2, p1)
else:
	p1 = max(n, m) - 1
	p2 = min(n, m)
	print(p1, p2)


from sys import stdin, stdout
if not __debug__:
	stdin = open('input.txt', 'r')
tcs = int(stdin.readline()) if not __debug__ else 1
t = 1
while t <= tcs:
	(n, m) = map(int, stdin.readline().split())
	big = max(n, m)
	small = min(n, m)
	print(big - 1, small)
	t += 1


(r, b) = [int(i) for i in input().split()]
mi = min(r, b)
ma = max(r, b)
same = mi - 1
diff = mi
rem = ma - mi
same += rem
print(same, diff)


import sys, threading, os.path
import collections, heapq, math, bisect
import string
from platform import python_version
import itertools
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def tryall(state, n, m):
	lis = []
	(temn, temm) = (n, m)
	for i in range(n + m):
		if i == 0:
			if state == 1 and temn > 0 or (temn > 0 and temm == 0):
				lis.append(1)
				temn -= 1
			elif state == 2 and temm > 0 or (temm > 0 and temn == 0):
				lis.append(2)
				temm -= 1
			continue
		if i % 2 == 0:
			if lis[i - 1] == 1 and temn > 0 or (temn > 0 and temm == 0):
				temn -= 1
				lis.append(1)
			else:
				temm -= 1
				lis.append(2)
		elif lis[i - 1] == 2 and temn > 0 or (temn > 0 and temm == 0):
			temn -= 1
			lis.append(1)
		else:
			temm -= 1
			lis.append(2)
	(count1, count2) = (0, 0)
	for i in range(1, n + m):
		if lis[i] == lis[i - 1]:
			count1 += 1
		else:
			count2 += 1
	return (count1, count2)

def main():
	if os.path.exists('input.txt'):
		input = open('input.txt', 'r')
	else:
		input = sys.stdin
	(n, m) = list(map(int, input.readline().split()))
	sol1 = tryall(1, n, m)
	sol2 = tryall(2, n, m)
	if sol1[0] > sol2[0]:
		(count1, count2) = (sol1[0], sol1[1])
	else:
		(count1, count2) = (sol2[0], sol2[1])
	output = str(count1) + ' ' + str(count2)
	if os.path.exists('output.txt'):
		open('output.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


import math
from sys import stdin, stdout

def counter(c):
	if c == 1:
		return 0
	else:
		return 1

def count_result(arr):
	count = 0
	for i in range(1, len(arr)):
		if arr[i] == arr[i - 1]:
			count += 1
	print(count, len(arr) - 1 - count)
(r, b) = list(map(int, stdin.readline().split()))
if r < b:
	(r, b) = (b, r)
arr = []
if b % 2 == 0:
	arr.append(0)
	r -= 1
	chance = 1
	while b > 0 and r > 0:
		if chance == 1:
			if arr[-1] == 0:
				arr.append(1)
				b -= 1
			else:
				arr.append(0)
				r -= 1
			chance = counter(chance)
		else:
			if arr[-1] == 0:
				arr.append(0)
				r -= 1
			else:
				arr.append(1)
				b -= 1
			chance = counter(chance)
	if r == 0:
		while b > 0:
			arr.append(1)
			b -= 1
	elif b == 0:
		while r > 0:
			arr.append(0)
			r -= 1
else:
	arr.append(1)
	chance = 1
	b -= 1
	while b > 0 and r > 0:
		if chance == 1:
			if arr[-1] == 0:
				arr.append(1)
				b -= 1
			else:
				arr.append(0)
				r -= 1
			chance = counter(chance)
		else:
			if arr[-1] == 0:
				arr.append(0)
				r -= 1
			else:
				arr.append(1)
				b -= 1
			chance = counter(chance)
	if r == 0:
		while b > 0:
			arr.append(1)
			b -= 1
	elif b == 0:
		while r > 0:
			arr.append(0)
			r -= 1
count_result(arr)


f = input().split()
kras = int(f[0])
sin = int(f[1])
print(max(kras, sin) - 1, min(kras, sin))


(n, m) = map(int, input().split())
seq = []
if n % 2 and m % 2:
	print(n + m - 1 - min(n, m), min(n, m))
elif not n % 2 and (not m % 2):
	print(n + m - 1 - min(n, m), min(n, m))
else:
	print(n + m - 1 - min(n, m), min(n, m))


(n, m) = map(int, input().split(' '))
if m > n:
	t = n
	n = m
	m = t
if m == n:
	print(min(n - 1, m), end=' ')
	print(max(n - 1, m))
else:
	print(max(n - 1, m), end=' ')
	print(min(n - 1, m))


(r, b) = map(int, input().split(' '))
arr = [0] * (r + b)
arr1 = [0] * (r + b)
arr1[0] = 1
i = 0
j = 1
k = 1
while i < b and j < r and (k < r + b):
	if k % 2 == 1:
		arr[k] = 1 - arr[k - 1]
		if arr[k] == 0:
			j += 1
		else:
			i += 1
	else:
		arr[k] = arr[k - 1]
		if arr[k] == 0:
			j += 1
		else:
			i += 1
	k += 1
if i == b and j != r:
	for _ in range(k, r + b):
		arr[_] = 0
elif i != b and j == r:
	for _ in range(k, r + b):
		arr[_] = 1
i = 1
j = 0
k = 1
while i < b and j < r and (k < r + b):
	if k % 2 == 1:
		arr1[k] = 1 - arr1[k - 1]
		if arr1[k] == 0:
			j += 1
		else:
			i += 1
	else:
		arr1[k] = arr1[k - 1]
		if arr1[k] == 0:
			j += 1
		else:
			i += 1
	k += 1
if i == b and j != r:
	for _ in range(k, r + b):
		arr1[_] = 0
elif i != b and j == r:
	for _ in range(k, r + b):
		arr1[_] = 1
i = 1
cnt = 0
while i < len(arr):
	if arr[i] == arr[i - 1]:
		cnt += 1
	i += 1
i = 1
cnt1 = 0
while i < len(arr1):
	if arr1[i] == arr1[i - 1]:
		cnt1 += 1
	i += 1
print(max(cnt, cnt1), r + b - 1 - max(cnt, cnt1))


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
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')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, m) = map(int, input().split())
t = 1
last = 0
w = [n - 1, m]
an = 0
ans = 0
an1 = 0
ans1 = 0
for i in range(1, n + m):
	if t == 1:
		if w[1 - last] > 0:
			w[1 - last] -= 1
			an += 1
			last = 1 - last
		else:
			w[last] -= 1
			ans += 1
	elif w[last] > 0:
		w[last] -= 1
		ans += 1
	else:
		w[1 - last] -= 1
		an += 1
	t = 1 - t
w = [m - 1, n]
last = 0
t = 1
for i in range(1, n + m):
	if t == 1:
		if w[1 - last] > 0:
			w[1 - last] -= 1
			an1 += 1
			last = 1 - last
		else:
			w[last] -= 1
			ans1 += 1
	elif w[last] > 0:
		w[last] -= 1
		ans1 += 1
	else:
		w[1 - last] -= 1
		an1 += 1
	t = 1 - t
if ans > ans1:
	print(ans, an)
elif ans < ans1:
	print(ans1, an1)
elif an > an1:
	print(ans, an)
else:
	print(ans1, an1)


(n, m) = map(int, input().split())
if n < m:
	m -= 1
	x = n
	y = m - n
	print(x + y, x)
elif m < n:
	(m, n) = (n, m)
	m -= 1
	x = n
	y = m - n
	print(x + y, x)
else:
	print(m - 1, m)


from sys import stdin, stdout
(m, n) = map(int, stdin.readline().strip().split())
print(max(m, n) - 1, min(m, n))


(a, b) = map(int, input().split())
l = min(a, b)
print(a + b - 1 - l, l)


(n, m) = input().split()
n = int(n)
m = int(m)
n1 = n
m1 = m
l1 = [0]
n -= 1
p1 = 0
p2 = 0
q1 = 0
q2 = 0
for i in range(1, n + m + 1):
	if i % 2 == 0:
		if l1[i - 1] == 0:
			if n > 0:
				l1.append(0)
				n -= 1
			else:
				l1.append(1)
				m -= 1
		elif m > 0:
			l1.append(1)
			m -= 1
		else:
			l1.append(0)
			n -= 1
	elif l1[i - 1] == 0:
		if m > 0:
			l1.append(1)
			m -= 1
		else:
			l1.append(0)
			n -= 1
	elif n > 0:
		l1.append(0)
		n -= 1
	else:
		l1.append(1)
		m -= 1
i = 0
n = n1
m = m1
for i in range(1, n + m):
	if l1[i] == l1[i - 1]:
		p1 += 1
	else:
		p2 += 1
l2 = [1]
m -= 1
for i in range(1, n + m + 1):
	if i % 2 == 0:
		if l2[i - 1] == 0:
			if n > 0:
				l2.append(0)
				n -= 1
			else:
				l2.append(1)
				m -= 1
		elif m > 0:
			l2.append(1)
			m -= 1
		else:
			l2.append(0)
			n -= 1
	elif l2[i - 1] == 0:
		if m > 0:
			l2.append(1)
			m -= 1
		else:
			l2.append(0)
			n -= 1
	elif n > 0:
		l2.append(0)
		n -= 1
	else:
		l2.append(1)
		m -= 1
n = n1
m = m1
for i in range(1, n + m):
	if l2[i] == l2[i - 1]:
		q1 += 1
	else:
		q2 += 1
p1 = max(p1, q1)
p2 = m + n - 1 - p1
print(p1, p2)


(n, m) = map(int, input().split())
(ans, n1, m1) = ([], n, m)
for j in ['r', 'b']:
	(ch, p1, p2) = (j, 0, 0)
	if ch == 'r':
		n -= 1
	else:
		m -= 1
	for i in range(1, n1 + m1):
		if i % 2:
			if ch == 'r':
				if m:
					ch = 'b'
					m -= 1
					p2 += 1
				else:
					n -= 1
					p1 += 1
			elif n:
				ch = 'r'
				n -= 1
				p2 += 1
			else:
				m -= 1
				p1 += 1
		elif ch == 'r':
			if n:
				n -= 1
				p1 += 1
			else:
				ch = 'b'
				m -= 1
				p2 += 1
		elif m:
			m -= 1
			p1 += 1
		else:
			ch = 'r'
			n -= 1
			p2 += 1
	ans.append([p1, p2])
	(n, m) = (n1, m1)
ans.sort(key=lambda x: x[0], reverse=True)
print(*ans[0])


a = list(map(int, input().split()))
b = sorted(a, reverse=True)
if b[1] % 2 == 0:
	b[0] -= 1
print(b[0] - b[1] % 2, b[1])


(n, m) = map(int, input().split())
(n, m) = (min(n, m), max(n, m))
score1 = 0
score2 = 0
score3 = 0
score4 = 0
l1 = []
l2 = []
x = n // 2
n -= x * 2
m -= x * 2
score2 = x * 2
score1 = score2 - 1
if n % 2 == 0:
	score1 += m
else:
	score2 += 1
	score1 += m
print(score1, score2)


(a, b) = map(int, input().split())
c = min(a, b)
print(a + b - 1 - c, c)


ar = []
for i in input().split(' '):
	ar.append(int(i))
red = ar[0]
blue = ar[1]
res = []
curr = 0
while red != 0 or blue != 0:
	if red == 0:
		res.append(0)
		blue = blue - 1
		curr = 1 - curr
	elif blue == 0:
		res.append(1)
		red = red - 1
		curr = 1 - curr
	elif len(res) == 0:
		res.append(1)
		red = red - 1
		curr = 1 - curr
	elif res[-1] == 1 and curr == 1:
		res.append(0)
		blue = blue - 1
		curr = 0
	elif res[-1] == 1 and curr == 0:
		res.append(1)
		red = red - 1
		curr = 1
	elif res[-1] == 0 and curr == 1:
		res.append(1)
		red = red - 1
		curr = 0
	elif res[-1] == 0 and curr == 0:
		res.append(0)
		blue = blue - 1
		curr = 1
p = 0
v = 0
for i in range(1, len(res)):
	if res[i] == res[i - 1]:
		p = p + 1
	else:
		v = v + 1
red = ar[0]
blue = ar[1]
res = []
curr = 0
while red != 0 or blue != 0:
	if red == 0:
		res.append(0)
		blue = blue - 1
		curr = 1 - curr
	elif blue == 0:
		res.append(1)
		red = red - 1
		curr = 1 - curr
	elif len(res) == 0:
		res.append(0)
		blue = blue - 1
		curr = 1 - curr
	elif res[-1] == 1 and curr == 1:
		res.append(0)
		blue = blue - 1
		curr = 0
	elif res[-1] == 1 and curr == 0:
		res.append(1)
		red = red - 1
		curr = 1
	elif res[-1] == 0 and curr == 1:
		res.append(1)
		red = red - 1
		curr = 0
	elif res[-1] == 0 and curr == 0:
		res.append(0)
		blue = blue - 1
		curr = 1
p2 = 0
v2 = 0
for i in range(1, len(res)):
	if res[i] == res[i - 1]:
		p2 = p2 + 1
	else:
		v2 = v2 + 1
if p > p2:
	print(p, v)
else:
	print(p2, v2)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())

def tr(prev, vs):
	ps = [-1, 0]
	play = 0
	while vs[0] or vs[1]:
		if not play:
			if vs[prev]:
				vs[prev] -= 1
				ps[play] += 1
			else:
				prev ^= 1
				vs[prev] -= 1
				ps[play] += 1
		elif vs[prev ^ 1]:
			prev ^= 1
			vs[prev] -= 1
			ps[play] += 1
		else:
			vs[prev] -= 1
			ps[play ^ 1] += 1
		play ^= 1
	return ps
v = ll()
v2 = list(v)
(a1, a2) = (tr(0, v), tr(1, v2))
ps = max(a1, a2)
print(*ps)


import os
import sys
import math
from io import BytesIO, IOBase
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())

def dijkstra(start, distance, path, n):
	visited = [False for _ in range(n)]
	distance[start] = 0
	for i in range(n):
		v = -1
		for j in range(n):
			if not visited[v] and (v == -1 or distance[j] < distance[v]):
				v = j
		if distance[v] == math.inf:
			break
		visited[v] = True
		for edge in adj[v]:
			destination = edge[0]
			weight = edge[1]
			if distance[v] + weight < distance[destination]:
				distance[destination] = distance[v] + weight
				path[destination] = v

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

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

def ncr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def npr(n, r):
	return math.factorial(n) // math.factorial(n - r)

def seive(n):
	primes = [True] * (n + 1)
	ans = []
	for i in range(2, n):
		if not primes[i]:
			continue
		j = 2 * i
		while j <= n:
			primes[j] = False
			j += i
	for p in range(2, n + 1):
		if primes[p]:
			ans += [p]
	return ans

def factors(n):
	factors = []
	x = 1
	while x * x <= n:
		if n % x == 0:
			if n // x == x:
				factors.append(x)
			else:
				factors.append(x)
				factors.append(n // x)
		x += 1
	return factors

def main():
	try:
		(n, m) = invr()
		print(max(n, m) - 1, min(n, m))
	except Exception as e:
		print(e)
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()


(n, m) = list(map(int, input().split()))
petaya = 0
vasaya = 0
petaya += min(n, m) - 1
vasaya += min(n, m)
petaya += max(m, n) - min(n, m)
print(petaya, vasaya)


(n, m) = map(int, input().split())
tot = n + m - 1
mm = min(n, m)
print(tot - mm, mm)


(n, m) = map(int, input().split())
v = min(n, m)
p = n + m - 1 - v
print(p, v)


def pairs(s1, s2):
	p1 = 0
	v1 = 0
	p2 = 0
	v2 = 0
	for i in range(len(s1) - 1):
		if s1[i] == s1[i + 1]:
			p1 += 1
		else:
			v1 += 1
		if s2[i] == s2[i + 1]:
			p2 += 1
		else:
			v2 += 1
	if p2 >= p1:
		petya = p2
		vasya = v2
	else:
		petya = p1
		vasya = v1
	print(petya, vasya)

def main():
	(n, m) = map(int, input().split())
	a = n
	b = m
	s1 = 'r'
	n -= 1
	s2 = 'b'
	b -= 1
	count = 1
	while n > 0 and m > 0:
		if count % 2 != 0:
			if s1[-1] == 'r':
				s1 += 'b'
				m -= 1
			else:
				s1 += 'r'
				n -= 1
		elif s1[-1] == 'r':
			s1 += 'r'
			n -= 1
		else:
			s1 += 'b'
			m -= 1
		count += 1
	while n > 0:
		s1 += 'r'
		n -= 1
	while m > 0:
		s1 += 'b'
		m -= 1
	count = 1
	while a > 0 and b > 0:
		if count % 2 != 0:
			if s2[-1] == 'r':
				s2 += 'b'
				b -= 1
			else:
				s2 += 'r'
				a -= 1
		elif s2[-1] == 'r':
			s2 += 'r'
			a -= 1
		else:
			s2 += 'b'
			b -= 1
		count += 1
	while a > 0:
		s2 += 'r'
		a -= 1
	while b > 0:
		s2 += 'b'
		b -= 1
	pairs(s1, s2)
main()


(n, m) = map(int, input().split())
mn = min(m, n)
mx = max(m, n)
c = 0
while mn > 1:
	mn -= 2
	c += 1
if mn == 1:
	dif = 2 * c + 1
	mx -= 2 * c
	sm = mx + 2 * c - 1
	print(sm, dif)
else:
	dif = 2 * c
	mx -= 2 * c
	sm = mx + 2 * c - 1
	print(sm, dif)


(n, m) = map(int, input().split())
mini = min(n, m)
maxi = max(n, m)
print(maxi - 1, mini)


(n, m) = map(int, input().split())
vasya = min(n, m)
petya = n + m - 1 - vasya
print('{} {}'.format(petya, vasya))


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq 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 tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def getAnsa(last, c):
	C = {}
	C[last] = c
	C[last ^ 1] = m + n - c
	if C[last] > 0:
		C[last] -= 1
	else:
		last ^= 1
		C[last] -= 1
	player = 1
	p0 = 0
	p1 = 0
	while C[0] + C[1] != 0:
		if player == 0:
			if C[last] > 0:
				C[last] -= 1
				p0 += 1
			else:
				last ^= 1
				C[last] -= 1
				p1 += 1
		else:
			last ^= 1
			if C[last] > 0:
				C[last] -= 1
				p1 += 1
			else:
				last ^= 1
				C[last] -= 1
				p0 += 1
		player ^= 1
	return p0
(n, m) = value()
petya = max(getAnsa(0, n), getAnsa(1, m))
print(petya, n + m - 1 - petya)


(p, q) = input().split()
p = int(p)
q = int(q)
high = max(p, q)
low = min(p, q)
print('%d %d' % (p + q - 1 - low, low))


def find(m, n):
	if m == 0 or n == 0:
		return (m + n - 1, 0)
	a = min(m, n)
	b = max(m, n)
	if a % 2 == 1:
		x = a - 1
		y = x
		b -= a - 1
		y += 1
		x += b - 1
		return (x, y)
	if b % 2 == 1:
		x = a - 1
		y = x
		b -= a - 1
		y += 1
		x += b - 1
		return (x, y)
	x = a - 1
	y = x + 1
	b -= a - 1
	y += 1
	x += b - 1
	return (x, y)
inp = list(map(int, input().split()))
(m, n) = inp
a = find(m, n)
b = find(n, m)
c = max(a[0], b[0])
print(c, end=' ')
print(m + n - 1 - c)


(n, m) = map(int, input().split())
(a, b) = (max(n, m), min(n, m))
print(a - 1, b)


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')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	(n, m) = readints()
	(red1, blue1) = (n, m)
	colors = []
	turn = 0
	while red1 > 0 or blue1 > 0:
		if not colors:
			colors.append('R')
			red1 -= 1
			turn ^= 1
		if not turn:
			if colors[-1] == 'R' and red1:
				colors.append('R')
				red1 -= 1
			elif colors[-1] == 'B' and blue1:
				colors.append('B')
				blue1 -= 1
			turn ^= 1
			continue
		if turn:
			if colors[-1] == 'B' and red1:
				colors.append('R')
				red1 -= 1
			elif colors[-1] == 'R' and blue1:
				colors.append('B')
				blue1 -= 1
			turn ^= 1
			continue
	if n >= m:
		for _ in range(red1):
			colors.append('R')
	else:
		for _ in range(blue1):
			colors.append('B')
	ans = []
	(first, second) = (0, 0)
	for i in range(1, n + m):
		first += colors[i] == colors[i - 1]
		second += colors[i] != colors[i - 1]
	ans.append([first, second])
	(red1, blue1) = (n, m)
	colors = []
	turn = 0
	while red1 > 0 or blue1 > 0:
		if not colors:
			colors.append('B')
			blue1 -= 1
			turn ^= 1
			continue
		if not turn:
			if colors[-1] == 'R' and red1:
				colors.append('R')
				red1 -= 1
			elif colors[-1] == 'B' and blue1:
				colors.append('B')
				blue1 -= 1
			turn ^= 1
			continue
		if turn:
			if colors[-1] == 'B' and red1:
				colors.append('R')
				red1 -= 1
			elif colors[-1] == 'R' and blue1:
				colors.append('B')
				blue1 -= 1
			turn ^= 1
			continue
	if n >= m:
		for _ in range(red1):
			colors.append('R')
	else:
		for _ in range(blue1):
			colors.append('B')
	(first, second) = (0, 0)
	for i in range(1, n + m):
		first += colors[i] == colors[i - 1]
		second += colors[i] != colors[i - 1]
	ans.append([first, second])
	print(*max(ans))

def main():
	t = 1
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline

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

def array_print(arr):
	print(' '.join(map(str, arr)))
(n, m) = multi_input()
print(max(n, m) - 1, min(m, n))


n = list(map(int, input().split()))
print(max(n) - 1, min(n))


(x, y) = map(int, input().split())
print(max(x, y) - 1, min(x, y))


def make_string(temp_r, temp_b, swap):
	str1 = ''
	add1 = 'BR'
	add2 = 'RB'
	while temp_b or temp_r:
		if temp_b == 0:
			str1 += temp_r * 'R'
			break
		elif temp_r == 0:
			str1 += temp_b * 'B'
			break
		if swap:
			str1 += add1
		else:
			str1 += add2
		swap = not swap
		temp_r -= 1
		temp_b -= 1
	return str1

def count_pair(str):
	cnt_p = 0
	cnt_v = 0
	for (idx, s) in enumerate(str):
		if idx > 0:
			if str[idx - 1] == str[idx]:
				cnt_p += 1
			else:
				cnt_v += 1
	return (cnt_p, cnt_v)
(r, b) = map(int, input().split())
(temp_r, temp_b) = (r, b)
swap = True
str1 = make_string(temp_r, temp_b, swap)
str2 = make_string(temp_r, temp_b, not swap)
(cnt_p_1, cnt_v_1) = count_pair(str1)
(cnt_p_2, cnt_v_2) = count_pair(str2)
if cnt_p_1 > cnt_p_2:
	print(cnt_p_1, cnt_v_1, end=' ')
else:
	print(cnt_p_2, cnt_v_2, end=' ')


(n, m) = map(int, input().split())
if n == m:
	arr = [0]
	tag = 0
	first = n - 1
	second = m
	turn = 1
else:
	if n > m and m % 2 != 0:
		arr = [1]
		first = n
		second = m - 1
		tag = 1
	elif n > m and m % 2 == 0:
		arr = [0]
		first = n - 1
		second = m
		tag = 0
	elif m > n and n % 2 != 0:
		arr = [0]
		first = n - 1
		second = m
		tag = 0
	else:
		arr = [1]
		first = n
		second = m - 1
		tag = 1
	turn = 1
i = 1
while i < n + m:
	if turn == 0:
		if arr[-1] == 0:
			if first > 0:
				first -= 1
				arr.append(0)
			else:
				second -= 1
				arr.append(1)
		elif second > 0:
			second -= 1
			arr.append(1)
		else:
			first -= 1
			arr.append(0)
		turn = 1
	else:
		if arr[-1] == 0:
			if second > 0:
				second -= 1
				arr.append(1)
			else:
				first -= 1
				arr.append(0)
				tag = 0
		elif first > 0:
			first -= 1
			arr.append(0)
		else:
			second -= 1
			arr.append(1)
		turn = 0
	i += 1
count1 = 0
count2 = 0
for i in range(1, n + m):
	if arr[i] == arr[i - 1]:
		count1 += 1
	else:
		count2 += 1
print(count1, count2)


(N, M) = map(int, input().strip().split())
if N < M:
	(N, M) = (M, N)
print(N - 1, M)


from math import *

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

def cins():
	return input.split()

def cino(test=False):
	if not test:
		return int(input())
	else:
		return input()

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

def ssplit():
	return list(input().split())

def printlist(l):
	for i in l:
		print(i, end=' ')

def main():
	(n, m) = cin()
	print(max(n, m) - 1, min(n, m))
main()


import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf

def getInts():
	return map(int, sys.stdin.readline().rstrip().split(' '))

def getString():
	return sys.stdin.readline().rstrip()

def solve(a, b):
	oddPairs = min(a, b)
	remainder = max(a, b) - oddPairs
	p = oddPairs - 1 + remainder
	q = oddPairs
	return (p, q)

def printOutput(ans):
	sys.stdout.write(str(ans[0]) + ' ' + str(ans[1]))

def readinput():
	(a, b) = getInts()
	printOutput(solve(a, b))
readinput()


(r, b) = map(int, input().split())
print(max(r, b) - 1, min(r, b))


(n, m) = list(map(int, input().split()))
if n > m:
	(n, m) = (m, n)
a1 = n - 1 + (m - n)
a2 = n
print(a1, a2)


(red, blue) = map(int, input().split())
total_point = red + blue - 1
vasya = min(red, blue)
petya = total_point - vasya
print(petya, vasya)


(R, B) = list(map(int, input().split()))
print('%d %d' % (max(R, B) - 1, min(R, B)))


import re
import itertools
from collections import Counter

class Task:
	(n, m) = (0, 0)
	petyaScore = 0
	vasyaScore = 0

	def getData(self):
		(self.n, self.m) = [int(x) for x in input().split(' ')]

	def solve(self):
		n = self.n
		m = self.m
		if n != m:
			self.vasyaScore = min(n, m)
		else:
			self.vasyaScore = min(n, m)
		self.petyaScore = self.n + self.m - 1 - self.vasyaScore

	def printAnswer(self):
		print(self.petyaScore, self.vasyaScore)
task = Task()
task.getData()
task.solve()
task.printAnswer()


(n1, m1) = [int(x) for x in input().split()]

def red_first():
	(n, m) = (n1, m1)
	p_score = v_score = 0
	n -= 1
	diff = min(n // 2, m // 2) * 2
	n -= diff
	m -= diff
	p_score += diff
	v_score += diff
	if m == 0:
		p_score += n
	elif m == 1:
		v_score += 2 if n > 0 else 1
		p_score += max(n - 1, 0)
	elif n == 0:
		v_score += 1
		p_score += m - 1
	else:
		v_score += 3 if m > 2 else 2
		p_score += 1
		p_score += max(m - 3, 0)
	return (p_score, v_score)

def blue_first():
	(n, m) = (n1, m1)
	p_score = v_score = 0
	m -= 1
	diff = min(n // 2, m // 2) * 2
	n -= diff
	m -= diff
	p_score += diff
	v_score += diff
	if n == 0:
		v_score += m
	elif n == 1:
		p_score += 2 if m > 0 else 1
		v_score += max(m - 1, 0)
	elif m == 0:
		p_score += 1
		v_score += n - 1
	else:
		p_score += 3 if n > 2 else 2
		v_score += 1
		v_score += max(n - 3, 0)
	return (v_score, p_score)
(red_p, red_v) = red_first()
(blue_p, blue_v) = blue_first()
(res_p, res_v) = (red_p, red_v) if red_p > blue_p else (blue_p, blue_v)
print(res_p, res_v)


(n, m) = map(int, input().split())
Diff = abs(n - m)
p = min(m, n)
print(p - 1 + Diff, p)


(n, m) = map(int, input().split())
res = n + m - 1
diff = min(n, m)
z = res - diff
print(z, diff)


def solver(first, second):
	change_first = True
	pair_of_pairs = min(first // 2, second // 2)
	petya_points = 2 * pair_of_pairs
	vasya_points = 2 * pair_of_pairs
	first -= 2 * pair_of_pairs
	second -= 2 * pair_of_pairs
	if second >= 2:
		second -= 2
		petya_points += 1
		vasya_points += 1
		change_first = False
	if first != 0 or second != 0:
		if change_first:
			(first, second) = (second, first)
		if first == 0:
			petya_points += second
		elif second < 2:
			vasya_points += 1 + second
		else:
			vasya_points += 2
			petya_points += second - 1
	return (petya_points, vasya_points)
(num_red_cubes, num_blue_cubes) = map(int, input().split())
(petya_points_red_starts, vasya_points_red_starts) = solver(num_red_cubes - 1, num_blue_cubes)
(petya_points_blue_starts, vasya_points_blue_starts) = solver(num_blue_cubes - 1, num_red_cubes)
if petya_points_red_starts > petya_points_blue_starts:
	print(f'{petya_points_red_starts} {vasya_points_red_starts}')
elif petya_points_red_starts == petya_points_blue_starts and vasya_points_red_starts <= vasya_points_blue_starts:
	print(f'{petya_points_red_starts} {vasya_points_red_starts}')
else:
	print(f'{petya_points_blue_starts} {vasya_points_blue_starts}')


def main(n, m):
	if n == m:
		return (n - 1, m)
	if n > m:
		temp = n
		n = m
		m = temp
	return (m - 1, n)
print('{} {}'.format(*main(*list(map(int, input().split(' '))))))


(red, blue) = map(int, input().strip().split())
total = red + blue
arr = []

def PetyaGoesFirst(red, blue):
	if red % 2 == 1 and red < blue:
		red -= 1
		arr.append('r')
	elif blue % 2 == 1 and blue < red:
		blue -= 1
		arr.append('b')
	elif red % 2 == 1:
		red -= 1
		arr.append('r')
	elif blue % 2 == 1:
		blue -= 1
		arr.append('b')
	elif red > blue:
		red -= 1
		arr.append('r')
	else:
		blue -= 1
		arr.append('b')
	return (red, blue, arr)

def VanyaGoesNext(red, blue, arr):
	if arr[-1] == 'b' and red or not blue:
		red -= 1
		arr.append('r')
	else:
		blue -= 1
		arr.append('b')
	return (red, blue, arr)

def PetyaGoesNext(red, blue, arr):
	if arr[-1] == 'b' and blue or not red:
		blue -= 1
		arr.append('b')
	else:
		red -= 1
		arr.append('r')
	return (red, blue, arr)
(red, blue, arr) = PetyaGoesFirst(red, blue)
(red, blue, arr) = VanyaGoesNext(red, blue, arr)
while red or blue:
	(red, blue, arr) = PetyaGoesNext(red, blue, arr)
	if not (red or blue):
		break
	(red, blue, arr) = VanyaGoesNext(red, blue, arr)
(petya, vanya) = (0, 0)
for i in range(total - 1):
	if arr[i] == arr[i + 1]:
		petya += 1
	else:
		vanya += 1
print(petya, vanya)


(m, n) = [int(x) for x in input().split()]
var1 = []
var2 = []
(m1, n1) = (m, n)
p = False
var1.append(0)
m1 -= 1
while m1 + n1 > 0:
	if p:
		wanted = var1[-1]
	else:
		wanted = 1 - var1[-1]
	if wanted == 0 and m1 > 0:
		var1.append(0)
		m1 -= 1
	elif wanted == 1 and n1 > 0:
		var1.append(1)
		n1 -= 1
	elif m1 > 0:
		var1.append(0)
		m1 -= 1
	else:
		var1.append(1)
		n1 -= 1
	p = not p
(m1, n1) = (m, n)
p = False
var2.append(1)
n1 -= 1
while m1 + n1 > 0:
	if p:
		wanted = var2[-1]
	else:
		wanted = 1 - var2[-1]
	if wanted == 0 and m1 > 0:
		var2.append(0)
		m1 -= 1
	elif wanted == 1 and n1 > 0:
		var2.append(1)
		n1 -= 1
	elif m1 > 0:
		var2.append(0)
		m1 -= 1
	else:
		var2.append(1)
		n1 -= 1
	p = not p
petya = 0
vasya = 0
for i in range(len(var1) - 1):
	if var1[i] == var1[i + 1]:
		petya += 1
	else:
		vasya += 1
petya1 = 0
vasya1 = 0
for i in range(len(var2) - 1):
	if var2[i] == var2[i + 1]:
		petya1 += 1
	else:
		vasya1 += 1
if petya1 > petya:
	print(petya1, vasya1)
else:
	print(petya, vasya)


def prob():
	(p, q) = [int(x) for x in input().split()]
	a = min(p, q)
	print(p + q - 1 - a, a)
t = 1
for _ in range(0, t):
	prob()


def ip():
	return int(input())

def sip():
	return input()

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

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

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst
(m, n) = mip()
print(max(m, n) - 1, min(m, n))


from collections import *

def count(A):
	cnt = 0
	i = 1
	while i < len(A):
		if A[i] == A[i - 1]:
			cnt += 1
		i += 1
	return cnt

def build(color, n, m):
	A = [color]
	if color == 'R':
		n -= 1
	else:
		m -= 1
	petya = False
	while n and m:
		if petya:
			if A[-1] == 'R':
				n -= 1
				A.append('R')
			else:
				m -= 1
				A.append('B')
		elif A[-1] == 'R':
			m -= 1
			A.append('B')
		else:
			n -= 1
			A.append('R')
		petya = not petya
	A.extend(['R'] * n)
	A.extend(['C'] * m)
	return A

def main():
	(n, m) = read_ints()
	A = build('R', n, m)
	cnt1 = count(A)
	A = build('B', n, m)
	cnt2 = count(A)
	cnt = max(cnt1, cnt2)
	print('%d %d' % (cnt, n + m - 1 - cnt))
MOD = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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

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

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

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

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

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

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

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

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

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

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

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

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


(x, y) = map(int, input().split())
z = min(x, y)
print(x + y - z - 1, z)


def main():
	(n, m) = [int(i) for i in input().split()]
	print(max(m, n) - 1, min(n, m))
	return 0
main()


import math
import collections

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

def cstr():
	return list(map(str, input().split(' ')))

def solve():
	(r, b) = cint()
	lst1 = []
	lst2 = []
	(tr, tb) = (r, b)
	counter = 0
	while tr != 0 or tb != 0:
		if tr != 0 and tb != 0:
			if counter % 2 == 0:
				lst1.extend([0, 1])
			else:
				lst1.extend([1, 0])
			tr -= 1
			tb -= 1
		elif tr == 0:
			lst1.append(1)
			tb -= 1
		elif tb == 0:
			lst1.append(0)
			tr -= 1
		counter += 1
	(tr, tb) = (r, b)
	counter = 0
	while tr != 0 or tb != 0:
		if tr != 0 and tb != 0:
			if counter % 2 == 0:
				lst2.extend([1, 0])
			else:
				lst2.extend([0, 1])
			tr -= 1
			tb -= 1
		elif tr == 0:
			lst2.append(1)
			tb -= 1
		elif tb == 0:
			lst2.append(0)
			tr -= 1
		counter += 1
	(p1, p2, v1, v2) = [0, 0, 0, 0]
	for i in range(1, r + b):
		if lst1[i] != lst1[i - 1]:
			v1 += 1
		else:
			p1 += 1
		if lst2[i] != lst2[i - 1]:
			v2 += 1
		else:
			p2 += 1
	if p1 > p2:
		print(p1, v1)
	else:
		print(p2, v2)
t = 1
while t != 0:
	solve()
	t -= 1


(n, m) = map(int, input().split())
rem = abs(n - m)
s = min(n, m)
print(s - 1 + rem, s)


(n, m) = map(int, input().split())
ans = 0
mx = n + m - 1
a = n - 1
b = m
if a < 2:
	ans = max(ans, b - 1)
tmp = 0
last = 0
for i in range(n):
	if i % 2:
		if a >= 2:
			a -= 2
			tmp += 1
		if a < 2:
			tmp += b - 1
			break
	else:
		if b >= 2:
			b -= 2
			tmp += 1
		if b < 2:
			tmp += a - 1
			break
ans = max(ans, tmp)
a = n
b = m - 1
if b < 2:
	ans = max(ans, a - 1)
tmp = 0
last = 0
for i in range(n):
	if i % 2 == 0:
		if a >= 2:
			a -= 2
			tmp += 1
		if a < 2:
			tmp += b - 1
			break
	else:
		if b >= 2:
			b -= 2
			tmp += 1
		if b < 2:
			tmp += a - 1
			break
ans = max(ans, tmp)
print(ans, m + n - 1 - ans)


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def factors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac
a = list(map(int, input().split()))
print(max(a) - 1, min(a))


import os
import sys
from io import BytesIO, IOBase
from math import ceil, floor, pow, sqrt, gcd
from collections import Counter, defaultdict
from itertools import permutations, combinations
from time import time, sleep
BUFSIZE = 8192
MOD = 1000000007

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')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from os import path
if path.exists('tc.txt'):
	stdin = open('tc.txt', 'r')

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

def gms():
	return map(str, stdin.readline().strip().split())

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

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

def gars():
	return list(map(str, stdin.readline().strip().split()))

def gs():
	return stdin.readline().strip()

def gls():
	return list(stdin.readline().strip())

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

def pri(i, end='\n'):
	stdout.write(f'{i}' + end)

def priar(ar, end='\n'):
	stdout.write(' '.join(map(str, ar)) + end)

def solve():
	(r, b) = gmi()
	return [max(b, r) - 1, min(b, r)]
tc = 1
for i in range(tc):
	priar(solve())


import math
import sys
import collections
import bisect
import string
import time

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

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

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	(n, m) = get_ints()
	print(max(n, m) - 1, min(n, m))


from sys import stdin, stdout
(n, m) = [int(x) for x in stdin.readline().split()]
print(max(n, m) - 1, min(n, m))


import math
import collections

def solve(n, m):
	p = abs(n - m) + min(n, m) - 1
	v = min(n, m)
	return str(p) + ' ' + str(v)
(n, m) = [int(s) for s in input().split()]
result = solve(n, m)
print(result)


(n, m) = map(int, input().split())
v = n + m - 1
a = min(n, m)
print(v - a, a)


(n, m) = list(map(int, input().split()))
ans = max(n, m) - 1
print(ans, n + m - 1 - ans)


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)
(a, b) = mi()
(a, b) = (min(a, b), max(a, b))
(ac, bc) = (0, 1)
if a % 2 == 0:
	(a, b, ac, bc) = (b, a, 1, 0)
t = []
(x, y) = (ac, bc)
for i in range(min(a, b)):
	t.append(x)
	t.append(y)
	(x, y) = (y, x)
t += [ac] * (a - min(a, b))
t += [bc] * (b - min(a, b))
p = v = 0
for i in range(a + b - 1):
	if t[i] == t[i + 1]:
		p += 1
	else:
		v += 1
print(p, v)


(n, m) = map(int, input().split())
z = []
(q, w) = (n, m)
if n < m:
	z.append('b')
	m -= 1
else:
	z.append('r')
	n -= 1
i = 1
(a, b) = (0, 0)
while n > 0 and m > 0:
	if i % 2 == 1:
		if z[-1] == 'r':
			m -= 1
			z.append('b')
			b += 1
		else:
			n -= 1
			z.append('r')
			b += 1
	elif z[-1] == 'b':
		m -= 1
		z.append('b')
		a += 1
	else:
		n -= 1
		z.append('r')
		a += 1
	i += 1
if m > 0:
	a += m - 1
	if z[-1] == 'b':
		a += 1
	else:
		b += 1
	z.extend(['b'] * m)
if n > 0:
	a += n - 1
	if z[-1] == 'r':
		a += 1
	else:
		b += 1
	z.extend(['r'] * n)
(c, d) = (a, b)
(n, m) = (q, w)
z = []
if n > m:
	z.append('b')
	m -= 1
else:
	z.append('r')
	n -= 1
i = 1
(a, b) = (0, 0)
while n > 0 and m > 0:
	if i % 2 == 1:
		if z[-1] == 'r':
			m -= 1
			z.append('b')
			b += 1
		else:
			n -= 1
			z.append('r')
			b += 1
	elif z[-1] == 'b':
		m -= 1
		z.append('b')
		a += 1
	else:
		n -= 1
		z.append('r')
		a += 1
	i += 1
if m > 0:
	a += m - 1
	if z[-1] == 'b':
		a += 1
	else:
		b += 1
	z.extend(['b'] * m)
if n > 0:
	a += n - 1
	if z[-1] == 'r':
		a += 1
	else:
		b += 1
	z.extend(['r'] * n)
if a > c:
	print(a, b)
else:
	print(c, d)


(a, b) = map(int, input().split())
if a < b:
	(a, b) = (b, a)
print(a - 1, b)


def playingCubes(n, m):
	print(m + n - 1 - min(m, n), min(m, n))
(n, m) = input().split()
playingCubes(int(n), int(m))