Alice and Bob play ping-pong with simplified rules.

During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternately make a return until one of them doesn't make a return.

The one who doesn't make a return loses this play. The winner of the play commences the next play. Alice starts the first play.

Alice has $x$ stamina and Bob has $y$. To hit the ball (while serving or returning) each player spends $1$ stamina, so if they don't have any stamina, they can't return the ball (and lose the play) or can't serve the ball (in this case, the other player serves the ball instead). If both players run out of stamina, the game is over.

Sometimes, it's strategically optimal not to return the ball, lose the current play, but save the stamina. On the contrary, when the server commences a play, they have to hit the ball, if they have some stamina left.

Both Alice and Bob play optimally and want to, firstly, maximize their number of wins and, secondly, minimize the number of wins of their opponent.

Calculate the resulting number of Alice's and Bob's wins.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($1 \le x, y \le 10^6$) — Alice's and Bob's initial stamina.


-----Output-----

For each test case, print two integers — the resulting number of Alice's and Bob's wins, if both of them play optimally.


-----Examples-----

Input
3
1 1
2 1
1 7
Output
0 1
1 1
0 7


-----Note-----

In the first test case, Alice serves the ball and spends $1$ stamina. Then Bob returns the ball and also spends $1$ stamina. Alice can't return the ball since she has no stamina left and loses the play. Both of them ran out of stamina, so the game is over with $0$ Alice's wins and $1$ Bob's wins.

In the second test case, Alice serves the ball and spends $1$ stamina. Bob decides not to return the ball — he loses the play but saves stamina. Alice, as the winner of the last play, serves the ball in the next play and spends $1$ more stamina. This time, Bob returns the ball and spends $1$ stamina. Alice doesn't have any stamina left, so she can't return the ball and loses the play. Both of them ran out of stamina, so the game is over with $1$ Alice's and $1$ Bob's win.

In the third test case, Alice serves the ball and spends $1$ stamina. Bob returns the ball and spends $1$ stamina. Alice ran out of stamina, so she can't return the ball and loses the play. Bob, as a winner, serves the ball in the next $6$ plays. Each time Alice can't return the ball and loses each play. The game is over with $0$ Alice's and $7$ Bob's wins.

Source: codeforces | Difficulty: EASY
Tags: Game theory

Mathematics

Constructive algorithms


Solutions:
t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split(' ')]
	if a == 1:
		print('0', b)
	else:
		print(a - 1, b)


for _ in range(int(input())):
	(alice, bob) = map(int, input().strip().split())
	if alice == bob:
		print(alice - 1, bob)
	elif alice > bob:
		print(alice - 1, bob)
	else:
		print(alice - 1, bob)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(n - 1, m)


t = int(input().strip())
all_stamina = []
for _ in range(t):
	(x, z) = map(int, input().split())
	all_stamina.append([x, z])
for (x, z) in all_stamina:
	win_x = x - 1
	win_z = z
	print(win_x, win_z, end=' ')
	print()


mod = 10 ** 9 + 7

def solve():
	(x, y) = map(int, input().split())
	print(x - 1, y)
t = 1
t = int(input())
while t > 0:
	solve()
	t -= 1


def pingPong(a, b):
	print(a - 1, end=' ')
	print(b)
testcases = int(input())
while testcases:
	testcases -= 1
	(A, B) = tuple(map(int, input().split()))
	pingPong(A, B)


t = int(input())
for i in range(t):
	(a, b) = (int(i) for i in input().split())
	print(a - 1, b)


import sys
a = 0
b = 0
t = int(sys.stdin.readline().split()[0])
for i in range(t):
	line = sys.stdin.readline().split()
	a = int(line[0])
	b = int(line[1])
	print(a - 1, b)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	print(x - 1, y)


a = int(input())
st = [0 for i in range(a)]
for i in range(a):
	st[i] = input().split()
	st[i][0] = int(st[i][0])
	st[i][1] = int(st[i][1])
for i in range(a):
	print(st[i][0] - 1, end=' ')
	print(st[i][1])


from sys import stdin, stdout
ans = []

def main():
	(x, y) = list(map(int, stdin.readline().split()))
	ans.append(str(x - 1) + ' ' + str(y))
for _ in range(int(stdin.readline())):
	main()
stdout.write('\n'.join(ans))


t = int(input())
for _ in range(t):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	ansx = 0
	ansy = 0
	if x == 0 or y == 0:
		if x == 0:
			ansy = y
		if y == 0:
			ansx = x
	elif x == 1 and y == 1:
		ansy = 1
	else:
		ansx = x - 1
		ansy = y
	print(ansx, end=' ')
	print(ansy)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 1:
		print(0, b)
	elif a == b:
		print(a - 1, b)
	else:
		print(a - 1, b)


t = int(input())
for q in range(t):
	(x, y) = map(int, input().split())
	print(max(x - 1, 0), y)


T = int(input())
ans = ''
for _ in range(T):
	xy = [int(i) for i in input().split()]
	x = xy[0]
	y = xy[1]
	ans += str(x - 1) + ' ' + str(y) + '\n'
print(ans)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)

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

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

def SI():
	return sys.stdin.readline().strip()
for _ in [0] * II():
	(x, y) = IIs()
	print(x - 1, y)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(n, m) = list(map(int, input().split()))
		yield '{} {}'.format(n - 1, m)
t = int(input())
ans = gift()
print(*ans, sep='\n')


def main(x, y, a, b):
	if x > y:
		a += x - 1
		b += y
		return (a, b)
	if y > x:
		a += x - 1
		b += y
		return (a, b)
	if x == y:
		a += x - 1
		b += y
		return (a, b)
k = int(input())
for _ in range(k):
	(x, y) = map(int, input().strip().split())
	flag = True
	a = 0
	b = 0
	s = main(x, y, a, b)
	print(s[0], s[1])


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(n - 1, k)


def pingPong(a, b):
	return [a - 1, b]
t = int(input())
final = []
for _ in range(t):
	(a, b) = map(int, input().split())
	final.append(pingPong(a, b))
for _ in range(t):
	print(final[_][0], final[_][1])


def main():
	rounds = int(input())
	results = []
	for _ in range(rounds):
		(a, b) = [int(item) for item in input().split()]
		results.append(' '.join((str(a - 1), str(b))))
	for item in results:
		print(item)
main()


for i in range(int(input())):
	x = list(map(int, input().split()))
	print(x[0] - 1, x[1])


T = int(input())
r = 1

def getnext(x, y):
	if x == 0:
		return [0, y + 1]
	if y == 0:
		return [x, 0]
	[me1, you1] = getnext(x, y - 1)
	you1 += 1
	if x > 0:
		[you2, me2] = getnext(y, x - 1)
	if me1 > me2:
		return [me1, you1]
	elif me1 < me2:
		return [me2, you2]
	if you1 < you2:
		return [me1, you1]
	elif you1 > you2:
		return [me2, you2]
	print('ERROR!', x, y)
while r <= T:
	(m, n) = map(int, input().split())
	print(m - 1, n)
	r += 1


a = int(input())
for i in range(a):
	(z, x) = [int(i) for i in input().split()]
	print(z - 1, x)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if x == 1:
		print(0, y)
	elif y == 1:
		print(x - 1, 1)
	elif y >= x:
		print(x - 1, y)
	else:
		x -= 1
		print(x, y)


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	print(a - 1, b)


t = int(input())
for q in range(t):
	arr = list(map(int, input().split(' ')))
	(x, y) = (arr[0], arr[1])
	bob = y
	alice = x - 1
	print(alice, end=' ')
	print(bob)


t = int(input())
rj = []
for i in range(t):
	(x, y) = map(int, input().split())
	rj.append(x - 1)
	rj.append(y)
for i in range(0, len(rj), 2):
	print(rj[i], rj[i + 1])


a = int(input())
for x in range(a):
	(b, c) = map(int, input().split())
	print(b - 1, c)


T = int(input())
for __ in range(T):
	(x, y) = map(int, input().split())
	print(x - 1, y)


import sys
import functools
input = sys.stdin.readlines()
for i in range(1, len(input)):
	input[i] = input[i].split()
	(x, y) = input[i]
	(x, y) = (int(x), int(y))
	print(x - 1, y)


t = int(input())
for tc in range(t):
	(a, b) = list(map(int, input().split()))
	print(a - 1, b)


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

def li():
	return [int(i) for i in input().split()]
for t in range(ii()):
	(x, y) = li()
	print(x - 1, y)


import math
import sys
import bisect
from heapq import heapify, heappop, heappush
from itertools import *
from collections import deque, OrderedDict
sys.setrecursionlimit(10 ** 6)
II = lambda : sys.stdin.readline()
inp = lambda : int(II())
inpm = lambda : map(int, II().split())
inpl = lambda : list(inpm())
arr_mn = lambda _n, _m: [[0 for __ in range(_m)] for _ in range(_n)]
arr_nn = lambda _n: arr_mn(_n, _n)
EPS = 1e-09
INF = int(1e+18)
MOD = int(1000000000.0) + 7
N = 2000009

def solve():
	(a, b) = inpm()
	print(a - 1, b)

def main():
	t = inp()
	for i in range(t):
		solve()
main()


import time, math as mt, bisect as bs, 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 IP():
	return map(int, stdin.readline().split())

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

def P(x):
	return stdout.write(str(x) + '\n')

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 bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj

def sieve():
	li = [True] * (10 ** 3 + 5)
	(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, cur) = ([0] * 200, 0)
	for i in range(10 ** 3 + 5):
		if li[i] == True:
			prime[cur] = i
			cur += 1
	return prime

def SPF():
	mx = 10 ** 6 + 1
	spf[1] = 1
	for i in range(2, mx):
		if spf[i] == 1000000000.0:
			spf[i] = i
			for j in range(i * i, mx, i):
				if i < spf[j]:
					spf[j] = i
	return

def prime(n, d):
	prm = set()
	while n != 1:
		prm.add(spf[n])
		n = n // spf[n]
	for ele in prm:
		d[ele] = d.get(ele, 0) + 1
	return
mod = 998244353

def solve():
	(x, y) = IP()
	print(x - 1, y)
	return
t = II()
for i in range(t):
	solve()


import sys, math
sys.setrecursionlimit(10 ** 8)
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	print(x - 1, y)


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	print(A - 1, B)


def Solve():
	for t in range(int(input())):
		(x, y) = map(int, input().split())
		(xa, ya) = (0, 0)
		xa += x - 1
		ya += y
		print(xa, ya)
Solve()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print(a - 1, b)


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(x, y) = map(int, input().split())
	print(x - 1, y)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x - 1, y)


t = int(input())
for _ in range(t):
	data = list(map(int, input().split()))
	x = data[0] - 1
	y = data[1]
	print(x, y)


import sys
import math
from collections import defaultdict as dd
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	(x, y) = map(int, input().split())
	print(x - 1, y)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	(x, y) = map(int, input().split())
	print(x - 1, y)


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	t = int(input())
	for _ in range(t):
		(x, y) = map(int, input().split())
		(a, b) = (0, 0)
		if x == 1:
			if y == 0:
				a = 1
				b = 0
			else:
				a = 0
				b = y
		elif y == 0:
			a = x
			b = 0
		else:
			a = x - 1
			b = y
		print(a, b)
resolve()


import sys
import math
from bisect import bisect_left
from collections import defaultdict

def get_lcp(s, suffix_array):
	s = s + '$'
	n = len(s)
	lcp = [0] * n
	pos = [0] * n
	for i in range(n - 1):
		pos[suffix_array[i]] = i
	k = 0
	for i in range(n - 1):
		if k > 0:
			k -= 1
		if pos[i] == n - 1:
			lcp[n - 1] = -1
			k = 0
			continue
		else:
			j = suffix_array[pos[i] + 1]
			while max([i + k, j + k]) < n and s[i + k] == s[j + k]:
				k += 1
			lcp[pos[i]] = k
	return lcp

def get_suffix_array(word):
	suffix_array = [('', len(word))]
	for position in range(len(word)):
		sliced = word[len(word) - position - 1:]
		suffix_array.append((sliced, len(word) - position - 1))
	suffix_array.sort(key=lambda x: x[0])
	return [item[1] for item in suffix_array]

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

def bin_search(collection, element):
	i = bisect_left(collection, element)
	if i != len(collection) and collection[i] == element:
		return i
	else:
		return -1

def main():
	t = int(input())
	for _ in range(t):
		(x, y) = map(int, input().split())
		if x == 1:
			print(0, y)
		elif y == 1:
			print(x - 1, 1)
		else:
			print(x - 1, y)
main()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n - 1, m)


t = int(input())
all = []
for i in range(t):
	x = input()
	a = [int(i) for i in x.split()]
	all.append(a)
for item in all:
	(x, y) = (item[0], item[1])
	print(x - 1, y)


def func(x, y):
	print(x - 1, y)
t = int(input())
for _ in range(t):
	(x, y) = [int(i) for i in input().split()]
	func(x, y)


for j in range(0, int(input())):
	(a, b) = map(int, input().split())
	print(a - 1, b)


t = int(input())
for i in range(0, t):
	(m, n) = map(int, input().split())
	l = []
	l.append(m - 1)
	l.append(n)
	print(*l, sep=' ')


answer = ''
t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	if a == 1:
		answer += str(0) + ' ' + str(b) + '\n'
	elif b == 0:
		answer += str(a) + ' ' + '0' + '\n'
	else:
		answer += str(a - 1) + ' ' + str(b) + '\n'
print(answer)


t = int(input())
x = [list(map(int, input().split())) for i in range(t)]
for p in x:
	if p[0] == 0:
		print(f'0 {p[1]}')
		continue
	if p[1] == 0:
		print(f'{p[0]} 0')
		continue
	alice = p[0] - 1
	bob = p[1]
	print(f'{alice} {bob}')


answer = []
inp = []
T = int(input())
for i in range(0, T):
	inp.append(input().split())

def process(player):
	player[0] = int(player[0])
	player[0] -= 1
	answer.append(str(player[0]) + ' ' + str(player[1]))
for j in inp:
	process(j)
for i in answer:
	print(i)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(a - 1, b)
	t -= 1


rounds = int(input())
scores = []
for _ in range(rounds):
	(alice_power, bob_power) = list(map(int, input().split()))
	scores.append((alice_power - 1, bob_power))
for score in scores:
	print(score[0], score[1])


for i in range(int(input())):
	(alice, bob) = map(int, input().split())
	alice_wins = alice - 1
	print(alice_wins, bob)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		(alice, bob) = inar()
		print(alice - 1, bob)
main()


from collections import Counter
import math
import sys
import heapq
from bisect import bisect, bisect_left, bisect_right

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

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 mod():
	return 10 ** 9 + 7
for i in range(INT()):
	s = input()
	val = s.split(' ')
	x = int(val[0])
	y = int(val[1])
	print(x - 1, y)


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	print(a - 1, b)


n = int(input())
for i in range(n):
	a = input().split()
	a1 = eval(a[0])
	if a1 == 1:
		b1 = 0
	else:
		b1 = a1 - 1
	t = str(b1) + ' ' + a[1]
	print(t)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	print(n - 1, m)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

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

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]
MOD = 998244353

def solve():
	(X, Y) = getInts()
	print(X - 1, Y)
	return
for _ in range(getInt()):
	solve()


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

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')
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x - 1, y)


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 ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))
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 fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

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

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

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

def solve():
	(x, y) = sep()
	print(x - 1, y)
testcase(int(inp()))


import sys
t = int(input())
for i in range(t):
	line = sys.stdin.readline().split()
	x = int(line[0])
	y = int(line[1])
	if x == 0 and y == 0:
		print(0, 0)
	elif x == 1 and y == 0:
		print(1, 0)
	elif x == 0 and y == 1:
		print(0, 1)
	else:
		print(x - 1, y)


import sys

def answer(x, y):
	print(x - 1, y)
	return

def main():
	t = int(input())
	while t:
		(x, y) = [int(i) for i in sys.stdin.readline().split()]
		answer(x, y)
		t -= 1
	return
main()


import sys, math

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

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

def lmii():
	return list(mii())

def dtob(n):
	return bin(n).replace('0b', '')

def main():
	for _ in range(ii()):
		(x, y) = mii()
		print(x - 1, y)
main()


numberOfTestCases = int(input())
for _ in range(0, numberOfTestCases):
	string = input().split()
	(n, m) = map(int, string)
	print(n - 1, m)


def work():
	(x, y) = map(int, input().split())
	print(x - 1, y, end='\n')
T = int(input())
for Case in range(T):
	work()


import sys
import math

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()
for _ in range(int(input())):
	(x, y) = get_ints()
	print(x - 1, y)


I = input
for _ in range(int(I())):
	(a, b) = map(int, I().split())
	print(a - 1, b)


from sys import stdin
cas = int(stdin.readline().strip())
ans = 0

def sm(x):
	return x * (x + 1) // 2
for ca in range(cas):
	(n, m) = map(int, stdin.readline().strip().split())
	print(n - 1, m)


def solve(x, y):
	ans1 = x - 1
	ans2 = y
	print(ans1, ans2)
for i in range(int(input())):
	(x, y) = list(map(int, input().split()))
	solve(x, y)


t = int(input())

def solve():
	(a, b) = map(int, input().split())
	print(a if b == 0 else a - 1, b)
for _ in range(t):
	solve()


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

def it():
	return int(input())
for _ in range(it()):
	(x, y) = mp()
	if x == 1:
		print(0, y)
	else:
		print(x - 1, y)


x = int(input())
for _ in range(x):
	l = [int(i) for i in input().split()]
	l[0] = l[0] - 1
	print(*l)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a - 1, b)


import sys
input = sys.stdin.readline

def solve():
	(x, y) = map(int, input().split())
	return [x - 1, y]
for _ in range(int(input())):
	print(*solve())


import os
from math import factorial
import sys
from io import BytesIO, IOBase

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

def IIX():
	return (int(x) for x in sys.stdin.readline().split())

def II():
	return int(inp())

def LI():
	return list(map(int, inp().split()))

def LS():
	return list(map(str, inp().split()))

def L(x):
	return list(x)

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

class GraphAL:

	def __init__(self, Nodes, isDirected=False):
		self.nodes = [x for x in range(1, Nodes + 1)]
		self.adj_list = {}
		self.isDirected = isDirected
		for node in self.nodes:
			self.adj_list[node] = []

	def add_edge(self, x, y):
		self.adj_list[x].append(y)
		if self.isDirected == False:
			self.adj_list[y].append(x)

	def return_graph(self):
		return self.adj_list

class GraphAM:

	def __init__(self, Nodes, isDirected=False):
		self.adj_matrix = [[0] * (Nodes + 1) for x in range(Nodes + 2)]
		self.isDirected = isDirected

	def add_edge(self, x, y):
		if self.isDirected:
			self.adj_matrix[x][y] = 1
		elif self.isDirected == False:
			self.adj_matrix[x][y] = 1
			self.adj_matrix[y][x] = 1

	def delete_edge(self, x, y):
		if self.isDirected:
			self.adj_matrix[x][y] = 0
		if self.isDirected == False:
			self.adj_matrix[x][y] = 0
			self.adj_matrix[y][x] = 0

	def degree(self, x):
		l = self.adj_matrix[x]
		return l.count(1)

	def return_graph(self):
		return self.adj_matrix

def solve():
	(x, y) = IIX()
	print(x - 1, 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.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		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')
try:
	t = II()
	for _ in range(t):
		solve()
except EOFError as e:
	out('')
except RuntimeError as r:
	out('')


try:
	for t in range(int(input())):
		(x, y) = map(int, input().split())
		print(x - 1, y)
except:
	pass


t = int(input())
z = 0
scores = []
while z < t:
	z += 1
	(a_sta, b_sta) = input().split()
	a_sta = int(a_sta)
	b_sta = int(b_sta)
	if a_sta < b_sta:
		if a_sta == 1:
			a_scr = 0
			b_scr = b_sta
			scores.append([a_scr, b_scr])
		elif a_sta < b_sta and a_sta != 0:
			a_scr = a_sta - 1
			b_scr = b_sta
			scores.append([a_scr, b_scr])
	elif a_sta == b_sta:
		scores.append([a_sta - 1, b_sta])
	else:
		b_scr = b_sta
		a_scr = a_sta - 1
		scores.append([a_scr, b_scr])
for score in scores:
	print(*score)


import sys, os
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
from itertools import permutations
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		(a, b) = read()
		print(a - 1, b)
main()


inn = lambda : int(input())
inm = lambda : map(int, input().split())
ins = lambda : str(input())
ina = lambda : list(map(int, input().split()))

def solve():
	(x, y) = inm()
	print(x - 1, y)

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


import sys

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_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

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

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		(x, y) = get_ints()
		get_print(str(x - 1) + ' ' + str(y))
solve()


import math
import sys
from collections import defaultdict, Counter
from functools import lru_cache
t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	print(a - 1, b)


a = int(input())
for i in range(a):
	(m, n) = map(int, input().split())
	x = m - 1
	y = n
	print(x, y)


a = int(input())
for i in range(0, a):
	(s1, s2) = map(int, input().split())
	if s2 > s1:
		print(s1 - 1, s2)
	elif s1 > s2:
		print(s1 - 1, s2)
	else:
		print(s1 - 1, s2)


def call():
	(x, y) = [int(x) for x in input().split()]
	print(f'{x - 1} {y}')
t = int(input())
for i in range(t):
	call()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 1:
		print('0', k)
	elif n >= k:
		print(n - 1, k)
	elif n < k:
		print(n - 1, k)


def ping():
	(x, y) = map(int, input().split())
	print(x - 1, end=' ')
	print(y)
t = int(input())
for i in range(t):
	ping()


n = int(input())
alice = []
bob = []
a_score = []
b_score = []
for x in range(n):
	stam = list(map(int, input().split()))
	alice.append(stam[0])
	bob.append(stam[1])
for stam in range(n):
	alice[stam] -= 1
	remove = alice[stam] - bob[stam]
	print(f'{alice[stam]} {bob[stam]}')


t = int(input())
for _ in range(0, t):
	inputs = [int(num) for num in input().split()]
	x = inputs[0]
	y = inputs[1]
	print(f'{x - 1} {y}')


from collections import *
from heapq import *
from itertools import *
from functools import *
from random import *
import sys
INF = float('Inf')

def genTokens(lines):
	for line in lines:
		for token in line.split():
			yield token

def nextFn(fn):
	return lambda it: fn(it.__next__())
nint = nextFn(int)

def genCases():
	it = genTokens(sys.stdin)
	T = nint(it)
	for _ in range(T):
		X = nint(it)
		Y = nint(it)
		yield (X, Y)

def main():
	for case in genCases():
		solve(case)

def solve(case):
	(X, Y) = case
	print(X - 1, Y)
main()


t = int(input())
while t > 0:
	t -= 1
	(x, y) = map(int, input().split(' '))
	print(x - 1, y)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x - 1, y)


t = int(input())
X = []
Y = []
for i in range(t):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
for i in range(t):
	print(X[i] - 1, Y[i])


games = int(input())
for i in range(games):
	(Alice, Bob) = input().split(' ')
	Alice = int(Alice)
	Bob = int(Bob)
	if Alice > 0:
		if Bob != 0:
			print(Alice - 1, Bob)
		else:
			print(Alice, Bob)
	else:
		print(Alice, Bob)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from collections import Counter
from bisect import bisect_left
import sys
from queue import PriorityQueue
import operator as op
from functools import reduce
mod = 1000000007

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

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

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

def printIn(ob):
	return stdout.write(str(ob) + '\n')

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

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 SieveOfEratosthenes(n):
	prime_list = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			prime_list.append(p)
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime_list

def get_divisors(n):
	for i in range(1, int(n / 2) + 1):
		if n % i == 0:
			yield i
	yield n

def myCode():
	(x, y) = In()
	print(x - 1, y)

def main():
	for t in range(I()):
		myCode()
main()


for _ in 'A' * int(input()):
	(n, m) = map(int, input().split())
	print(n - 1, m)


import sys
input = iter(sys.stdin.read().splitlines()).__next__
TC = int(input())
for tc in range(TC):
	(x, y) = map(int, input().split())
	print('%d %d' % (x - 1, y))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	if a == 0:
		print(a, b)
	print(a - 1, b)
	t = t - 1


for case in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	k = min(x // 2, y)
	print(x - 1, y)


T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	print(X - 1, Y)


import math
for i in range(0, int(input())):
	(x, y) = map(int, input().split())
	print(x - 1, y)


t = int(input())
ans = ''
for i in range(t):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	res = str(x - 1) + ' ' + str(y)
	ans += res + '\n'
print(ans)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().strip().split())
	print(x - 1, y)


o = int(input())
for j in range(o):
	(h, l) = map(int, input().split())
	print(h - 1, l)


x = int(input())
for m in range(x):
	(y, z) = map(int, input().split())
	print(y - 1, z)


def program():
	(a, b) = [int(x) for x in input().split()]
	print(a - 1, b)
test = 1
test = int(input())
for i in range(test):
	program()