Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $n$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the largest number of problems wins, the organizers came up with different rules.

Suppose in the first round participant A took $x$-th place and in the second round — $y$-th place. Then the total score of the participant A is sum $x + y$. The overall place of the participant A is the number of participants (including A) having their total score less than or equal to the total score of A. Note, that some participants may end up having a common overall place. It is also important to note, that in both the first and the second round there were no two participants tying at a common place. In other words, for every $i$ from $1$ to $n$ exactly one participant took $i$-th place in first round and exactly one participant took $i$-th place in second round.

Right after the end of the Olympiad, Nikolay was informed that he got $x$-th place in first round and $y$-th place in the second round. Nikolay doesn't know the results of other participants, yet he wonders what is the minimum and maximum place he can take, if we consider the most favorable and unfavorable outcome for him. Please help Nikolay to find the answer to this question.


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 100$) — the number of test cases to solve.

Each of the following $t$ lines contains integers $n$, $x$, $y$ ($1 \leq n \leq 10^9$, $1 \le x, y \le n$) — the number of participants in the olympiad, the place that Nikolay took in the first round and the place that Nikolay took in the second round.


-----Output-----

Print two integers — the minimum and maximum possible overall place Nikolay could take.


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

Output
1 3

Input
1
6 3 4

Output
2 6



-----Note-----

Explanation for the first example:

Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: $\left. \begin{array}{|c|c|c|c|c|} \hline \text{Participant} & {\text{Round 1}} & {\text{Round 2}} & {\text{Total score}} & {\text{Place}} \\ \hline A & {1} & {3} & {4} & {1} \\ \hline B & {2} & {4} & {6} & {3} \\ \hline C & {3} & {5} & {8} & {5} \\ \hline D & {4} & {1} & {5} & {2} \\ \hline E & {5} & {2} & {7} & {4} \\ \hline \end{array} \right.$ 

However, the results of the Olympiad could also look like this: $\left. \begin{array}{|c|c|c|c|c|} \hline \text{Participant} & {\text{Round 1}} & {\text{Round 2}} & {\text{Total score}} & {\text{Place}} \\ \hline A & {1} & {3} & {4} & {3} \\ \hline B & {2} & {2} & {4} & {3} \\ \hline C & {3} & {1} & {4} & {3} \\ \hline D & {4} & {4} & {8} & {4} \\ \hline E & {5} & {5} & {10} & {5} \\ \hline \end{array} \right.$ 

In the first case Nikolay would have taken first place, and in the second — third place.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Greedy algorithms

Implementation

Constructive algorithms


Solutions:
t = int(input())
for i in range(t):
	(n, x, y) = list(map(int, input().split()))
	a = min(x + y - 1, n)
	if x + y < n + 1:
		b = 1
	else:
		b = min(x + y + 1 - n, n)
	print(b, a)


from sys import exit

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

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

def liis():
	return list(map(int, input().split()))
t = ii()
for _ in range(t):
	(n, x, y) = iis()
	if x > y:
		(x, y) = (y, x)
	qmini = x + y + 1
	qmaxi = x + y - 1
	pos = n - y
	(mini, maxi) = (1, n)
	acima = 0
	if x + y < n:
		mini = 1
	else:
		mini = min(n, x + y + 1 - n)
	if x + y > n:
		maxi = n
	else:
		maxi = x + y - 1
	print(mini, maxi)


for t in range(int(input())):
	(n, x, y) = map(int, input().split())
	worst = min(n, x + y - 1)
	best = max(1, min(x + y + 1 - n, n))
	print(best, worst)


T = int(input())
for _ in range(T):
	(n, x, y) = list(map(int, input().split()))
	if x > y:
		(x, y) = (y, x)
	ans1 = 1 if x + y <= n else x + y - n + 1
	if ans1 > n:
		ans1 -= 1
	ans2 = n if x + y > n else x + y - 1
	print(ans1, ans2)


def f():
	(n, x, y) = [int(s) for s in input().split()]
	bar = x + y
	if bar >= n + 1:
		bad = n
	else:
		bad = bar - 1
	if bar <= n:
		good = 1
	elif bar == 2 * n:
		good = n
	else:
		good = bar + 1 - n
	print('{} {}'.format(good, bad))
T = int(input())
for t in range(T):
	f()


(t,) = map(int, input().split())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	(a, b) = sorted([a, b])
	if a == n:
		print(n, n)
	elif b == 1:
		print(1, 1)
	else:
		print(max(a + b - n + 1, 1), min(a - 1, n - b) + min(b - 1, n - a) + 1 + (a - 1 - (n - b) if n - b < a - 1 else 0))


t = int(input())
for i in range(t):
	(n, x, y) = list(map(int, input().split()))
	if x == n and y == n:
		print(n, n)
		continue
	if x > y:
		(x, y) = (y, x)
	b = 0
	w = 0
	mx = n
	if y == n:
		mx -= 1
	if mx >= x + y + 1:
		b = 1
	else:
		b = x + y + 1 - mx
		if b > x:
			b -= 1
	w = min(x + y - 1, n)
	print(b, w)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	(n, x, y) = map(int, stdin.readline().split())
	if x > y:
		(x, y) = (y, x)
	a = max(0, x - 1 - max(0, n - y - 1) + (1 if x != y and n - y == 0 else 0)) + 1
	b = n - max(0, n - y - (x - 1))
	stdout.write('{} {}\n'.format(a, b))


t = int(input())
for _ in range(t):
	(n, x, y) = list(map(int, input().split()))
	points = x + y
	best = max(1, min(points - n + 1, n))
	worst = min(n, x + y - 1)
	print('{} {}'.format(best, worst))


t = int(input())
for __ in range(t):
	(n, x, y) = map(int, input().split())
	best_rank = min(max(x + y - n + 1, 1), n)
	worst_rank = min(x + y - 1, n)
	print(best_rank, worst_rank)


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(N, x, y):
	if N == 1:
		return (1, 1)
	score = x + y
	best_rank = min(max(score + 1 - N, 1), N)
	worst_rank = min(N, score - 1)
	return (best_rank, worst_rank)
TC = int(input())
for tc in range(TC):
	(N, x, y) = map(int, input().split())
	res = solve(N, x, y)
	print('%d %d' % res)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	x_y = x + y
	a = 1 - x_y % 2
	print(max(1, min(n - (n * 2 - (x_y + 1)), n)), min((x_y - 1 - x_y // 2) * 2 + a, n))


import os
import heapq
import sys
import math
import operator
from collections import defaultdict, deque
from bisect import bisect_right, bisect_left
from io import BytesIO, IOBase
from copy import copy

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

def inpt():
	return [int(k) for k in input().split()]

def main():
	for i in range(int(input())):
		(n, x, y) = inpt()
		print(max(1, min(n, x + y - n + 1)), min(n, x + y - 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 ii():
	return int(input())

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

def mi():
	return map(int, input().split())
for _ in range(ii()):
	(n, x, y) = mi()
	score = x + y
	best = min(max(score - n, 0) + 1, n)
	worst = min(score - 1, n)
	print(best, worst)


for _ in range(int(input())):
	(n, a, b) = [int(s) for s in input().split()]
	print(min(max(1, a + b - n + 1), n), min(a + b - 1, n))


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	worstOverall = min(n, x + y - 1)
	lowerBound = 0
	upperBound = n - 1
	mid = (lowerBound + upperBound) // 2
	while lowerBound != upperBound:
		currSum = n * (n + 1) - x - y
		currSum -= mid * (mid + 1)
		if x <= mid:
			currSum -= mid + 1
			currSum += x
		if y <= mid:
			currSum -= mid + 1
			currSum += y
		currLeft = n - 1 - mid
		if currSum / currLeft >= x + y + 1:
			upperBound = mid
		else:
			lowerBound = mid + 1
		mid = (lowerBound + upperBound) // 2
	bestOverall = lowerBound + 1
	print(bestOverall, worstOverall)


for t in range(int(input())):
	(n, x, y) = [int(j) for j in input().split()]
	mx = min(x + y - 1, n)
	mn = min((max(x + y - n + 1, 1), n))
	print(mn, mx)


t = int(input())
inputs = [input() for i in range(t)]

def solve(line):
	(n, x, y) = map(int, line.split())
	mx = max(min(n, x + y - 1), 1)
	mn = min(max(1, n - (n - x + (n - y) - 1)), n)
	print(str(mn) + ' ' + str(mx))
[solve(line) for line in inputs]


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	maxidx = min(x + y - 1, n) if x != 1 else min(x + y - 2, n)
	minidx = max(x + y - n, 0) if x != n else min(x + y - n + 1, n)
	if maxidx < y:
		ansmax = maxidx + 1
	else:
		ansmax = maxidx
	if minidx < y:
		ansmin = minidx + 1
	else:
		ansmin = minidx
	print(ansmin, ansmax)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	score = x + y
	min_place = max(min(score - n + 1, n), 1)
	max_place = min(score - 1, n)
	print(min_place, max_place)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

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

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

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

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

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

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	print(factors)
	if len(factors) == 2:
		return True
	else:
		return False

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def Sieve(n):
	prime = [True for i in range(n + 1)]
	lst = []
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p = p + 1
	for i in range(2, n + 1):
		if prime[i]:
			lst.append(i)
	return lst

def minimum_integer_not_in_list(a):
	b = max(a)
	if b < 1:
		return 1
	A = set(a)
	B = set(range(1, b + 1))
	D = B - A
	if len(D) == 0:
		return b + 1
	else:
		return min(D)

def solve(x, n, m):
	mi1 = []
	while n > 0:
		if x > m:
			x = 1
		mi1.append(x)
		x = x + 1
		n = n - 1
	return mi1

def solve2(x, n, m):
	j = x
	mi1 = []
	while n > 0:
		if x == 0:
			x = j + 1
		if x > j:
			mi1.append(x)
			x = x + 1
		else:
			mi1.append(x)
			x = x - 1
		n = n - 1
	return mi1

def solution():
	for i in range(Int()):
		(n, x, y) = Mint()
		m = x + y
		ma = []
		mi = []
		if m <= n:
			ma.append(1)
			mi.append(m - 1)
		elif m == 2 * n:
			ma.append(n)
			mi.append(n)
		else:
			ma.append(m - n + 1)
			mi.append(n)
		print(*ma, *mi)
solution()


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	best_place = max(1, min(n, x + y - n + 1))
	worst_place = min(n, x + y - 1)
	print(best_place, worst_place)


t = int(input())
for _ in range(t):
	(n, x, y) = list(map(int, input().split()))
	score = x + y
	bestPlace = min(max(score - n, 0) + 1, n)
	worstPlace = min(score - 1, n)
	print(f'{bestPlace} {worstPlace}')


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

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

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

def lmp():
	return list(mp())

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

def smp():
	return map(str, inp().split())

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

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

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(n, x, y) = mp()
	k = x + y
	if k <= n:
		print(1, k - 1)
	else:
		k -= n
		print(min(k + 1, n), n)


n = int(input())
for i in range(n):
	li = list(map(int, input().split()))
	t = li[0]
	x = li[1]
	y = li[2]
	minplace = max(1, min(x + y - t + 1, t))
	maxplace = min(x + y - 1, t)
	print(minplace, end=' ')
	print(maxplace)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	t = max(1, min(n, x + y - n + 1))
	u = min(n, x + y - 1)
	print(t, u)


from sys import stdin
T = int(stdin.readline().strip())
for caso in range(T):
	(n, b, c) = map(int, stdin.readline().strip().split())
	x = max(1, b + c + 1 - n)
	print(min(x, n), min(b + c - 1, n))


t = int(input())
for i2 in range(t):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	ans2 = y - x + min(x - 1, n - y) + x - 1 + 1
	if y < n:
		y += 1
	elif x == y == n:
		print(x, y)
		continue
	else:
		x += 1
	ans1 = n - (y - x + min(x - 1, n - y) + n - y)
	print(ans1, ans2)


def solve():
	(n, x, y) = map(int, input().split())
	score = x + y
	(l, r) = (1, n)
	maxi = None
	while l <= r:
		m = (l + r) // 2
		if m >= score:
			r = m - 1
		else:
			l = m + 1
			maxi = m
	if x > maxi and y > maxi:
		maxi += 1
	(l, r) = (1, n)
	mini = n
	while l <= r:
		m = (l + r) // 2
		if score + 1 - m > n:
			l = m + 1
		else:
			r = m - 1
			mini = m
	if x < mini and y < mini:
		mini -= 1
	print(mini, maxi)
for _ in range(int(input())):
	solve()


def main():
	t = int(input())
	for _ in range(t):
		(n, x, y) = map(int, input().split())
		(a, b) = (1, n)
		if x + y < n + 1:
			b = x + y - 1
		else:
			a = min(n, x + y + 1 - n)
		print(a, b)
main()


t = int(input())
for _ in range(t):
	(n, x, y) = [int(item) for item in input().split()]
	total = x + y
	maximum = min(x + y - 1, n)
	minimum = min(n - min(2 * n - total, n) + 1, n)
	print(minimum, maximum)


t = int(input())
res = []
for i in range(t):
	(n, x, y) = input().split()
	n = int(n)
	x = int(x)
	y = int(y)
	if x + y <= n:
		minimum = 1
	else:
		minimum = x + y - n + 1
	if x + y <= n + 1:
		maximum = x + y - 1
	else:
		maximum = n
	if minimum > maximum:
		minimum = maximum
	res.append([minimum, maximum])
for i in range(t):
	print(res[i][0], end=' ')
	print(res[i][1])


def sol():
	T = int(input())
	for i in range(T):
		(n, x, y) = map(int, input().split(' '))
		if x > y:
			(x, y) = (y, x)
		min_diff = min(n - (x + 1), y - 1)
		min_diff = max(0, min_diff)
		min_rank = y - min_diff
		max_diff = min(n - x, y - 1)
		max_diff = max(0, max_diff)
		max_rank = x + max_diff
		print(min_rank, max_rank)
sol()


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


t = int(input())
for i in range(t):
	ans1 = 0
	ans2 = 0
	(n, x, y) = map(int, input().split())
	ans2 = min(n, x + y - 1)
	x = n - x + 1
	y = n - y + 1
	ans1 = min(n, x + y - 2)
	ans1 = min(n, n - ans1 + 1)
	print(ans1, ans2)


t = int(input())
arr_1 = []
arr_2 = []
for x in range(t):
	(n, x, y) = list(map(int, input().split(' ')))
	arr_1.append(max(1, min(n, x + y - n + 1)))
	arr_2.append(min(n, x + y - 1))
for x in range(t):
	print(arr_1[x], arr_2[x])


t = int(input())
while t:
	(n, x, y) = map(int, input().split())
	mini = min(x, y)
	maxi = max(x, y)
	diff = maxi - mini
	ans = 1
	if maxi + mini > n:
		ans += maxi + mini - n
	print(min(ans, n), end=' ')
	x -= 1
	y -= 1
	ans = 1
	if n <= x + y:
		print(n)
	else:
		print(min(x + y + 1, n))
	t -= 1


size = int(input())
for i in range(size):
	(n, x, y) = map(int, input().split())
	(x, y) = (min(x, y), max(x, y))
	c2 = 0
	if x - 1 > n - y:
		c2 += n
	else:
		c2 += x - 1 + y
	c1 = 0
	if x == n and y == n:
		c1 = n
	elif x - 1 > n - y - 1:
		c1 += n - (n - y - 1 + n - x - 1 + 1)
	else:
		c1 = 1
	print(c1, c2)


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('B.txt').readlines())

	def input():
		return next(f)
else:
	input = lambda : sys.stdin.readline().strip()
fprint = lambda *args: print(*args, flush=True)
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	r1 = n - y - 1
	r2 = n - x - 1
	u = min(n, max(1, n - r1 - r2 - 1))
	v = min(n, x + y - 1)
	print(u, v)


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10 ** 9 + 7
inf = float('inf')

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

def LI():
	return list(map(int, sys.stdin.readline().split()))
t = I()
for _ in range(t):
	(n, x, y) = LI()
	worse = min(n, x + y - 1)
	good = max(1, min(x + y - n + 1, n))
	print(good, worse)


t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	if n == 1:
		print(1, 1)
	else:
		if x + y < n + 1:
			max_m = 1
		else:
			max_m = x + y - n + 1
			if max_m > n:
				max_m = n
		if x + y < n + 1:
			min_m = x + y - 1
		else:
			min_m = n
		print(max_m, min_m)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput

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)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	(n, x, y) = mi()
	if x + y == 2:
		print(1, 1)
	else:
		print(max(1, min(n, x + y + 1 - n)), min(n, x + y - 1))


for _T_ in range(int(input())):
	(n, a, b) = map(int, input().split(' '))
	print(max(1, min(1 + b + a - n, n)), min(n, b + a - 1))


from math import inf
t = int(input())
for q in range(t):
	(n, x, y) = [int(i) for i in input().split()]
	s = x + y
	r = min(s - 1, n)
	l = 2 * n - s - 1
	l = max(l, 0)
	l = n - min(l, n - 1)
	print(l, r)


T = int(input())
for _ in range(0, T):
	(n, x, y) = map(int, input().split())
	ans1 = n - x + max(0, min(x - 1, n - y - 1))
	if y == n and x < n:
		ans1 -= 1
	ans2 = x - 1 + max(0, min(n - x, y - 1))
	print(n - ans1, ans2 + 1)


import sys, os, io
for _ in range(int(input())):
	(n, x, y) = [int(i) for i in input().split()]
	u1 = x - 1
	u2 = y - 1
	d1 = n - x
	d2 = n - y
	worst = min(u1, d2) + min(u2, d1) + 1
	worst += max(u1 - d2, 0)
	rem = min(u1, d2 - 1) + min(u2, d1 - 1)
	r1 = u1 - min(u1, d2 - 1)
	r2 = u2 - min(u2, d1 - 1)
	best = r1 + r2 - min(r1, r2) + 1
	print(min(best, n), worst)


t = int(input())
for case_num in range(t):
	(n, x, y) = map(int, input().split(' '))
	best = 1
	if x + y > n:
		best = min(x + y - n + 1, n)
	worst = min(x + y - 1, n)
	print(best, worst)


T = int(input())
for _ in range(T):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	z = x + y + 1
	(a, b) = (1, z - 1)
	if b > n:
		d = b - n
		(a, b) = (a + d, b - d)
	ans1 = b - a + 1
	(_x, _y) = (z - x, z - y)
	if a <= x <= b and a <= y <= b:
		if _x + _y >= z:
			ans1 -= 1
		else:
			ans1 -= 2
	elif a <= x <= b or a <= y <= b:
		ans1 -= 1
	if b < n:
		ans1 += n - b
	ans1 = n - ans1
	z = x + y
	(a, b) = (1, z - 1)
	if b > n:
		d = b - n
		(a, b) = (a + d, b - d)
	ans2 = b
	print(ans1, ans2)


def gett(x):
	if x > 0:
		return x
	return 0
t = int(input())
while t:
	t -= 1
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	print(max(1, min(n, x + y - n + 1)), end=' ')
	print(min(n, x + y - 1))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, x, y) = map(int, sys.stdin.readline().split())
	s = x + y
	if x == y == n:
		print(n, n)
	else:
		if s > n:
			start = s - n + 1
			low = start
		else:
			low = 1
		high = min(x - 1 + y - 1, n - 1)
		print(low, high + 1)


for i in range(int(input())):
	(n, r1, r2) = [int(s) for s in input().split()]
	su = r1 + r2
	ans2 = min(n, su - 1)
	if su <= n:
		ans1 = 1
	else:
		ans1 = min(n, su - n + 1)
	print(ans1, ans2)


t = int(input())
for _ in range(0, t):
	(n, x, y) = list(map(int, input().split()))
	a = max(1, min(n, x + y - n + 1))
	b = min(n, x + y - 1)
	print(a, b)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if (x, y) in [(n, n), (n, n - 1), (n - 1, n)]:
		ans0 = n
	else:
		ans0 = max(1, n - (n - (x + y + 1 - n)))
	ans1 = min(n, x + y - 1)
	print(ans0, ans1)


import sys, math, itertools, collections, bisect
input = lambda : sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10 ** 9 + 7
mans = inf
ans = 0
count = 0
pro = 1

def solve():
	(n, x, y) = map(int, input().split())
	mina = 0
	if x + y <= n:
		mina = n - 1
	else:
		mina += max(0, n - x - 1)
		mina += max(0, min(n - y, x - 1) - int(x == n))
	print(n - mina, end=' ')
	maxa = 0
	maxa += x - 1
	maxa += min(n - x, y - 1)
	print(maxa + 1)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	(n, x, y) = [int(i) for i in input().split()]
	best_place = x + y - n + 1
	if best_place <= 0:
		best_place = 1
	if best_place > n:
		best_place = n
	worst_place = x + y - 1
	if worst_place > n:
		worst_place = n
	print(best_place, worst_place)


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')
for j in range(int(input())):
	(n, x, y) = map(int, input().split())
	score = x + y
	min1 = 0
	max1 = 0
	if score == n + 1:
		if n != 1:
			print(2, n)
		else:
			print(1, 1)
	elif score < n + 1:
		p2 = score
		if score - x > 0 and score - x <= n:
			p2 -= 1
		if score - y > 0 and score - y <= n and (score - y != x):
			p2 -= 1
		print(1, p2)
	else:
		print(min(n, x + y - n + 1), n)


import sys
import os
from io import BytesIO, IOBase

def cel(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)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
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')
from collections import defaultdict
for _ in range(ii()):
	(n, x, y) = mi()
	w = min(n, x + y - 1)
	if x + y <= n:
		g = 1
	else:
		g = min(n, x + y + 1 - n)
	print(g, w)


c = int(input())
for i in range(0, c):
	(n, x, y) = map(int, input().split())
	mx = n
	mn = 1
	if mx == x:
		mx -= 1
	if mn == x:
		mn += 1
	t1 = 0
	t2 = 0
	z = x + y
	if mx < z:
		if z - mx > n:
			t1 = 0
		else:
			t1 = n - (z - mx)
			tmp = z - mx + 1
			if y >= tmp and y <= n:
				t1 -= 1
	else:
		t1 = n - 1
	if mn >= z:
		t2 = 0
	else:
		tmp = z - mn
		if tmp > n:
			tmp = n
		if y >= 1 and y <= tmp:
			t2 = tmp - 1
		else:
			t2 = tmp
	print(str(n - t1) + ' ' + str(t2 + 1))


t = int(input())
while t:
	t -= 1
	(n, x, y) = map(int, input().split())
	(x, y) = (max(x, y), min(x, y))
	_min = min(n, max(x + y - n + 1, 1))
	_max = min(x + y - 1, n)
	print(_min, _max)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	maxi = min(x + y - 1, n)
	m = min(x + y - n + 1, n)
	mini = max(m, 1)
	print(mini, maxi)


t = int(input())
for s in range(t):
	(n, a, b) = map(int, input().split())
	total = a + b
	if total > n:
		lowest = n
	else:
		lowest = total - 1
	if total - n <= 0:
		highest = 1
	else:
		highest = total + 1 - n
		if highest > n:
			highest = n
	print(highest, end=' ')
	print(lowest)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	mina = min(n, n - min(n - 1, 2 * n - 1 - x - y))
	maxa = min(n, x + y - 1)
	print(mina, maxa)


t = int(input())
for i in range(t):
	(n, x, y) = list(map(int, input().split()))
	if x + y < n + 1:
		minimum = 1
	elif n + 1 <= x + y:
		minimum = min(x + y - n + 1, n)
	print(minimum, min(x + y - 1, n))


import math
from collections import defaultdict, Counter
from itertools import permutations
from decimal import Decimal, localcontext
from collections import defaultdict
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))

def main():
	for _ in range(ii()):
		(n, x, y) = li()
		ma = max(min(x + y - 1, n), 0)
		mi = min(max(1, x + y - n + 1), n)
		print(mi, ma)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = [1]
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def fact(n):
	return 1 if n == 1 or n == 0 else n * fact(n - 1)

def prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
import os, 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')
main()

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x == n and y == n:
		print(n, n)
		continue
	elif x == 1 and y == 1:
		print(1, 1)
		continue
	if x > y:
		(x, y) = (y, x)
	Max = min(n - y, x - 1) + min(n - x, y - 1) + 1
	if n - x < y - 1 and n - y < x - 1:
		Max = n + 0
	Min = min(n - y - 1, x - 1) + min(n - x - 1, y - 1) + 1
	if n - y - 1 > x - 1 and n - x - 1 > y - 1:
		Min = n - 1
	print(n - Min, Max)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x + y <= n:
		best = 1
		worst = x + y - 1
	if x + y > n:
		worst = n
		best = n - ((y != n) * (n - y - 1) + (x != n) * (n - x - 1) + (x != n) * (y != n))
	print(best, worst)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

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

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

def check(l):
	d = 0
	for i in range(3):
		if l[i] >= 1:
			d += 1
	if d >= 1:
		return 1
	else:
		return 0

def main():
	try:
		(n, x, y) = In()
		print(max(1, min(n, x + y - n + 1)), min(n, x + y - 1))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


def examA():
	T = I()
	ans = []
	for _ in range(T):
		A = LI()
		A.sort()
		if A[1] == 0:
			if A[2] == 0:
				cur = 0
			else:
				cur = 1
		elif A[0] == 0:
			if A[1] == 1:
				cur = 2
			else:
				cur = 3
		else:
			cur = 3
			if A[0] == 3:
				cur += 3
			elif A[0] > 3:
				cur += 4
			elif A[0] == 1:
				if A[1] >= 2:
					cur += 1
			elif A[2] == 2:
				cur += 1
			else:
				cur += 2
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examB():
	T = I()
	ans = []
	for _ in range(T):
		(n, x, y) = LI()
		if x > y:
			(x, y) = (y, x)
		high = max(1, min(n - (n - x - 1) - (n - y), n))
		low = min(n, x - 1 + (y - 1) + 1)
		ans.append([high, low])
	for (v1, v2) in ans:
		print(v1, v2)
	return

def examC():
	N = I()
	A = LI()
	ans = 0
	keep = []
	for i in range(N):
		cur = [0] * N
		top = A[i]
		cur[i] = top
		for l in range(i)[::-1]:
			now = min(A[l], top)
			cur[l] = now
			top = now
		top = A[i]
		for r in range(i + 1, N):
			now = min(A[r], top)
			cur[r] = now
			top = now
		S = sum(cur)
		if S > ans:
			keep = cur
			ans = S
	print(' '.join(map(str, keep)))
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

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

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

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
examB()


def go():
	(n, x, y) = map(int, input().split())
	b = x + y + 1
	gd = x - 1 - min(x - 1, max(0, n - y - 1))
	dg = y - 1 - min(y - 1, max(0, n - x - 1))
	resn = max(1, max(gd, dg) + 1)
	resx = min(n, x + y - 1)
	return (resn, resx)
t = int(input())
for _ in range(t):
	print(*go())


def solve():
	(n, a, b) = map(int, input().split())
	worst = a + b - 1
	if a + b >= n + 1:
		worst = n
	best = min(n, a + b - n + 1)
	if a + b <= n:
		best = 1
	print(best, worst)
t = int(input())
for _ in range(t):
	solve()


time = int(input())
for _ in range(time):
	(n, x, y) = map(int, input().split())
	print(max(1, min(n, x + y - n + 1)), min(n, x + y - 1))


casos = int(input())
respuestas = []
for i in range(casos):
	lista = list(str(input()).split())
	for j in range(len(lista)):
		lista[j] = int(lista[j])
	desfavorable = lista[1] + (lista[2] - 1)
	ronda1 = lista[1]
	ronda2 = lista[2]
	puntaje = ronda1 + ronda2
	participantes = lista[0]
	favorable = puntaje - participantes + 1
	if favorable <= 0:
		favorable = 1
	elif favorable >= participantes:
		favorable = participantes
	if desfavorable >= participantes:
		desfavorable = participantes
	if participantes == 1:
		resultado = str(str(1) + ' ' + str(1))
		respuestas.append(resultado)
	else:
		resultado = str(str(favorable) + ' ' + str(desfavorable))
		respuestas.append(resultado)
for j in respuestas:
	print(j)


t = int(input())
for j in range(t):
	(n, x, y) = [int(i) for i in input().split()]
	Sum = x + y
	if Sum <= n:
		first = 1
		last = Sum - 1
	else:
		first = Sum - n + 1
		if Sum == 2 * n:
			first = n
		last = n
	print(first, last)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	good = bad = 0
	if x + y <= n:
		good = n - 1
	else:
		if x < n and y < n:
			good += 1
		tmp = min(x + y, n + n - x - y)
		ttt = 1 if y < n else 0
		ttt += 1 if x < n else 0
		good += max(0, tmp - ttt)
	if x + y - 1 > n:
		bad = n - 1
	else:
		tmp = min(x + y - 1, n + n - x - y + 1)
		bad = max(0, tmp - 1)
	print(n - good, bad + 1)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	ans1 = y - min(y - 1, max(0, n - x - 1))
	if x + y <= n + 1:
		ans2 = x + y - 1
	else:
		ans2 = n
	print(ans1, ans2)


import sys, os, io

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

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, x, y) = ria()
		bestoverall = max(1, min(n, x + y - n + 1))
		worstoverall = min(n, x + y - 1)
		print(bestoverall, worstoverall)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

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

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

def main():
	(n, x, y) = map(int, input().split())
	if n == 1:
		print(1, 1)
	else:
		(ans1, ans2) = (None, None)
		s = x + y
		if s >= n + 1:
			ans2 = n
		else:
			ans2 = s - 1
		if s < n + 1:
			ans1 = 1
		else:
			ans1 = s - (n - 1)
		print(min(ans1, n), min(n, ans2))
t = int(input())
for i in range(t):
	main()


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	s = x + y
	if x + y <= n:
		ma = s - 1
	else:
		ma = n
	if x + y <= n:
		mi = 1
	elif s == 2 * n:
		mi = n
	else:
		mi = s - n + 1
	print(mi, ma)


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

def solve():
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	x1 = min(x - 1, max(0, n - y - 1))
	y1 = min(y - 1, max(0, n - x - 1))
	x_left = x - 1 - x1
	y_left = y - 1 - y1
	mi = 1 + max(x_left, y_left)
	x1 = min(x - 1, n - y)
	x2 = x - 1 - x1
	y1 = min(y - 1, n - x)
	y2 = y - 1 - y1
	ma = x1 + y1 + min(x2, y2) + 1
	print(mi, ma)
t = int(input())
for i in range(t):
	solve()


def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		(N, x, y) = list(map(int, input().split()))
		worst = min(x + y - 1, N)
		if x + y + 1 - N <= 1:
			best = 1
		else:
			best = min(x + y + 1 - N, N)
		print(best, worst)

def __starting_point():
	main()
__starting_point()


from copy import copy
from math import *

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

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

def int_inp():
	return int(input())

def float_inp():
	return float(input())

def comp(a):
	return a[0]

def gcd(a, b):
	if b != 0:
		return gcd(b, a % b)
	else:
		return a
for _ in range(int_inp()):
	(n, x, y) = arr_int_inp()
	worst = min(x + y - 1, n)
	best = min(max(x + y - n + 1, 1), n)
	print(best, worst, sep=' ')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(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)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
for _ in range(ii()):
	(n, a, b) = mi()
	s = a + b
	print(max(1, min(n, s - n + 1)), min(n, s - 1))


for _ in range(int(input())):
	(n, x, y) = [int(i) for i in input().split()]
	print(max(1, min(n, x + y - n + 1)), min(n, x + y - 1))


import sys
input = sys.stdin.readline

def solve():
	(n, x, y) = map(int, input().split())
	worst = min(n, max(1, x - 1 + y))
	best = min(n, max(1, x + y - n + 1))
	print(best, worst)

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


T = int(input())
for kse in range(T):
	(n, x, y) = map(int, input().split())
	R = x + y - 1
	R = min(n, R)
	L = x + y - n + 1
	L = max(1, L)
	L = min(L, n)
	print(L, R)


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	sc = a + b
	if n >= sc - 1:
		ma = sc - 1
	else:
		ma = n
	if n >= sc:
		mi = 1
	else:
		mi = min(sc + 1 - n, n)
	print(mi, ma)


t = int(input())
for i in range(t):
	b = list(map(int, input().split()))
	n = b[0]
	k = sum(b[1:3])
	if k >= n + 1:
		p = n
		q = k - n + 1
		if q > n:
			q = n
	else:
		p = k - 1
		q = 1
	print(q, p)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		(n, l, r) = read()
		if l >= r:
			(l, r) = (r, l)
		left = l - 1
		right = n - r
		x = min(left, right)
		maximum = r - l + 1 + x * 2 + (left - x)
		minimum = 0
		x = r + l + 1 - n
		if x <= 1:
			minimum = 1
		else:
			minimum = min(x, n)
		print(minimum, maximum)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


import sys

def solve(N, X, Y):
	S = X + Y
	lo = min(max(1, S - N + 1), N)
	hi = min(N, S - 1)
	return str(lo) + ' ' + str(hi)
input = sys.stdin.readline
T = int(input())
for t in range(T):
	(N, X, Y) = map(int, input().split())
	ans = solve(N, X, Y)
	print(ans)


import os
import sys
from io import BytesIO, IOBase

def iin():
	return int(input())

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

def main():
	T = iin()
	while T:
		T -= 1
		(n, x, y) = lin()
		(x1, x2) = (x - 1, n - x)
		(y1, y2) = (y - 1, n - y)
		(mn, mx) = (0, 0)
		x3 = min(y2, x1)
		y3 = min(y1, x2)
		mx = x3 + y3 + min(x1 - x3, y1 - y3) + 1
		y3 = min(max(y2 - 1, 0), x1)
		x3 = min(max(x2 - 1, 0), y1)
		mn = n - (y3 + x3 + min(y2 - y3, x2 - x3))
		print(mn, mx)
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()


import sys
t = int(sys.stdin.readline().strip())
for i in range(t):
	(n, x, y) = map(int, sys.stdin.readline().strip().split())
	score = x + y
	sys.stdout.write(str(1 + max(min(score - n, n - 1), 0)) + ' ')
	sys.stdout.write(str(min(score - 1, n)) + '\n')


test = int(input())
for i in range(test):
	l = list(map(int, input().split()))
	(n, x, y) = (l[0], l[1], l[2])
	part1 = min(n - x, y - 1)
	part2 = min(n - y, x - 1)
	w = part1 + part2 + min(y - 1 - part1, x - 1 - part2)
	worst = w + 1
	part1 = min(y - 1, n - x - 1)
	part2 = min(x - 1, n - y - 1)
	part1 = max(part1, 0)
	part2 = max(part2, 0)
	best = n - (part1 + part2 + min(n - x - part1, n - y - part2))
	print(best, worst)


def solve():
	(n, a, b) = map(int, input().split())
	best = min(max(a + b + 1 - n, 1), n)
	worst = max(min(a + b - 1, n), 1)
	print(best, worst)
t = int(input())
for i in range(t):
	solve()


for i in range(int(input())):
	(n, a, b) = map(int, input().split())
	mi = max(1, a + b - n + 1)
	if mi > n:
		mi = n
	ma = min(n, a + b - 1)
	print(mi, ma)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	minx = min(n, max(1, x + y + 1 - n))
	mn = minx
	mx = min(n, x + y - 1)
	print(mn, mx)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	res = max(1, min(n, x + y - n + 1))
	ans = min(n, x + y - 1)
	print(res, ans)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	if n == 1:
		print(1, 1)
		continue
	a = n if x != n else n - 1
	ans1 = 1 + max(0, min(x + y - a, n - 1))
	ans2 = 1
	if y != 1:
		b = 1
		a = min(n, x + y - b)
		while a > 0 and b <= n:
			if a == x:
				a -= 1
				continue
			if b == y:
				b += 1
				if a + b > x + y:
					a -= 1
				continue
			cnt = min(a - x if a > x else a, y - b if y > b else n + 1 - b)
			ans2 += cnt
			a -= cnt
			b += cnt
	print(ans1, ans2)


t = int(input())
for tt in range(t):
	(n, x, y) = map(int, input().split())
	mi = min(max(1, x + y - n + 1), n)
	k = n - (0 if x + y > n else n - x - y + 1)
	print(mi, k)


def findMax(n, x, y):
	p1 = min(x - 1, n - y)
	p2 = min(y - 1, n - x)
	part = min(x - p1, y - p2)
	return p1 + p2 + part

def findMin(n, x, y):
	p1 = min(y - 1, n - x - 1)
	p2 = min(x - 1, n - y - 1)
	p1 = max(0, p1)
	p2 = max(0, p2)
	part = min(n - x - p1, n - y - p2)
	return n - p1 - p2 - part

def main():
	t = int(input())
	while t:
		(n, x, y) = list(map(int, input().split()))
		(mn, mx) = (findMin(n, x, y), findMax(n, x, y))
		print(mn, mx)
		t -= 1
main()


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split(' '))
	if x + y > n:
		print(min(x + y - n + 1, n), n)
	else:
		m = n - x - y
		m += 1
		print(1, n - m)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(n, x, y) = inputnums()
	if x + y <= n:
		print(1, end=' ')
		print(x + y - 1)
	else:
		print(min(x + y - n + 1, n), end=' ')
		print(n)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	score = x + y
	if x > y:
		(x, y) = (y, x)
	worst = min(score - 1, n)
	best = max(1, min(n, score + 1 - n))
	print(best, worst)


hm = int(input())
while hm:
	hm -= 1
	(n, x, y) = map(int, input().split())
	(x, y) = (max(x, y), min(x, y))
	minn = min(n, max(x + y - n + 1, 1))
	maxx = min(x + y - 1, n)
	print(minn, maxx)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(n, x, y) = [int(x) for x in input().split()]
	lower = max(1, x + y + 1 - n)
	lower = min(lower, n)
	upper = n
	worseCnts = upper - lower + 1 - 1
	worseScore = n - worseCnts
	lower = 1
	upper = min(n, x + y - 1)
	bestCnts = upper - lower + 1
	print('{} {}'.format(worseScore, bestCnts))


q = int(input())
for i in range(q):
	(n, x, y) = map(int, input().split())
	s = x + y
	bad = 0
	if s - 1 > n:
		mx = n
	else:
		mx = s - 1
	if x < n and y < n:
		bad = 1
	a = n - x - 1
	if a > 0:
		bad = bad + a
	a = n - y - 1
	if a > 0:
		bad = bad + a
	if bad > n - 1:
		bad = n - 1
	print(n - bad, mx)


t = int(input())
for _ in range(t):
	(n, a, b) = map(int, input().split())
	print(min(max(a + b - n + 1, 1), n), min(a + b - 1, n))


tests = int(input())
for te in range(tests):
	(n, x, y) = list(map(int, input().split()))
	maxa = -1
	mina = 10 ** 10
	maxa = max(maxa, x + y - 1)
	maxa = min(maxa, n)
	mina = min(mina, n)
	if n > x + y - 1:
		mina = min(mina, 1)
	else:
		mina = min(mina, x + y - n + 1)
	print(mina, end=' ')
	print(maxa)


t = int(input())
for _ in range(t):
	(n, x, y) = [int(x) for x in input().split()]
	print(str(max(1, min(n, x + y - n + 1))) + ' ' + str(min(n, x + y - 1)))


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	below1 = max(n - x - (y - 1), 0)
	below2 = max(n - y - (x - 1), 0)
	worst = n - max(below1, below2)
	above1 = min(max(x - 1 - (n - y - 1), 0), n - 1)
	above2 = min(max(y - 1 - (n - x - 1), 0), n - 1)
	best = max(above1, above2) + 1
	print(best, worst)


t = int(input())
for i in range(t):
	(N, X, Y) = [int(x) for x in input().split()]
	min_place = max(1, min(N, X + Y - N + 1))
	max_place = min(N, X + Y - 1)
	print(min_place, max_place)


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (n, x, y) in Query:
	s = x + y
	ans1 = min(max(s - (n - 1), 1), n)
	ans2 = min(s - 1, n)
	print(ans1, ans2)


import sys

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

def slv():
	(n, x, y) = map(int, input().split())
	(m, M) = (max(1, min(n, x + y - n + 1)), min(n, x + y - 1))
	print(m, M)
	return

def main():
	t = int(input())
	for i in range(t):
		slv()
	return
main()


def answer(testCase):
	(participants, firstCard, secondCard) = testCase
	_sum = firstCard + secondCard
	_min = participants
	_max = participants
	if firstCard == participants and secondCard == participants:
		return str(participants) + ' ' + str(participants)
	if firstCard + secondCard <= participants:
		_min = 1
	else:
		_min = firstCard + secondCard + 1 - participants
	if firstCard + secondCard >= participants + 1:
		_max = participants
	else:
		_max = firstCard + secondCard - 1
	return str(_min) + ' ' + str(_max)
testCaseCount = int(input())
testCases = []
for _ in range(0, testCaseCount):
	testCases.append(list(map(int, input().split())))
for i in range(0, testCaseCount):
	print(answer(testCases[i]))


T = int(input())
for case_ in range(T):
	(n, a, b) = map(int, input().split())
	tot = n - a + 1 + (n - b + 1)
	l = min(n, max(0, n - (tot - 2)) + 1)
	r = min(n, n - (tot - n) + 1)
	print(l, r)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	a = min(n - x, y - 1)
	b = min(n - y, x - 1)
	max_rank = y + b
	(x1, y1) = (0, 0)
	if x != n or y != n:
		if x == n:
			x1 = x
			y1 = y + 1
		else:
			x1 = x + 1
			y1 = y
		a1 = min(n - x1, y1 - 1)
		b1 = min(n - y1, x1 - 1)
		min_rank = y1 - a1
	else:
		min_rank = n
	print(min_rank, max_rank)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x + y == n + 1:
		print(min(n, 2), n)
	elif x + y > n + 1:
		if x == n and y == n:
			print(n, n)
		else:
			print(x + y + 1 - n, n)
	else:
		print(1, x + y - 1)


from sys import stdin
ints = [int(i) for i in stdin.read().split()]
t = ints[0]
for i in range(t):
	(a, b, c) = (ints[3 * i + 1], ints[3 * i + 2], ints[3 * i + 3])
	print(max(1, min(b + c - a + 1, a)), max(1, min(b + c - 1, a)))


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	min_ans = max(min(n, x + y - n + 1), 1)
	max_ans = min(x + y - 1, n)
	print(min_ans, max_ans)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	s = x + y
	mx = min(s - 1, n)
	if s <= n:
		mn = 1
	else:
		mn = min(s, s - n + 1, n)
	print(mn, mx)


p = int(input())
best = []
worst = []
for i in range(0, p):
	(n, r1, r2) = map(int, input().split())
	m = r1 + r2
	if m < n + 1:
		best.append(1)
		worst.append(m - 1)
	elif m == 2 * n:
		best.append(n)
		worst.append(n)
	else:
		best.append(m - n + 1)
		worst.append(n)
for i in range(0, p):
	print(best[i], worst[i])


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, x, y) = map(int, input().split())
	k1 = x + y - 1
	k2 = x + y
	if k1 > n:
		ans1 = n
	else:
		ans1 = k1
	if k2 >= n:
		ans2 = max(0, k2 - 1 - (k2 - n) * 2)
	else:
		ans2 = n - 1
	print(n - ans2, ans1)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	delta = n + 1 - (x + y)
	if delta > 0:
		bad = n - delta
	else:
		bad = n
	if delta > 0:
		good = 1
	else:
		good = 2 + abs(delta)
	print(min(n, good), max(1, bad))


t = int(input())
for _ in range(t):
	(n, x, y) = list(map(int, input().split()))
	a = 1
	b = n
	if x > y:
		(x, y) = (y, x)
	(l, r) = (1, n)
	while l < r:
		m = (r + l) // 2
		if n - x > y - m:
			r = m
		else:
			l = m + 1
	a = (l + r) // 2
	(l, r) = (1, n)
	while l < r:
		m = (l + r + 1) // 2
		if n - (n - x + 1) > n - y + 1 - m:
			r = m - 1
		else:
			l = m
	b = n + 1 - (l + r) // 2
	print(a, b)


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

def gift():
	for _ in range(t):
		(n, r1, r2) = [int(x) for x in input().split()]
		sum1 = r1 + r2
		if sum1 < n:
			maxres = 1
			minres = sum1 - 1
		elif sum1 == n:
			maxres = 1
			minres = n - 1
		else:
			maxres = min(sum1 - n + 1, n)
			minres = n
		if sum1 == 3:
			if n <= 2:
				yield '2 2'
			else:
				yield '1 2'
		elif sum1 == 2:
			yield '1 1'
		else:
			yield (str(maxres) + ' ' + str(minres))
t = int(input())
ans = gift()
print(*ans, sep='\n')


def abs(n):
	return -n if n < 0 else n

def best(n, x, y):
	if y == n:
		return min(x + 1, n)
	return max(1, min(x, x + y + 1 - n))

def worst(n, x, y):
	if x + y >= n + 1:
		return n
	return n - abs(x + y - n - 1)
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	(x, y) = (min(x, y), max(x, y))
	(a1, a2) = (best(n, x, y), worst(n, x, y))
	print(a1, a2)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())

	def best():
		if n == 1:
			return 1
		stops1 = [x, 0]
		stops2 = [y, n + 1]
		p1 = n
		if p1 == x:
			p1 -= 1
			del stops1[0]
		p2 = max(1, x + y + 1 - p1)
		if p2 == y:
			p2 += 1
		if p2 > y:
			del stops2[0]
		if p2 > n:
			return n
		f = 0
		while True:
			df = min(p1 - stops1[0], stops2[0] - p2)
			f += df
			p1 -= df
			p2 += df
			if p1 <= stops1[0]:
				del stops1[0]
				p1 -= 1
				p2 = max(p2, x + y + 1 - p1)
			if p2 >= stops2[0]:
				if p2 == stops2[0]:
					p2 += 1
				del stops2[0]
			if p1 < 1 or p2 > n:
				break
		return n - f

	def worst():
		if n == 1:
			return 1
		stops1 = [x, n + 1]
		stops2 = [y, 0]
		p1 = 1
		if p1 == x:
			p1 += 1
			del stops1[0]
		p2 = min(n, x + y - p1)
		if p2 == y:
			p2 -= 1
		if p2 < y:
			del stops2[0]
		if p2 < 1:
			return 1
		f = 0
		while True:
			df = min(stops1[0] - p1, p2 - stops2[0])
			f += df
			p1 += df
			p2 -= df
			if p1 >= stops1[0]:
				del stops1[0]
				p1 += 1
				p2 = min(p2, x + y - p1)
			if p2 <= stops2[0]:
				if p2 == stops2[0]:
					p2 -= 1
				del stops2[0]
			if p1 > n or p2 < 1:
				break
		return f + 1
	print(best(), worst())


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	ans2 = max(min(x + y - 1, n), 1)
	ans1 = min(max(1, x + y - n + 1), n)
	print(ans1, ans2)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	maxim = min(x + y - 1, n)
	m = min(x + y - n + 1, n)
	minim = max(m, 1)
	print(minim, maxim)


import sys

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

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

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(n, x, y) = rint()
	c = x + y
	c1 = c + 1
	fx = c + 1 - n
	if fx <= 0:
		ans1 = 1
	else:
		ans1 = min(fx, n)
	ans2 = min(n, x + y - 1)
	print(ans1, ans2)


t = int(input())

def solve(mid):
	if n + (mid + 1) > sum_:
		return True
	else:
		return False
for _ in range(t):
	(n, x, y) = list(map(int, input().split()))
	sum_ = x + y
	max_ = min(sum_ - 1, n)
	ok = 10 ** 18
	ng = 0
	if solve(0):
		print(1, max_)
		continue
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if solve(mid):
			ok = mid
		else:
			ng = mid
	print(min(ok + 1, n), max_)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

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

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

def read_float():
	return float(input())

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

def read_str():
	return input().strip()

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

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N, X, Y):
	if X + Y < N + 1:
		best = 1
	else:
		best = X + Y - N + 1
	best = min(N, best)
	worst = min(X + Y - 1, N)
	return (best, worst)

def main():
	T = read_int()
	for _ in range(T):
		(N, X, Y) = read_int_n()
		print(*slv(N, X, Y))
main()


t = int(input())

def getMin(n, x, y):
	z = x + y
	if z < n + 1:
		return 1
	elif z == n + 1:
		return 2
	else:
		return n - (2 * n - (x + y) - 1)

def getMax(n, x, y):
	z = x + y
	if z < n + 1:
		return x + y - 1
	else:
		return n
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if n == 1:
		print('1 1')
	elif x == n and y == n:
		print(str(n) + ' ' + str(n))
	else:
		print(*[getMin(n, x, y), getMax(n, x, y)])


for nt in range(int(input())):
	(n, x, y) = map(int, input().split())
	minn = max(1, min(n, x + y - (n + 1) + 2))
	if x + y >= n + 1:
		maxx = n
		print(minn, maxx)
		continue
	print(minn, min(n, x + y - 1))


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if n == x == y:
		print(n, n)
	else:
		print(1 if x + y <= n else x + y - n + 1, n if x + y > n else x + y - 1)


for case in range(int(input())):
	(n, x, y) = [int(x) for x in input().split()]
	worst = min(x + y - 1, n)
	(x, y) = [min(x, y), max(x, y)]
	below = 0
	temp = min(y - 1, n - x - 1)
	temp = max(0, temp)
	e1 = n - x - temp
	below += temp
	temp = min(x - 1, n - y - 1)
	temp = max(0, temp)
	e2 = n - y - temp
	below += temp
	below += min(e1, e2)
	best = n - below
	print(best, worst)


def main():
	for _ in range(int(input())):
		(n, x, y) = map(int, input().split())
		(good, bad) = (0, 0)
		if x + y <= n:
			good = 1
			bad = x + y - 1
		if x + y > n:
			bad = n
			good = (x + y) % n + 1
		if x + y == 2 * n:
			good = n
			bad = n
		print(good, bad)
main()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
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')
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	mx = min(n, x + y - 1)
	mn = min(1 + max(x + y - n, 0), mx)
	print(mn, mx)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if y < x:
		(x, y) = (y, x)
	mi = 0
	tot = max(n - x - 2 + 1, 0)
	tot2 = max(n - y - 2 + 1, 0)
	mi += min(tot, y - 1)
	mi += min(tot2, x - 1)
	tot -= min(tot, y - 1)
	tot2 -= min(tot2, x - 1)
	mi += min(tot, tot2)
	if x < n and y < n:
		mi += 1
	ma = 0
	tot = max(y - 1, 0)
	tot2 = max(x - 1, 0)
	ma += min(tot, n - x - 1 + 1)
	ma += min(tot2, n - y - 1 + 1)
	tot -= min(tot, n - x - 1 + 1)
	tot2 -= min(tot2, n - y - 1 + 1)
	ma += min(tot, tot2)
	print(n - mi, ma + 1)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split(' '))
	s = x + y
	max_ = min(n, s - 1)
	if s - n <= 0:
		min_ = 1
	else:
		min_ = min(1 + (s - n), n)
	print(min_, max_)


import sys
import math

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

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	(n, x, y) = read_int_line()
	if x < y:
		(x, y) = (y, x)
	worst = min(n, x + y - 1)
	best = 1
	if x + y >= n:
		best += x + y - n
		best = min(n, best)
	print(best, worst)


t = int(input())
for T in range(t):
	(n, x, y) = list(map(int, input().split()))
	best = 0
	worst = 0
	worst = min(x + y - 1, n)
	if n == x and x == y:
		best = n
	else:
		best = n - min(2 * n - (x + y + 1), n - 1)
	print(best, worst)


from sys import stdin
for case in range(int(stdin.readline())):
	(n, x, y) = [int(z) for z in stdin.readline().split()]
	if x + y < n + 1:
		best = 0
	else:
		best = x + y - n
	if x + y > n:
		worst = n
	else:
		worst = x + y - 1
	print(min(best + 1, n), worst)


t = int(input())
for i in range(t):
	(n, x, y) = input().split()
	n = int(n)
	x = int(x)
	y = int(y)
	if x + y == 2 * n:
		best = n
		worst = n
	elif x + y >= n + 1:
		best = x + y + 1 - n
		worst = n
	else:
		best = 1
		worst = x + y - 1
	print(best, worst)


for tests in range(int(input())):
	(N, x, y) = map(int, input().split())
	maxR = min(x + y - 1, N)
	if x + y < N + 1:
		diff = N - 1
	else:
		diff = 2 * N - x - y - 1
	if diff >= N - 1:
		print(1, maxR)
		continue
	print(min(N - diff, N), maxR)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, X, Y) = [int(x) for x in input().split()]
		ans1 = max(1, min(N, X + Y - N + 1))
		ans2 = min(N, X + Y - 1)
		print(ans1, ans2)
main()


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	s = m + k
	print(max(1, min(n, s - n + 1)), min(n, s - 1))


TC = int(input())

def solve(n, x, y):
	if x > y:
		(x, y) = (y, x)
	mx = max(min(x + y - 1, n), 1)
	mn = min(max(x + y - n + 1, 1), n)
	return (mn, mx)
for _ in range(TC):
	(n, x, y) = map(int, input().split())
	print(*solve(n, x, y))


def Min(x, y):
	if x < y:
		return x
	else:
		return y

def Max(x, y):
	if x > y:
		return x
	else:
		return y
t = int(input())
while t > 0:
	buffer = [int(x) for x in input().split(' ')]
	n = buffer[0]
	first = buffer[1]
	second = buffer[2]
	r1 = Min(n, first + second - n + 1)
	r1 = Max(1, r1)
	r2 = Min(n, first + second - 1)
	print('{0} {1}'.format(r1, r2))
	t -= 1


n = int(input())
for _ in range(n):
	nums = list(map(int, input().split()))
	if nums[0] == 1:
		print(1, 1)
		continue
	if nums[1] + nums[2] <= nums[0]:
		ans = 1
	else:
		ans = min(nums[0], nums[1] + nums[2] - nums[0] + 1)
	res = nums[0] if nums[1] + nums[2] > nums[0] else nums[1] + nums[2] - 1
	print(ans, res)


t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if x + y - 1 <= n:
		maxi = x + y - 1
	else:
		maxi = n
	if max(x, y) < n:
		mini = 1 + max(0, x + y - n)
	elif x == y == n:
		mini = n
	else:
		mini = min(x, y) + 1
	print(mini, maxi)


t = int(input())
for k in range(t):
	(n, x, yak) = map(int, input().split())
	print(max(1, min(n, x + yak - n + 1)), min(x + yak - 1, n))


import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter
from itertools import combinations as comb
mod = pow(10, 9) + 7
mod2 = 998244353

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

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

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

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 [[val for i in range(n)] for j in range(m)]
for _ in range(int(data())):
	(n, x, y) = sp()
	out(str(max(1, min(n, x + y - n + 1))) + ' ')
	out(str(min(n, x + y - 1)) + '\n')


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	t = int(input())
	for _ in range(t):
		(n, x, y) = map(int, input().split())
		ans1 = min(n, max(1, x + y + 1 - n))
		ans2 = max(1, min(n, x + y - 1))
		print(ans1, ans2)
main()


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from functools import *
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def Golf():
	(*a,) = map(int, open(0))

def S_():
	return input()

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

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

def I():
	return int(input())

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

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
ans = 0

def solve(n, x, y):
	ans = 0
	if x < y:
		(x, y) = (y, x)
	m = min(n, max(y - 1 - n + x + 1 + 1, 1))
	if x + y >= n + 1:
		M = n
	else:
		(l, r) = (1, n)
		while r - l > 1:
			mid = (l + r) // 2
			if True:
				r = mid
			else:
				l = mid
		M = r
		M = max(x, y, x + y - 1)
	return (m, M)
t = I()
for _ in range(t):
	(n, x, y) = LI()
	print(*solve(n, x, y))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	z = x + y
	mx = z - 1
	mn = z + 1 - n
	if mx > n:
		mx = n
	if mx < 1:
		mx = 1
	if mn > n:
		mn = n
	if mn < 1:
		mn = 1
	print(mn, mx)


from sys import stdin

def solve():
	(n, x, y) = map(int, stdin.readline().split())
	s = x + y
	t = min(max(s - n, 0), n - 1)
	g = min(s - 1, n)
	k = max(g - y, 0)
	k2 = max(g - x, 0)
	print(t + 1, k + k2 + min(x - k, y - k2))
for i in range(int(stdin.readline())):
	solve()


def different_rules(n, x, y):
	score = x + y
	max_rank = max(1, min(score - n + 1, n))
	min_rank = min(n, score - 1)
	return (max_rank, min_rank)
t = int(input())
array = []
for z in range(t):
	subarray = list(map(int, input().split()))
	array.append(subarray)
for z in range(t):
	n = array[z][0]
	x = array[z][1]
	y = array[z][2]
	results = different_rules(n, x, y)
	print(results[0], results[1])


def worst():
	u = n - y
	l = x - 1
	if u <= l:
		return n
	return n - u + l

def best():
	sc = x + y
	l = sc + 1 - n
	if l <= 1:
		return 1
	if x == y and x == n:
		return l - 1
	return l
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	print(best(), worst())


t = int(input())
for k in range(t):
	(nit, x, y) = map(int, input().split())
	print(max(1, min(nit, x + y - nit + 1)), min(x + y - 1, nit))


t = int(input())
for ti in range(t):
	(n, x, y) = input().split()
	n = int(n)
	x = int(x)
	y = int(y)
	if x + y > n:
		if x + y - n + 1 > n:
			print(n, n)
		else:
			print(x + y - n + 1, n)
	else:
		print(1, x + y - 1)


import math
import sys
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

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

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(input())):
	(n, x, y) = ilele()
	print(max(1, min(n, x + y - n + 1)), min(n, x + y - 1))


a = int(input())
for i in range(a):
	(n, x, y) = map(int, input().split())
	t = min(x, y)
	r = max(x, y)
	if n == x == y:
		print(x, y)
		continue
	if r + t <= n + 1:
		maxa = t + r - 1
	else:
		maxa = n
	score = t + r
	if r + t <= n:
		print(1, maxa)
	else:
		print(score - n + 1, maxa)


t = int(input())
for tt in range(t):
	(n, x, y) = [int(x) for x in input().split(' ')]
	print(min(max(1, x + y - n + 1), n), end=' ')
	print(max(min(n, x + y - 1), 1))


t = eval(input())
for _ in range(t):
	(n, x, y) = map(int, input().split())
	if n == x and n == y:
		print('{} {}'.format(x, y))
		continue
	(L1, R1) = (x - 1, n - x)
	(L2, R2) = (y - 1, n - y)
	bigger = 0
	if R2 == 0:
		bigger = R1 - 1
	elif R2 - 1 > L1:
		bigger = n - 1
	elif R2 - 1 <= L1:
		bigger = n - 1 - (L1 - R2 + 1)
	smaller = 0
	if R1 >= L2:
		smaller = n - 1 - (R1 - L2)
	else:
		smaller = n - 1
	print('{} {}'.format(n - bigger, smaller + 1))


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	Max = min(x + y - 1, n)
	rem = 1

	def bsearch(l, r, s, n):
		while l < r:
			m = (l + r) // 2
			if n + m > s:
				r = m
			else:
				l = m + 1
		return l
	rem = bsearch(1, 1000000000, x + y, n)
	rem = min(n, max(1, rem))
	print(rem, Max)