This is an easy version of the problem. In this version, all cards have the same color.

Alice has $n$ cards, each card is white, and the cards are stacked in a deck. Alice deals the cards to herself and to Bob, dealing at once several cards from the top of the deck in the following order: one card to herself, two cards to Bob, three cards to Bob, four cards to herself, five cards to herself, six cards to Bob, seven cards to Bob, eight cards to herself, and so on. In other words, on the $i$-th step, Alice deals $i$ top cards from the deck to one of the players; on the first step, she deals the cards to herself and then alternates the players every two steps. When there aren't enough cards at some step, Alice deals all the remaining cards to the current player, and the process stops.

First Alice's steps in a deck of many cards.

How many cards will Alice and Bob have at the end?


-----Input-----

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

The only line of each test case contains a single integer $n$ ($1 \le n \le 10^6$) — the number of cards.


-----Output-----

For each test case print two integers — the number of cards in the end for each player — in this order: cards Alice has, cards Bob has.


-----Examples-----

Input
5
10
6
17
8
1000000
Output
5 5
1 5
10 7
3 5
500202 499798


-----Note-----

None

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
import math

def ans(n):
	k = math.floor((2 * n) ** (1 / 2))
	if k * (k + 1) > 2 * n:
		k -= 1
	a = 0
	b = 0
	if k % 4 in (1, 2):
		b += n - k * (k + 1) // 2
	else:
		a += n - k * (k + 1) // 2
	if k % 4 == 0:
		a += k * (k + 1) // 4
		b += k * (k + 1) // 4
	elif k % 4 == 1:
		a += k
		k -= 1
		a += k * (k + 1) // 4
		b += k * (k + 1) // 4
	elif k % 4 == 2:
		b += k
		a += k - 1
		k -= 2
		a += k * (k + 1) // 4
		b += k * (k + 1) // 4
	else:
		b += 2 * k - 1
		a += k - 2
		k -= 3
		a += k * (k + 1) // 4
		b += k * (k + 1) // 4
	return (a, b)
n_num = int(input())
for i in range(n_num):
	n = int(input())
	print(*ans(n))


import math

def predict(n):
	x = math.floor((math.sqrt(8 * n + 1) - 1) / 2)
	p = x // 4
	q = x % 4
	alice = 0
	bob = 0
	if q == 0:
		bob = 4 * p * (p - 1) + 5 * p
		alice = n - bob
	elif q == 1 or q == 2:
		alice = (4 * p + 1) * (p + 1)
		bob = n - alice
	elif q == 3:
		bob = (4 * p + 5) * (p + 1)
		alice = n - bob
	print(alice, ' ', bob)
x = int(input())
for i in range(x):
	p = int(input())
	predict(p)


for _ in range(int(input())):
	N = int(input())
	n = int((-1 + (1 + 8 * N) ** 0.5) / 2)
	player = n >> 1 & 1 ^ n % 2
	n -= not n & 1
	(A, B) = ((n - 1 >> 2) + 1, n + 1 >> 2)
	cards = [A * (4 * A - 3), B * (5 + max((B - 1) * 4, -2))]
	cards[player] += N - int(n * (n + 1) / 2)
	print(*cards)


cards = [[0, 0]]
card = 1
while cards[card - 1][0] + cards[card - 1][1] <= 1000000:
	if card % 4 == 0 or card % 4 == 1:
		cards += [[cards[card - 1][0] + card, cards[card - 1][1]]]
	else:
		cards += [[cards[card - 1][0], cards[card - 1][1] + card]]
	card += 1
no_of_testcases = int(input())
for loop in range(no_of_testcases):
	no_of_cards = int(input())
	x = int(-1 + (1 + 8 * no_of_cards) ** 0.5) // 2
	(alice, bob) = (cards[x][0], cards[x][1])
	if alice + bob != no_of_cards:
		if x % 4 == 0 or x % 4 == 3:
			alice += no_of_cards - alice - bob
		else:
			bob += no_of_cards - alice - bob
	print(alice, bob)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	turns = (1 + math.sqrt(1 + 8 * n)) / 4
	turns = math.ceil(turns)
	a_turns = math.ceil(turns / 2)
	b_turns = math.floor(turns / 2)
	a = (1 + 1 + 8 * (a_turns - 1)) * a_turns // 2
	b = (5 + 5 + 8 * (b_turns - 1)) * b_turns // 2
	gap = (1 + 2 * (turns - 1)) * turns - n
	if turns % 2 == 0:
		b -= gap
	else:
		a -= gap
	print(int(a), int(b))


for n in [*map(int, open(0))][1:]:
	k = 1 + int((1 + 8 * n) ** 0.5) >> 2
	m = k // 2
	l = k - m
	a = [(4 * l - 3) * l, 4 * m * m + m]
	a[k % 2] += n - 2 * k * k + k
	print(*a)


import math
t = int(input())
for i in range(t):
	n = int(input())
	last = (1 + math.sqrt(1 + 8 * n)) // 4
	last = int(last)
	if last % 2 == 0:
		last_sum = 1 + (last - 1) * 4
		Sum = int(math.ceil(last / 2) / 2 * (5 + last_sum))
		print(n - Sum, Sum)
	else:
		last_sum = 1 + (last - 1) * 4
		Sum = int(math.ceil(last / 2) / 2 * (1 + last_sum))
		print(Sum, n - Sum)


import math
N = 3001
(al, bl) = ([None] * N, [None] * N)
a = b = 0
for i in range(1, N):
	if i % 4 == 0 or i % 4 == 1:
		a += i
	elif i % 4 == 2 or i % 4 == 3:
		b += i
	al[i] = a
	bl[i] = b
for t in range(int(input())):
	s = int(input())
	n = int((math.sqrt(1 + 8 * s) - 1) / 2)
	t = n * (n + 1) // 2
	(a, b) = (al[n], bl[n])
	if n % 4 == 0 or n % 4 == 3:
		a += s - t
	elif n % 4 == 1 or n % 4 == 2:
		b += s - t
	print(a, b)


import math
for _ in range(int(input())):
	z = int(input())
	x = (-1 + (1 + 8 * z) ** 0.5) / 2
	x1 = (-1 - (1 + 8 * z) ** 0.5) / 2
	n = math.floor(max(x1, x))
	bob = 8 * ((n - 1) // 4 - 1) * ((n - 1) // 4) / 2 + 5 * ((n - 1) // 4)
	nt = 'Bob'
	if (n - 1) % 4 == 1:
		bob += n
		nt = 'Bob'
	elif (n - 1) % 4 == 2:
		bob += n - 1 + n
		nt = 'Alice'
	elif (n - 1) % 4 == 3:
		bob += n + n - 3
		nt = 'Alice'
	alice = n * (n + 1) / 2 - bob
	if nt == 'Alice':
		print(int(alice + (z - n * (n + 1) / 2)), int(bob))
	else:
		print(int(alice), int(bob + (z - n * (n + 1) / 2)))


import math
for t in range(int(input())):
	a = int(input())
	n = (1 + (1 + 8 * a) ** (1 / 2)) / 8
	n = int(n)
	alice = n * (4 * n - 3)
	bob = n * (4 * n + 1)
	alice = int(alice)
	bob = int(bob)
	remaining = a - (alice + bob)
	if remaining > 8 * n + 1:
		alice += 8 * n + 1
		bob += remaining - 1 * (8 * n + 1)
	else:
		alice += remaining
	print(f'{alice} {bob}')


import math as m
k = int(input())
for i in range(k):
	n = int(input())
	T1 = m.ceil(-1 / 2 + m.sqrt(1 / 4 + 2 * n))
	T = T1 // 2
	T2 = T - 1
	T1 += T1 % 2 == 0
	if T % 2 == 0:
		print(T // 2 + 1 + 4 * (T * (T // 2 + 1) // 2) - (T1 ** 2 + T1) // 2 + n, T // 2 + 4 * ((1 + T2) * ((T2 - 1) // 2 + 1) // 2))
	else:
		print(T // 2 + 1 + 4 * (T2 * (T2 // 2 + 1) // 2), T // 2 + 1 + 4 * ((1 + T) * ((T - 1) // 2 + 1) // 2) - (T1 ** 2 + T1) // 2 + n)


import sys
sys.setrecursionlimit(10 ** 9)
for i in range(int(input())):
	N = int(input())
	n = int((-3 + (9 - 8 * (1 - N)) ** 0.5) / 4)
	if n % 2 == 1:
		k = n // 2 + 1
		b = k * (8 * k + 2) / 2
		a = N - b
	else:
		k = n // 2
		a = k * (8 * k + 10) / 2 + 1
		b = N - a
	print(int(a), int(b), sep=' ')


testlist = []
import math as m
for i in range(int(input())):
	testlist += [int(input())]
(alice, bob) = ([], [])
for i in testlist:
	N = (1 + m.sqrt(1 + 8 * i)) / 4
	N = m.floor(N)
	if N % 2 == 0:
		(Na, Nb) = (N / 2, N / 2)
	else:
		(Na, Nb) = ((N + 1) / 2, (N - 1) / 2)
	(Sa, Sb) = (int(Na * (1 + (Na - 1) * 4)), int(Nb * (5 + (Nb - 1) * 4)))
	if N % 2 == 0:
		Sa += i - Sa - Sb
	else:
		Sb += i - Sa - Sb
	alice += [Sa]
	bob += [Sb]
for i in range(len(testlist)):
	print(alice[i], ' ', bob[i])


from math import sqrt, floor
t = int(input())
for _ in range(t):
	n = int(input())
	x = floor(2 + sqrt(4 + 32 * n)) // 16
	(a, b) = ((1 + 1 + 8 * x - 8) * x // 2, (5 + 5 + 8 * x - 8) * x // 2)
	n -= a + b
	while n:
		nxt = min(n, 1 + 8 * x)
		a += nxt
		n -= nxt
		if not n:
			break
		nxt = min(n, 5 + 8 * x)
		b += nxt
		n -= nxt
		x += 1
	print(a, b)


for i in range(int(input())):
	a = 0
	b = 0
	num = int(input())
	if num > 0:
		n = (1 + (1 + 8 * num) ** (1 / 2)) / 2 // 1
		c = num - (n * n - n) / 2
		if n % 4 == 0:
			a = a + c
			num = num - c
		if n % 4 == 1:
			a = a + n - 1 + c
			num = num - n + 1 - c
		if n % 4 == 2:
			a = a + n - 1 + n - 2
			b = b + c
			num = num - n + 1 - c - n + 2
		if n % 4 == 3:
			a = a + n - 2 + n - 3
			b = b + n - 1 + c
			num = num - n + 1 - c - n + 2 - n + 3
		a = a + num / 2 - 2 * (n // 4)
		b = b + num / 2 + 2 * (n // 4)
	print(int(a), int(b))


for _ in range(int(input())):
	n = int(input())
	l = 1
	r = 1000000.0
	while r - l > 1:
		mid = (r + l) // 2
		x = mid + (mid - 1) * mid // 2 * 4
		if x <= n:
			l = mid
		else:
			r = mid
	cnt1 = l // 2 + l % 2
	x = l + (l - 1) * l // 2 * 4
	y = cnt1 + (cnt1 - 1) * cnt1 // 2 * 8
	if l % 2 == 0:
		y += n - x
	print(int(y), n - int(y))


for t in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	k = 1
	while n > 0:
		a += k
		n -= k
		if n <= 0:
			a += n
			break
		k += 4
		b += k
		n -= k
		if n <= 0:
			b += n
			break
		k += 4
	print(a, b)


n = 1000000.0
n_cards = [1]
i = 2
cumsum = 1
while cumsum <= n:
	temp = 2 * i + 1
	n_cards.append(temp)
	i += 2
	cumsum += temp
n_cards_AB = []
c = 0
for i in n_cards:
	c += i
	n_cards_AB.append(c)
cA = 1
cB = 0
c = 1
n_cards_A = [1]
n_cards_B = [0]
n_cards_AB = [1]
for i in range(1, len(n_cards)):
	if i % 2 == 0:
		cA += n_cards[i]
		n_cards_A.append(cA)
		n_cards_B.append(cB)
	else:
		cB += n_cards[i]
		n_cards_A.append(cA)
		n_cards_B.append(cB)
	c += n_cards[i]
	n_cards_AB.append(c)
for _ in range(int(input())):
	n = int(input())
	cnt = 0
	for i in range(len(n_cards_AB)):
		if n_cards_AB[i] > n:
			break
		else:
			cnt += 1
	delta = n - n_cards_AB[cnt - 1]
	A = n_cards_A[cnt - 1]
	B = n_cards_B[cnt - 1]
	if cnt % 2 == 0:
		A += delta
	else:
		B += delta
	print(A, B)


import math

def ind_cards(cards):
	check = (1 + math.sqrt(1 + 8 * cards)) / 4
	check = int(check)
	alice = 0
	bob = 0
	count = 0
	for i in range(1, 4 * check - 2, 4):
		count += 1
		if count % 2 != 0:
			alice += i
		else:
			bob += i
	if alice + bob < cards:
		if count % 2 == 0:
			alice += cards - (alice + bob)
		else:
			bob += cards - (alice + bob)
	return (alice, bob)
t = int(input())
l = []
for i in range(t):
	cards = int(input())
	(x, y) = ind_cards(cards)
	l.append([x, y])
for ele in l:
	print(ele[0], ele[1])


def solveA1():
	n = int(input())
	cards = [0, 0]
	dealAmt = 1
	turn = 0
	while n >= dealAmt:
		cards[turn] += dealAmt
		n -= dealAmt
		dealAmt += 4
		turn = (turn + 1) % 2
	cards[turn] += n
	print(*cards)
t = int(input())
for tc in range(t):
	solveA1()


t = int(input())
for _ in range(t):
	n = int(input())
	numofcards = 0
	i = 0
	while 1:
		numofcards += 4 * i + 3
		if numofcards > n:
			numofcards -= 4 * i + 3
			break
		i += 1
	a = numofcards // 2
	b = numofcards - a
	if i % 2 == 1:
		b += min(n - numofcards, 2 * i + 1)
		a = n - b
	else:
		a += min(n - numofcards, 2 * i + 1)
		b = n - a
	print(a, b)


import math

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

def stringlist():
	return input().split(' ')

def yes(t):
	if t:
		return 'YES'
	return 'NO'

def printjoin(l, is_str=False):
	if is_str:
		l = [str(i) for i in l]
	return ' '.join(l)

def power_of_two(n):
	b = bin(n)[2:]
	return int(b) == 10 ** (len(b) - 1)

def bit_count(n):
	return bin(n).count('1')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	lcm = x * y // gcd(x, y)
	return lcm

def isint(str):
	try:
		int(str)
		return True
	except ValueError:
		return False

def solve():
	n = int(input())
	a = 1
	b = 0
	i = 2
	nex = 'b'
	while True:
		if n - a - b > i:
			b += i
			i += 1
		else:
			b += n - a - b
			break
		if n - a - b > i:
			b += i
			i += 1
		else:
			b += n - a - b
			break
		if n - a - b > i:
			a += i
			i += 1
		else:
			a += n - a - b
			break
		if n - a - b > i:
			a += i
			i += 1
		else:
			a += n - a - b
			break
	return '{} {}'.format(a, b)
t = input()
for tt in range(int(t)):
	print(solve())


t = int(input(''))
for i in range(t):
	n = int(input(''))
	nq = (-1 + (1 + 8 * n) ** (1 / 2)) / 2
	nq = (nq - int(nq) < 0.5 and nq != int(nq)) * (int(nq) + 1) + (nq - int(nq) >= 0.5 or nq == int(nq)) * round(nq)
	(a, b) = (0, 0)
	if nq % 4 < 2:
		for j in range(nq + 1):
			if j % 4 >= 2:
				b += j
		a = n - b
	else:
		for j in range(nq + 1):
			if j % 4 < 2:
				a += j
		b = n - a
	print(f'{int(a)} {int(b)}')


def main():
	t = int(input().strip())
	for i in range(t):
		n = int(input().strip())
		i = 1
		j = 0
		x = 0
		a = 0
		b = 0
		while n > 0:
			if n >= i + j:
				a += i + j
				n -= i + j
				i += 2
				j += 2
			else:
				a += n
				break
			if n >= i + j:
				b += i + j
				n -= i + j
				i += 2
				j += 2
			else:
				b += n
				break
		print(a, b)
main()


for _ in range(int(input())):
	n = int(input())
	(alice, bob) = (0, 0)
	sum = 1
	while n > 0:
		if sum >= n:
			alice += n
			break
		else:
			alice += sum
			n -= sum
		sum += 4
		if sum >= n:
			bob += n
			break
		else:
			bob += sum
			n -= sum
		sum += 4
	print(alice, ' ', bob)


def card(cards):
	A = 0
	B = 0
	pt = 1
	count = 0
	while cards > 0:
		if count % 2 == 0:
			if pt > cards:
				A += cards
			else:
				A += pt
		elif pt > cards:
			B += cards
		else:
			B += pt
		cards -= pt
		pt += 4
		count += 1
	print(A, '', B)
n = int(input())
l = []
for i in range(n):
	a = int(input())
	l.append(a)
for cards in l:
	card(cards)


import sys
from collections import deque
from datetime import date, timedelta

def II():
	return int(input())

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

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

def slove():
	n = int(input())
	s = 0
	(a, b) = (0, 0)
	acc = 1
	a += acc
	s += acc
	f = 0
	while s < n:
		if f == 0:
			acc += 1
			b += acc
			s += acc
			acc += 1
			b += acc
			s += acc
			f = 1
		else:
			acc += 1
			a += acc
			s += acc
			acc += 1
			a += acc
			s += acc
			f = 0
	if s > n:
		t = n - s
		if f == 0:
			a += t
		else:
			b += t
	print(a, b)
case = int(input())
for _ in range(case):
	slove()


t = int(input())
while t > 0:
	n = int(input())
	n -= 1
	a = 1
	b = 0
	flag = False
	c = 2
	while n > 0:
		s = c * 2 + 1
		if flag:
			if s <= n:
				a += s
				n -= s
				c += 2
				flag = False
			else:
				a += n
				break
		elif s <= n:
			b += s
			n -= s
			c += 2
			flag = True
		else:
			b += n
			break
	print(a, b)
	t -= 1


from bisect import bisect_left
for _ in range(int(input())):
	n = int(input())
	x = [i * (i + 1) / 2 for i in range(1500)]
	w = bisect_left(x, n) - 1
	if w % 4 == 0:
		k = w // 4
		ans2 = k * (4 * k + 1)
		ans1 = n - ans2
	elif w % 4 == 1:
		k = w // 4 + 1
		ans1 = k * (4 * k - 3)
		ans2 = n - ans1
	elif w % 4 == 2:
		k = w // 4 + 1
		ans1 = k * (4 * k - 3)
		ans2 = n - ans1
	else:
		k = w // 4 + 1
		ans2 = k * (4 * k + 1)
		ans1 = n - ans2
	print('{} {}'.format(ans1, ans2))


import sys

def solve():
	n = int(sys.stdin.readline().strip())
	a = 1
	p = 0
	f = 1
	b = 0
	while p < n:
		if f & 1:
			b += min(a, n - p)
		p += a
		a += 4
		f += 1
	print(b, n - b)
t = int(input().strip())
for _ in range(t):
	solve()


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	i = 1
	c = [0, 0]
	while i <= n:
		c[i // 2 % 2] += i
		n -= i
		i += 1
	c[i // 2 % 2] += n
	print(c[0], c[1])

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


def ncard(n):
	a = 0
	b = 0
	i = 1
	isA = True
	c = 1
	while n >= i:
		if isA:
			a += i
		else:
			b += i
		n -= i
		i += 1
		c += 1
		if c == 2:
			c = 0
			isA = not isA
	if n > 0:
		if isA:
			a += n
		else:
			b += n
	print(a, b)
t = int(input())
for i in range(t):
	n = int(input())
	ncard(n)


import sys
input = sys.stdin.readline
T = int(input())
result = []
for _ in range(T):
	d = int(input()) - 1
	alice = 1
	bob = 0
	i = 5
	player = 'b'
	while 1:
		if d - i > 0:
			if player == 'b':
				bob += i
				player = 'a'
			else:
				alice += i
				player = 'b'
		else:
			if player == 'b':
				bob += d
			else:
				alice += d
			break
		d -= i
		i += 4
	print(alice, bob)


def solve():
	t = 1
	t = int(input())
	while t:
		t -= 1
		n = int(input())
		a = 0
		b = 0
		inc = 0
		aTurn = True
		while n > 4 * inc + 1:
			if aTurn:
				a += 4 * inc + 1
			else:
				b += 4 * inc + 1
			n -= 4 * inc + 1
			inc += 1
			aTurn = not aTurn
		print(a + n, b) if aTurn else print(a, b + n)
solve()


for i in range(int(input())):
	n = int(input())
	alice = 1
	bob = 0
	num = 1
	for i in range(n):
		if alice + bob + num + 4 >= n:
			left = n - (alice + bob)
			if i % 2 == 0:
				bob += left
			else:
				alice += left
			break
		if i % 2 == 0:
			num += 4
			bob += num
		else:
			num += 4
			alice += num
	print(alice, bob)


def sol():
	n = int(input())
	if n == 1:
		print(1, 0)
		return
	a = 1
	b = 0
	curr = 1
	i = 2
	bo = True
	while curr < n:
		if bo:
			if curr + 2 * i + 1 < n:
				b += 2 * i + 1
				curr += 2 * i + 1
			else:
				b += n - curr
				curr = n
			i += 2
			bo = False
		else:
			if curr + 2 * i + 1 < n:
				a += 2 * i + 1
				curr += 2 * i + 1
			else:
				a += n - curr
				curr = n
			i += 2
			bo = True
	print(a, b)
for i in range(int(input())):
	sol()


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		(alice, bob) = (0, 0)
		temp = 1
		while temp < n:
			if temp % 4 == 2 or temp % 4 == 3:
				bob += temp
			else:
				alice += temp
			n -= temp
			temp += 1
		if temp % 4 == 2 or temp % 4 == 3:
			bob += n
		else:
			alice += n
		print(alice, bob)
main()


from itertools import count

def solve():
	n = int(input())
	cnt_a = 0
	cnt_b = 0
	range_a = range(1, 2 * n, 8)
	for x in count(1, 4):
		d = min(x, n)
		if x in range_a:
			cnt_a += d
		else:
			cnt_b += d
		n -= d
		if n == 0:
			break
	print(cnt_a, cnt_b)

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


def solve() -> None:
	n = int(input())
	ans = [0] * 2
	idx = 0
	curr = 1
	while n:
		m = min(curr, n)
		ans[idx] += m
		curr += 4
		n -= m
		idx ^= 1
	print(ans[0], ans[1])
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	s = (-1 + (1 + 8 * n) ** 0.5) // 2
	for i in range(1, int(s) + 1):
		if i // 2 % 2 == 1:
			b += i
		elif i // 2 % 2 == 0:
			a += i
	if (i + 1) // 2 % 2 == 0:
		a += n - (s + 1) * s // 2
	else:
		b += n - (s + 1) * s // 2
	print(int(a), int(b))


t = int(input())
for z in range(t):
	a = 0
	b = 0
	i = 1
	n = int(input())
	while n > 0:
		if n > i:
			a += i
			n -= i
			i += 4
		else:
			a += n
			n -= n
			break
		if n == 0:
			break
		elif n > 0 and n > i:
			b += i
			n -= i
			i += 4
		elif n > 0 and n <= i:
			b += n
			n -= n
			break
	print(a, b)


a = int(input())
for i in range(a):
	b = [0, 0]
	c = 1
	o = False
	n = int(input())
	while n > 0:
		b[o] += c
		n -= c
		o = not o
		c += 4
	b[not o] += n
	print(b[0], b[1])


for t in range(int(input())):
	n = int(input())
	c = 1
	alice_bob = [0, 0]
	itr = False
	while n > 0:
		alice_bob[itr] += c
		n -= c
		itr = not itr
		c += 4
	alice_bob[not itr] += n
	print(*alice_bob)


t = int(input())
for _ in range(t):
	n = int(input())
	(A, B) = (0, 0)
	c = 1
	curA = True
	while True:
		if curA:
			A += c
			n -= c
			curA = False
		else:
			B += c
			n -= c
			curA = True
		if n <= 0:
			break
		else:
			c += 4
	if curA:
		B += n
	else:
		A += n
	print(A, B)


t = int(input())
for i in range(t):
	z = int(input())
	q = 0
	w = 0
	counter = 1
	while z > 0:
		if z - counter < 0:
			q += z
			break
		else:
			q += counter
			z -= counter
			counter += 4
		if z - counter < 0:
			w += z
			break
		else:
			w += counter
			z -= counter
			counter += 4
	print(q, w)


import sys
import math
from itertools import accumulate

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

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

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

def solve():
	n = int(input())
	A = 1
	n = n - 1
	B = 0
	cur = 2
	is_a = False
	while n >= 0:
		if is_a:
			A += cur
			A += cur + 1
			n -= cur + cur + 1
			if n < 0:
				A += n
		else:
			B += 2 * cur + 1
			n -= 2 * cur + 1
			if n < 0:
				B += n
		cur += 2
		is_a = not is_a
	print(A, B)
T = int(input())
for _ in range(T):
	solve()


zzz = int(input())
for _ in range(zzz):
	ty = int(input())
	qw = 1
	er = 0
	ui = 1
	ans = 0
	while er < ty:
		if ui & 1:
			ans += min(qw, ty - er)
		er += qw
		qw += 4
		ui = ui + 1
	print(ans, '', end='')
	print(ty - ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	n -= 1
	b = 0
	i = 2
	bob = True
	while n > 0:
		if bob:
			bd = i + i + 1
			if n - bd < 0:
				b += n
				break
			else:
				b += bd
				n -= bd
				i += 2
				bob = False
		else:
			ad = i + i + 1
			if n - ad < 0:
				a += n
				break
			else:
				a += ad
				n -= ad
				i += 2
				bob = True
	print(a, ' ', b)


t = int(input())
for i in range(t):
	n = int(input())
	n -= 1
	A = 1
	B = 0
	i = 2
	while n != 0:
		if 2 * i + 1 <= n:
			B += 2 * i + 1
			n -= 2 * i + 1
			i += 2
		else:
			B += n
			n = 0
			break
		if 2 * i + 1 <= n:
			A += 2 * i + 1
			n -= 2 * i + 1
			i += 2
		else:
			A += n
			n = 0
			break
	print(A, B)


def solve(n):
	r = [1, 0]
	c = 1
	step = 1
	while c < n:
		v = min(n - c, step * 2 + step * 2 + 1)
		r[1] += v
		c += v
		v = min(n - c, (step + 1) * 2 + (step + 1) * 2 + 1)
		r[0] += v
		c += v
		step += 2
	return r
t = int(input())
ans = []
for ti in range(t):
	n = int(input())
	ans.append(solve(n))
for a in ans:
	print(' '.join((str(x) for x in a)))


for _ in range(int(input())):
	x = int(input())
	(a, b) = (0, 0)
	i = 1
	while x:
		d = min(x, i)
		a += d
		x -= d
		i += 4
		d = min(x, i)
		b += d
		x -= d
		i += 4
	print(a, b)


for _ in range(int(input())):
	n = int(input())
	if n == 0:
		print(0, 0)
	a = 1
	b = 0
	n = n - 1
	temp = 2
	flag = 1
	while n > 0:
		if flag == 1:
			if n >= temp * 2 + 1:
				b += temp * 2 + 1
				flag = 0
				n -= temp * 2 + 1
			else:
				b += n
				break
		elif n >= temp * 2 + 1:
			a += temp * 2 + 1
			flag = 1
			n -= temp * 2 + 1
		else:
			a += n
			break
		temp += 2
	print(a, b)


for _ in range(int(input())):
	n = int(input())
	cards_a = 0
	cards_b = 0
	for i in range(1, n + 1):
		if n >= i:
			if i % 4 == 1:
				cards_a += i
				n -= i
			elif i % 4 == 2:
				cards_b += i
				n -= i
			elif i % 4 == 3:
				cards_b += i
				n -= i
			elif i % 4 == 0:
				cards_a += i
				n -= i
		elif n > 0 and n < i:
			if i % 4 == 1:
				cards_a += n
				n -= n
			elif i % 4 == 2:
				cards_b += n
				n -= n
			elif i % 4 == 3:
				cards_b += n
				n -= n
			elif i % 4 == 0:
				cards_a += n
				n -= n
		else:
			break
	print(cards_a, cards_b)


def main():
	n = int(input())
	cards = []
	for i in range(n):
		cards.append(int(input()))
	for i in cards:
		print(cardsCount(i))

def cardsCount(cards):
	alice = 0
	bob = 0
	current = 'alice'
	counter = 1
	length = cards
	iteration = 1
	while counter <= length:
		if current == 'alice':
			alice += counter
		else:
			bob += counter
		length -= counter
		iteration += 1
		counter += 1
		if iteration % 2 == 0:
			if current == 'alice':
				current = 'bob'
			else:
				current = 'alice'
	if current == 'alice':
		alice += length
	else:
		bob += length
	return f'{alice} {bob}'
main()


t = int(input())
for tc in range(t):
	n = int(input())
	a = 1
	b = 0
	c = 1
	while True:
		c += 1
		b += c
		if a + b == n:
			print(a, b)
			break
		elif a + b > n:
			print(a, n - a)
			break
		c += 1
		b += c
		if a + b == n:
			print(a, b)
			break
		elif a + b > n:
			print(a, n - a)
			break
		c += 1
		a += c
		if a + b == n:
			print(a, b)
			break
		elif a + b > n:
			print(n - b, b)
			break
		c += 1
		a += c
		if a + b == n:
			print(a, b)
			break
		elif a + b > n:
			print(n - b, b)
			break


t = int(input())
for t in range(t):
	n = int(input())
	a = 1
	b = 0
	temp = a
	c = 'b'
	if n == 2:
		print(1, 1)
	else:
		for i in range(2, n, 2):
			if temp + (i + i + 1) <= n:
				if c == 'b':
					b += i + i + 1
					c = 'a'
				elif c == 'a':
					a += i + i + 1
					c = 'b'
				temp += i + i + 1
			else:
				if c == 'b':
					b += n - temp
				elif c == 'a':
					a += n - temp
				break
		print(a, b)


a = int(input())
for i in range(a):
	num = int(input())
	alice = 1
	bob = 0
	num = num - 1
	i = 4
	j = 2
	while num:
		if num > j:
			bob = bob + j
			num = num - j
		else:
			bob = bob + num
			break
		if num >= j + 1:
			bob = bob + j + 1
			num = num - j - 1
		else:
			bob = bob + num
			break
		if num >= i:
			alice = alice + i
			num = num - i
		else:
			alice = alice + num
			break
		if num >= i + 1:
			alice = alice + i + 1
			num = num - i - 1
		else:
			alice = alice + num
			break
		i = i + 4
		j = j + 4
	print(alice, ' ', bob)


t = int(input())
for i in range(t):
	n = int(input())
	p = 0
	j = 0
	k = 0
	a = 0
	b = 0
	while True:
		if k == 0:
			a = a + j + 1
			j = j + 1
		else:
			r = j + 1 + j + 2 + a + b
			if r > n:
				n = n - (a + b)
				if k % 2 == 0:
					a = a + n
				else:
					b = b + n
				break
			if k % 2 == 0:
				a = a + j + 1 + j + 2
			else:
				b = b + j + 1 + j + 2
			j = j + 2
		k = k + 1
	print(a, b)


for _ in range(int(input())):
	x = int(input())
	a = 0
	b = 0
	t = 1
	while x > 0:
		if t < x:
			a += t
			x -= t
			t += 1
		else:
			a += x
			break
		if t < x:
			b += t
			x -= t
			t += 1
		else:
			b += x
			break
		if t < x:
			b += t
			x -= t
			t += 1
		else:
			b += x
			break
		if t < x:
			a += t
			x -= t
			t += 1
		else:
			a += x
			break
	print(a, end=' ')
	print(b)


T = int(input())
for t in range(T):
	N = int(input()) - 1
	alice = 1
	bob = 0
	i = 1
	while N > 0:
		if i % 2 == 1:
			cards = min(N, 4 * i + 1)
			N -= cards
			bob += cards
		else:
			cards = min(N, 4 * i + 1)
			N -= cards
			alice += cards
		i += 1
	print(alice, bob)


for _ in [''] * int(input()):
	n = int(input())
	A = 0
	B = 0
	i = 1
	while n > 0:
		if i % 4 == 0 or i % 4 == 1:
			A += i
		else:
			B += i
		n -= i
		i += 1
	i -= 1
	if i % 4 == 0 or i % 4 == 1:
		A += n
	else:
		B += n
	print(A, B)


n = []
sums = []
for _ in range(int(input())):
	n.append(int(input()))
	m = max(n)
sums = [[1, 0]]
i = 1
while sum(sums[-1]) < m:
	i += 1
	if i % 4 in [2, 3]:
		sums.append([sums[-1][0], sums[-1][1] + i])
	else:
		sums.append([sums[-1][0] + i, sums[-1][1]])
for j in n:
	k = 0
	while sum(sums[k]) < j:
		k += 1
	l = sums[k][:]
	diff = sum(l) - j
	if k % 4 in [1, 2]:
		l[1] -= diff
	else:
		l[0] -= diff
	print(l[0], l[1])


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	n = n - 1
	(c, c1) = (1, 0)
	a = 1
	while n != 0:
		if 2 * (a + 1) + 1 <= n:
			c1 = c1 + 2 * (a + 1) + 1
			n = n - (2 * (a + 1) + 1)
			a = a + 2
		else:
			c1 = c1 + n
			n = 0
			break
		if 2 * (a + 1) + 1 <= n:
			c = c + 2 * (a + 1) + 1
			n = n - (2 * (a + 1) + 1)
			a = a + 2
		else:
			c = c + n
			n = 0
			break
	print(c, end=' ')
	print(c1)


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	alice_turn = False
	alice = 1
	bob = 0
	rem = n - 1
	for i in range(2, n + 1, 2):
		if rem <= 0:
			break
		if i + i + 1 <= rem:
			rem -= i + i + 1
			if alice_turn:
				alice += i + i + 1
			else:
				bob += i + i + 1
		else:
			if alice_turn:
				alice += rem
			else:
				bob += rem
			rem = 0
		alice_turn ^= True
	print(alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	b = 0
	i = 0
	while n > 0:
		temp = 4 * i + 1
		if i % 2 == 0:
			if temp <= n:
				a += temp
				n -= temp
			else:
				a += n
				n = 0
		elif temp <= n:
			b += temp
			n -= temp
		else:
			b += n
			n = 0
		i += 1
	print('{0} {1}'.format(a, b))


for i in range(int(input())):
	alice = 0
	bob = 0
	n = int(input())
	i = 0
	while n > 0:
		if n >= 2 * i + 1:
			alice = alice + 2 * i + 1
			n = n - 2 * i - 1
			i = i + 2
			if n >= 2 * i + 1:
				bob = bob + 2 * i + 1
				n = n - 2 * i - 1
				i = i + 2
			else:
				bob = bob + n
				n = 0
		else:
			alice = alice + n
			n = 0
	print(alice, bob)


import sys
import math
import bisect
import heapq
import itertools
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
mod = 1000000007

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

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

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

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

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

def solve():
	n = get_int()
	alice = 1
	bob = 0
	current = 2
	turn = 0
	while alice + bob + (2 * current + 1) < n:
		if turn % 2 == 0:
			bob += 2 * current + 1
		else:
			alice += 2 * current + 1
		current += 2
		turn += 1
	if turn % 2 == 0:
		bob += n - (alice + bob)
	else:
		alice += n - (alice + bob)
	return [alice, bob]
for _ in range(get_int()):
	print(*solve())


for z in range(int(input())):
	n = int(input())
	n -= 1
	i = 2
	a = 1
	b = 0
	while n != 0:
		if i % 4 == 0:
			if n >= 2 * i + 1:
				a += 2 * i + 1
				n -= 2 * i + 1
			else:
				a += n
				n -= n
		elif n >= 2 * i + 1:
			b += 2 * i + 1
			n -= 2 * i + 1
		else:
			b += n
			n -= n
		i += 2
	print(a, end=' ')
	print(b)


def main():
	t = int(input())
	for i in range(t):
		num = int(input())
		num = num - 1
		(H, B, count, c) = (1, 0, 0, 2)
		flag = -1
		while num != 0:
			for i in range(2):
				if num < c:
					B = B + num
					flag = 0
					break
				else:
					B = B + c
					num = num - c
					c = c + 1
			if flag == 0:
				break
			for i in range(2):
				if num < c:
					H = H + num
					flag = 0
					break
				else:
					H = H + c
					num = num - c
					c = c + 1
			if flag == 0:
				break
		print(H, end=' ')
		print(B)
	return 0
main()


import collections
import math
import heapq
for _ in range(int(input())):
	n = int(input())
	if n == 0:
		print(0, 0)
		continue
	(a, b) = (1, 0)
	cards = 2
	x = n - 1
	c = 0
	giveA = False
	while True:
		curr = cards + cards + 1
		if x - curr <= 0:
			if giveA:
				a += x
			else:
				b += x
			break
		x -= curr
		if giveA:
			a += curr
		else:
			b += curr
		cards += 2
		giveA = not giveA
	print(a, b)


t = input()
for i in range(int(t)):
	n = int(input())
	a = 1
	b = 0
	bt = 0
	at = 1
	n -= 1
	while True:
		b = a + 1
		if n < b:
			bt += n
			break
		n -= b
		bt += b
		b = b + 1
		if n < b:
			bt += n
			break
		n -= b
		bt += b
		a = b + 1
		if n < a:
			at += n
			break
		n -= a
		at += a
		a = a + 1
		if n < a:
			at += n
			break
		n -= a
		at += a
	print(str(at) + ' ' + str(bt))


for _ in range(int(input())):
	n = int(input()) - 1
	alice = 1
	bob = 0
	x = 2
	flag = True
	flag2 = 'bob'
	while flag:
		if x * 2 + 1 > n:
			if flag2 == 'bob':
				bob += n
			elif flag2 == 'alice':
				alice += n
			flag = False
			print(alice, bob)
			break
		bob += x * 2 + 1
		n -= x * 2 + 1
		x += 2
		flag2 = 'alice'
		if x * 2 + 1 > n:
			if flag2 == 'bob':
				bob += n
			elif flag2 == 'alice':
				alice += n
			flag = False
			print(alice, bob)
			break
		alice += x * 2 + 1
		n -= x * 2 + 1
		x += 2
		flag2 = 'bob'


for _ in range(int(input())):
	n = int(input())
	a = 1
	b = 0
	n -= 1
	t = 1
	c = 2
	while n > 0:
		if t % 2:
			if n > 2 * c + 1:
				b += 2 * c + 1
			else:
				b += n
		elif n > 2 * c + 1:
			a += 2 * c + 1
		else:
			a += n
		n -= 2 * c + 1
		c += 2
		t += 1
	print(a, b)


for i in range(int(input())):
	n = int(input())
	x = 1
	y = 0
	flag = 0
	count = 0
	for i in range(2, n + 1):
		if x + y + i > n:
			break
		if flag == 1:
			count -= 1
			x += i
			if count == 0:
				flag = 0
				continue
		else:
			count += 1
			y += i
			if count == 2:
				flag = 1
	if flag == 1:
		x += n - abs(x + y)
	else:
		y += n - abs(x + y)
	print(x, y)


t = int(input())
for _ in range(t):
	n = int(input())
	(soc, A, B, i) = (n - 1, 1, 0, 1)
	while soc > 0:
		if i % 2 == 1:
			CB = 0
			if soc - (1 + i * 4) >= 0:
				CB += 1 + i * 4
			else:
				CB += soc
			soc -= CB
			B += CB
		else:
			CA = 0
			if soc - (1 + i * 4) >= 0:
				CA += 1 + i * 4
			else:
				CA += soc
			soc -= CA
			A += CA
		i += 1
	print(A, B)


t = int(input())
for i in range(t):
	n = int(input()) - 1
	alice = 1
	bob = 0
	s = 0
	j = 1
	while n > 0:
		if s == 0:
			if n > 4 * j + 1:
				bob += 4 * j + 1
				n -= 4 * j + 1
				j += 1
				s = 1
			else:
				bob += n
				n = 0
		elif n > 4 * j + 1:
			alice += 4 * j + 1
			n -= 4 * j + 1
			j += 1
			s = 0
		else:
			alice += n
			n = 0
	print(str(alice) + ' ' + str(bob))


def solve():
	a = int(input())
	obsumma = 0
	massive = [1]
	massive1 = []
	a = a - 1
	while a != 0:
		if obsumma % 2 == 0:
			summa = massive[-1] + 1 + (massive[-1] + 2)
			if a - summa > 0:
				a = a - summa
				massive1.append(massive[-1] + 1)
				massive1.append(massive[-1] + 2)
			else:
				massive1.append(a)
				a = a - a
		elif obsumma % 2 != 0:
			summa = massive1[-1] + 1 + (massive1[-1] + 2)
			if a - summa > 0:
				a = a - summa
				massive.append(massive1[-1] + 1)
				massive.append(massive1[-1] + 2)
			else:
				massive.append(a)
				a = a - a
		obsumma += 1
	print(sum(massive), sum(massive1))
a = int(input())
for i in range(a):
	solve()


import sys

def read(func=int):
	return func(sys.stdin.readline().strip())

def read_array(func=int):
	return list(map(func, read(str).split()))
t = read()
for _ in range(t):
	n = read()
	(a, b) = (0, 0)
	inA = False
	a += min(1, n)
	n -= a
	cnt = 2
	while n:
		ad = min(cnt * 2 + 1, n)
		if not inA:
			b += ad
			n -= ad
		else:
			a += ad
			n -= ad
		inA = not inA
		cnt += 2
	print(a, b)


for _ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	cards = 1
	while n >= 0:
		a += cards
		n -= cards
		cards += 1
		if n <= 0:
			a += n
			break
		b += cards
		n -= cards
		cards += 1
		if n <= 0:
			b += n
			break
		b += cards
		n -= cards
		cards += 1
		if n <= 0:
			b += n
			break
		a += cards
		n -= cards
		cards += 1
		if n <= 0:
			a += n
			break
	print(a, b)


n = int(input())
for i in range(n):
	a = int(input())
	if a == 0:
		print(0, 0)
	else:
		(first, second) = (1, 0)
		a -= 1
		c = False
		n = 1
		while a > 0:
			n += 4
			if c == False:
				second += min(n, a)
				c = True
			else:
				first += min(n, a)
				c = False
			a -= n
		print(first, second)


t = int(input())
for i in range(t):
	Alisa = 0
	Bob = 0
	n = int(input())
	a = 3
	f = True
	while n >= a:
		if f:
			Alisa += a // 2
			Bob += a // 2 + 1
		else:
			Alisa += a // 2 + 1
			Bob += a // 2
		n -= a
		a += 4
		f = not f
	k = min(n, a // 2)
	if f:
		Alisa += k
		Bob += n - k
	else:
		Alisa += n - k
		Bob += k
	print(Alisa, Bob, sep=' ')


ttt = int(input())
while ttt > 0:
	ttt -= 1
	n = int(input())
	a = 1
	n -= 1
	b = 0
	i = 2
	j = 0
	while n > 0:
		k = 2 * i + 1
		if k <= n:
			if j % 2 == 0:
				b = b + k
			else:
				a = a + k
			n = n - k
		else:
			if j % 2 == 0:
				b = b + n
			else:
				a = a + n
			n = 0
		i = i + 2
		j += 1
	print(a, b)


for i in range(int(input())):
	giv = int(input())
	sum = 0
	(a, b) = (0, 0)
	j = 0
	while giv > sum:
		j = j + 1
		if j > giv - sum:
			j = giv - sum
		a = a + j
		sum = sum + j
		if giv > sum:
			j = j + 1
			if j > giv - sum:
				j = giv - sum
			b = b + j
			sum = sum + j
		if giv > sum:
			j = j + 1
			if j > giv - sum:
				j = giv - sum
			b = b + j
			sum = sum + j
		if giv > sum:
			j = j + 1
			if j > giv - sum:
				j = giv - sum
			a = a + j
			sum = sum + j
	print(a, b)


n = int(input())
for _ in range(n):
	m = int(input())
	a = 1
	b = 0
	s = 2
	m = m - 1
	u = 0
	while m > 0:
		if u % 2 == 0:
			if m >= 2 * s + 1:
				b += 2 * s + 1
				m = m - 2 * s - 1
				s = s + 2
			else:
				b += m
				m = 0
		elif m >= 2 * s + 1:
			a += 2 * s + 1
			m = m - 2 * s - 1
			s = s + 2
		else:
			a += m
			m = 0
		u = u + 1
	print(a, b)


t = int(input())
res = []
for i in range(t):
	n = int(input())
	kola = 0
	kolb = 0
	j = 1
	while j < n:
		if j % 4 == 2 or j % 4 == 3:
			kolb += j
		else:
			kola += j
		n -= j
		j += 1
	if j % 4 == 2 or j % 4 == 3:
		kolb += n
	else:
		kola += n
	res.append((kola, kolb))
for i in res:
	print(*i)


n = int(input())
for i in range(n):
	m = int(input())
	alis = 1
	bob = 0
	m -= 1
	r = 0
	pos = 2
	while m > 0:
		if r % 2 == 1:
			if pos * 2 + 1 <= m:
				alis += pos * 2 + 1
				m -= pos * 2 + 1
			else:
				alis += m
				m = 0
		elif pos * 2 + 1 <= m:
			bob += pos * 2 + 1
			m -= pos * 2 + 1
		else:
			bob += m
			m = 0
		pos += 2
		r += 1
	print(alis, bob)


test = int(input())
while test:
	cards = int(input())
	i = 3
	a = 1
	cards -= 1
	b = 0
	j = 0
	while cards > 0:
		if j:
			res = i - 1 + i
			if cards - res > 0:
				a += res
			else:
				a += cards
			cards -= res
			i += 2
		else:
			res = i - 1 + i
			if cards - res > 0:
				b += res
			else:
				b += cards
			i += 2
			cards -= res
		j = 1 - j
	print(a, b)
	test -= 1


t = int(input())
while t > 0:
	n = int(input())
	a = 0
	b = 0
	j = 1
	i = 1
	while n > 0:
		if i % 2 != 0:
			if n >= j:
				a = a + j
				n = n - j
				j = j + 1
			else:
				a = a + n
				break
			if n > 0 and n >= j:
				b = b + j
				n = n - j
				j = j + 1
			else:
				b = b + n
				break
		else:
			if n >= j:
				b = b + j
				n = n - j
				j = j + 1
			else:
				b = b + n
				break
			if n > 0 and n >= j:
				a = a + j
				n = n - j
				j = j + 1
			else:
				a = a + n
				break
		i = i + 1
	print(a, b)
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	sa = 0
	sb = 0
	j = 1
	while sa + sb + j <= n:
		if j % 4 == 0 or j % 4 == 1:
			sa = sa + j
		else:
			sb = sb + j
		j = j + 1
	if j % 4 == 0 or j % 4 == 1:
		sa = n - sb
	else:
		sb = n - sa
	print(sa, sb)


def cards(total):
	cards_remaining = total
	alice = 0
	bob = 0
	times = 0
	for i in range(total):
		if cards_remaining == 0:
			break
		cards_to_give = i + 1
		if cards_to_give > cards_remaining:
			cards_to_give = cards_remaining
		cards_remaining -= cards_to_give
		if times == 0:
			alice += cards_to_give
			times += 1
		elif times <= 2:
			bob += cards_to_give
			times += 1
		elif times <= 4:
			alice += cards_to_give
			times += 1
			if times == 5:
				times = 1
	return (alice, bob)
for i in range(int(input())):
	(alice, bob) = cards(int(input()))
	print(alice, bob)


for t in range(int(input())):
	num = int(input())
	(i, A, B) = (1, 0, 0)
	while A + B != num:
		value = 4 * i - 3
		if value <= num - (A + B):
			value = value
		else:
			value = num - (A + B)
		if i % 2:
			B += value
		else:
			A += value
		i += 1
	print(B, A)


for _ in range(int(input())):
	n = int(input())
	summ = i = index = 1
	receiver = [1, 0]
	while summ < n:
		addition = 2 * i + 3
		if summ + addition <= n:
			receiver[index] += addition
			index = abs(index - 1)
			summ += addition
			i += 2
		else:
			receiver[index] += n - summ
			break
	print(*receiver)