Polycarp has found a table having an infinite number of rows and columns. The rows are numbered from $1$, starting from the topmost one. The columns are numbered from $1$, starting from the leftmost one.

Initially, the table hasn't been filled and Polycarp wants to fix it. He writes integers from $1$ and so on to the table as follows.

The figure shows the placement of the numbers from $1$ to $10$. The following actions are denoted by the arrows.

The leftmost topmost cell of the table is filled with the number $1$. Then he writes in the table all positive integers beginning from $2$ sequentially using the following algorithm.

First, Polycarp selects the leftmost non-filled cell in the first row and fills it. Then, while the left neighbor of the last filled cell is filled, he goes down and fills the next cell. So he goes down until the last filled cell has a non-filled neighbor to the left (look at the vertical arrow going down in the figure above).

After that, he fills the cells from the right to the left until he stops at the first column (look at the horizontal row in the figure above). Then Polycarp selects the leftmost non-filled cell in the first row, goes down, and so on.

A friend of Polycarp has a favorite number $k$. He wants to know which cell will contain the number. Help him to find the indices of the row and the column, such that the intersection of the row and the column is the cell containing the number $k$.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases. Then $t$ test cases follow.

Each test case consists of one line containing one integer $k$ ($1 \le k \le 10^9$) which location must be found.


-----Output-----

For each test case, output in a separate line two integers $r$ and $c$ ($r, c \ge 1$) separated by spaces — the indices of the row and the column containing the cell filled by the number $k$, respectively.


-----Examples-----

Input
7
11
14
5
4
1
2
1000000000
Output
2 4
4 3
1 3
2 1
1 1
1 2
31623 14130


-----Note-----

None

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
import itertools
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip
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')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
from math import *
from itertools import *
from collections import *
from bisect import *
from heapq import *
inf = float('inf')
mod = 10 ** 9 + 7

def aa():
	return int(input())

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

def cc():
	s = input()
	return list(s)

def dd():
	return map(int, input().split())
arr = []
for i in range(1, 1000000):
	if i % 3 == 0 or i % 10 == 3:
		pass
	else:
		arr.append(i)

def koi_coding_sikha_do():
	n = aa()
	m = int(sqrt(n))
	x = 1
	y = m + 1
	temp = m * m + 1
	if m * m == n:
		print(m, 1)
		return
	for i in range(m + 1):
		if temp == n:
			print(x, y)
			return
		x += 1
		temp += 1
	for i in range(m + 1):
		if temp == n:
			print(x - 1, y - 1)
			return
		y -= 1
		temp += 1
onlyone = 0
t = 1 if onlyone else int(input())
while t:
	koi_coding_sikha_do()
	t -= 1


t = int(input())
for i in range(t):
	k = int(input())
	a = int(k ** 0.5)
	b = k - a ** 2
	if b == 0:
		print(a, '1')
	else:
		r = min(a + 1, b)
		c = min((a + 1) ** 2 - k + 1, a + 1)
		print(r, c)


def code_input():
	amount = int(input())
	for _ in range(amount):
		n = 0
		k = int(input())
		column = 1
		row = 1
		i = 1
		last = 1
		while n < k:
			last = n + 1
			n += i * 2 - 1
			i += 1
		i += -1
		n += 1
		row = k - last + 1 if k - last < i else i
		column = i if k - last < i else i - (k - last - i + 1)
		print('{} {}'.format(row, column))
code_input()


t = int(input())
for _ in range(t):
	k = int(input())
	c = 1
	while c ** 2 < k:
		c = c + 1
	r = 1
	while (r - 1) ** 2 + 1 <= k:
		r = r + 1
	r = r - 1
	if k - (r - 1) ** 2 - 1 < c ** 2 - k:
		print(k - (r - 1) ** 2, r)
	else:
		print(c, c ** 2 - k + 1)


t = int(input())
n = []
for _ in range(t):
	k = int(input())
	a = int(k ** 0.5)
	if a ** 2 == k:
		stolbec = 1
		stroka = a
	else:
		d = k - a ** 2
		if d == a + 1:
			stroka = a + 1
			stolbec = a + 1
		elif d < a + 1:
			stolbec = a + 1
			stroka = d
		else:
			stroka = a + 1
			stolbec = a + 1 - (d - (a + 1))
	n.append(stroka)
	n.append(stolbec)
for i in range(0, len(n) - 1, 2):
	print(n[i], n[i + 1])


t = int(input())
for i in range(t):
	n = int(input())
	l = 1
	r = 100000.0
	while l <= r:
		mid = (l + r) // 2
		if mid ** 2 >= n:
			r = mid - 1
		else:
			l = mid + 1
	if l ** 2 == n:
		print(int(l), 1)
	elif 1 + (l - 1) * l == n:
		print(int(l), int(l))
	elif 1 + (l - 1) * l < n:
		print(int(l), int(l ** 2 - n + 1))
	else:
		print(int(n - (l - 1) ** 2), int(l))


for i in range(int(input())):
	k = int(input())
	c = (k - 1) ** 0.5 // 1 + 1
	if k - ((c - 1) ** 2 + 1) != c ** 2 - k:
		col = min(max(c ** 2 - k + 1, 1), c)
		row = min(max(k - (c - 1) ** 2, 1), c)
		print(int(row), int(col))
	else:
		print(int(c), int(c))


for _ in [0] * int(input()):
	n = int(input())
	a = int(n ** 0.5)
	if n == a * a:
		print(a, 1)
	elif n <= a * (a + 1) + 1:
		print(n - a * a, a + 1)
	else:
		print(a + 1, a * (a + 2) + 2 - n)


import math
for j in range(int(input())):
	x = int(input())
	if x == 1:
		print(1, 1)
		continue
	i = math.floor(math.sqrt(x))
	if x == i ** 2:
		print(i, 1)
		continue
	s = i ** 2 + 1
	e = (i + 1) ** 2
	mid = (s + e) / 2
	if x == mid:
		print(i + 1, i + 1)
	elif x > mid:
		print(i + 1, e - x + 1)
	else:
		print(x - s + 1, i + 1)


import math
w = int(input())
l = []
for i in range(w):
	k = int(input())
	l.append(k)
for i in l:
	a = int(math.floor(math.sqrt(i)))
	b = int(math.ceil(math.sqrt(i)))
	if a == b:
		print(int(a), 1)
	elif i <= a * a + b:
		print(i - a * a, a + 1)
	else:
		print(b, b * b + 1 - i)


import math

def solve(n):
	if n == 1:
		return (1, 1)
	else:
		x = math.floor(math.sqrt(n))
		z = math.ceil(math.sqrt(n))
		diff1 = abs(n - x ** 2)
		diff2 = abs(n - z ** 2)
		if diff1 < diff2:
			c = int(x) + 1
			r = diff1
		else:
			r = int(z)
			c = diff2 + 1
		return (r, c)
for _ in range(int(input())):
	n = int(input())
	(r, c) = solve(n)
	print(int(r), int(c))


for _ in range(int(input())):
	k = int(input())
	i = 0
	s = 1
	n = 0
	while i < k:
		i += s
		s += 2
		n += 1
	s = (s - 3) // 2
	if i - k < s:
		m = n
		n = i - k + 1
	elif i - k > s:
		m = n - (i - k - s)
	else:
		m = n
	print(m, n)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1, 1)
	else:
		l = math.ceil(math.pow(n, 1 / 2))
		k = pow(math.ceil(math.pow(n, 1 / 2)), 2) - l + 1
		if n == k:
			print(l, l)
		elif n > k:
			print(l, l - (n - k))
		else:
			print(l - (k - n), l)


import sys
input = sys.stdin.readline
from bisect import bisect_left
t = int(input())
sq = []
for i in range(1, 10 ** 5 + 1):
	sq.append(i * i)
for _ in range(t):
	k = int(input())
	idx = bisect_left(sq, k)
	dx = sq[idx] - k
	(y, x) = (-1, -1)
	if dx <= idx:
		y = idx + 1
		x = dx + 1
	else:
		y = idx + 1 - (dx - idx)
		x = idx + 1
	print(y, x)


import math

def getPos(target):
	limit = math.ceil(target ** 0.5)
	temp = limit ** 2 - limit + 1
	if target < temp:
		return f'{limit - (temp - target)} {limit}'
	elif target > temp:
		return f'{limit} {limit - (target - temp)}'
	else:
		return f'{limit} {limit}'
testCase = int(input())
l = []
for i in range(testCase):
	test = int(input())
	l.append(getPos(test))
for i in l:
	print(i)


a = int(input())
for i in range(a):
	num = float(input())
	x = num ** 0.5
	if x != int(x):
		x = int(x) + 1
	check = x ** 2
	if num == 2:
		print(1, 2)
		continue
	if check - num < x:
		print(int(x), int(check - num + 1))
	else:
		dif = check - num
		print(int(2 * x - 1 - dif), int(x))


import math
cases = int(input())
while cases != 0:
	cases -= 1
	k = int(input())

	def nextPerfectSquare(N):
		nextN = math.floor(math.sqrt(N)) + 1
		return nextN

	def checkperfectsquare(x):
		if math.ceil(math.sqrt(x)) == math.floor(math.sqrt(x)):
			return True
		else:
			return False
	if checkperfectsquare(k):
		print(int(math.sqrt(k)), 1, sep=' ')
	elif k > nextPerfectSquare(k) ** 2 - nextPerfectSquare(k):
		print(nextPerfectSquare(k), nextPerfectSquare(k) ** 2 - k + 1, sep=' ')
	else:
		print(k - (nextPerfectSquare(k) - 1) ** 2, nextPerfectSquare(k), sep=' ')


import math
t = int(input())
for i in range(t):
	k = int(input())
	size = int(math.sqrt(k))
	rest = k - size ** 2
	if rest == 0:
		r = size
		s = 1
	elif rest <= size:
		r = rest
		s = size + 1
	elif rest == size + 1:
		(r, s) = (size + 1, size + 1)
	elif rest > size + 1:
		r = size + 1
		s = 2 * size + 2 - rest
	print(r, ' ', s)


import math
t = int(input())
for _ in range(t):
	k = int(input())
	rt = int(math.sqrt(k))
	if rt ** 2 == k:
		print(rt, 1)
	elif k - rt * rt <= rt:
		print(k - rt * rt, rt + 1)
	else:
		print(rt + 1, (rt + 1) ** 2 - k + 1)


import math

def solution(k):
	if k == 1:
		print(1, 1)
		return
	elif k == 2:
		print(1, 2)
		return
	elif k == 3:
		print(2, 2)
		return
	elif k == 4:
		print(2, 1)
		return
	s = math.floor(math.sqrt(k))
	curr = s ** 2 + 1
	if s * s == k:
		print(s, 1)
		return
	i = 1
	j = s + 1
	for m in range(s):
		if curr == k:
			print(i, j, sep=' ')
			return
		i += 1
		curr += 1
	for m in range(s):
		if curr == k:
			print(i, j, sep=' ')
			return
		j -= 1
		curr += 1
for _ in range(int(input())):
	k = int(input())
	solution(k)


from math import sqrt
for _ in range(int(input())):
	x = int(input())
	s = int(sqrt(x))
	n = x - s * s
	if n == 0:
		print(s, 1)
	elif n <= s:
		print(n, s + 1)
	else:
		print(s + 1, 2 * (s + 1) - n)


n = int(input())
for _ in range(n):
	x = 1
	a = 1
	i = 1
	num = int(input())
	while num >= x + a:
		x += a
		a += 2
		i += 1
	m = num - x + 1
	if m <= i:
		print(m, ' ', i)
	else:
		print(i, ' ', i - (m - i))


d = {1: '1 1', 2: '1 2', 3: '2 2', 4: '2 1'}
from math import floor
for _ in range(int(input())):
	k = int(input())
	if k in {1, 2, 3, 4}:
		print(d[k])
		continue
	diag = floor(k ** 0.5) if not (k ** 0.5).is_integer() else int(k ** 0.5) - 1
	if diag * (diag + 1) + 1 > k:
		row = diag - (diag * (diag + 1) + 1 - k) + 1
		col = diag + 1
	elif diag * (diag + 1) + 1 < k:
		row = diag + 1
		col = diag - (k - diag * (diag + 1) - 1) + 1
	else:
		row = col = diag + 1
	print(row, col)


import math
for _ in range(int(input())):
	k = int(input())
	c = math.ceil(math.sqrt(k))
	d = c * c - k
	if d < c:
		print(c, d + 1)
	else:
		print(2 * c - 1 - d, c)


for _ in range(int(input())):
	k = int(input())
	r = round(k ** 0.5)
	if r * r < k:
		r += 1
	t = k - (r - 1) * (r - 1)
	if t < r:
		print(t, r)
	else:
		print(r, 2 * r - t)


def posOfN(n):
	t = int(n ** 0.5)
	if n == t ** 2:
		print(t, 1)
	elif n <= t * (t + 1):
		print(n - t ** 2, t + 1)
	else:
		print(t + 1, (t + 1) ** 2 - n + 1)
t = int(input())
for i in range(t):
	n = int(input())
	posOfN(n)


t = int(input())
for i in range(t):
	k = int(input())
	square = k ** 0.5
	if int(square) != square:
		square = int(square) + 1
	else:
		square = int(square)
	middle = 1
	plus = 2
	for i in range(square - 1):
		middle += plus
		plus += 2
	if k <= middle:
		print(square - (middle - k), square)
	else:
		print(square, square - (k - middle))


import math
trials = int(input())
for i in range(trials):
	num = int(input())
	rooted_num = math.sqrt(num)
	floored_num = math.floor(rooted_num)
	ceil_num = math.ceil(rooted_num)
	mid_num = ceil_num ** 2 - (ceil_num ** 2 - (floored_num ** 2 + 1)) / 2
	if floored_num == ceil_num:
		print(floored_num, 1)
	elif num <= mid_num:
		print(num - floored_num ** 2, ceil_num)
	else:
		print(ceil_num, ceil_num ** 2 - num + 1)


import math
cases = int(input())
for _ in range(cases):
	n = int(input())
	ring = math.ceil(math.sqrt(n))
	first_element = (ring - 1) * (ring - 1) + 1
	row = n - first_element + 1 if n < first_element + ring else ring
	column = ring if n < first_element + ring else ring * 2 - 1 - (n - first_element)
	print(row, column)


def func(n):
	i = int(n ** 0.5)
	val = n - i ** 2
	if not val:
		return [i, 1]
	if val - i <= 0:
		return [val, i + 1]
	else:
		return [i + 1, 2 * (i + 1) - val]

def main():
	loop = int(input())
	ns = []
	for _ in range(loop):
		ns.append(int(input()))
	for i in range(loop):
		(a, b) = func(ns[i])
		print(f'{a} {b}')
main()


import math
x = int(input())
for i in range(x):
	y = int(input())
	z = math.trunc(math.sqrt(y))
	w = z + 1
	if z * z == y:
		print(z, 1)
	elif y > z * z + z:
		v = z + 1
		u = w * w - y + 1
		print(v, u)
	else:
		u = z + 1
		v = y - z * z
		print(v, u)


n = int(input())
arr = []
for i in range(n):
	g = int(input())
	sqrtg = int(g ** 0.5) + 1
	sqg = int(sqrtg ** 2)
	y = sqrtg
	gg = sqg - g + 1
	if g ** 0.5 % 1 > 0:
		if gg > sqrtg:
			x = sqrtg - gg + sqrtg
			y = sqrtg
		else:
			x = sqrtg
			y = gg
	elif g ** 0.5 % 1 == 0:
		x = sqrtg - 1
		y = 1
		if g == 1:
			y = 1
	arr.append([x, y])
for i in range(n):
	print(arr[i][0], arr[i][1])


import math
t = int(input())
for i in range(t):
	k = int(input())
	a = math.ceil(pow(k, 0.5))
	if k > (a ** 2 + (a - 1) ** 2) / 2:
		print(a, a ** 2 - k + 1)
	else:
		print(k - (a - 1) ** 2, a)


import collections
import os
import sys
from datetime import date
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

def main():
	pass

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	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
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7
import math
import statistics
from bisect import bisect_right
for __ in range(int(input())):
	k = int(input())
	nos = math.ceil(math.sqrt(k))
	sqr = math.ceil(math.sqrt(k)) ** 2
	if sqr - k < nos:
		print(nos, sqr - k + 1)
	else:
		ele = sqr - k - (nos - 1)
		print(nos - ele, nos)


import math
t = int(input())
for _ in range(t):
	e = int(input())
	base = math.ceil(math.sqrt(e))
	nE = base * base - (base - 1) * (base - 1)
	mid = nE // 2
	total = base * base
	x = total - e
	if x <= mid:
		print(base, x + 1)
	else:
		r = nE - x
		print(r, base)


import math
t = int(input())
for i in range(t):
	num = int(input())
	k = math.sqrt(num)
	k = math.ceil(k)
	r = pow(k, 2) - (k - 1)
	if r > num:
		x = k - abs(r - num)
		y = k
	else:
		x = k
		y = k - abs(r - num)
	print(x, y)


test = int(input())
li = []
for i in range(test):
	n = int(input())
	li.append(n)
for i in range(test):
	n = li[i]
	if n ** 0.5 == int(n ** 0.5):
		print(int(n ** 0.5), 1)
	else:
		x = int(n ** 0.5)
		if n <= x ** 2 + x + 1:
			print(n - x ** 2, x + 1)
		else:
			print(x + 1, x + 1 - (n - (x ** 2 + x + 1)))


import math
for _ in range(int(input())):
	k = int(input())
	m = math.ceil(k ** 0.5)
	d_index = m ** 2 - m + 1
	if k > d_index:
		difference1 = k - d_index
		print(m, m - difference1)
	else:
		difference2 = d_index - k
		print(m - difference2, m)


import math
t = int(input())
for _ in range(t):
	k = int(input())
	if k == 2:
		print('1 2')
	else:
		temp = int(math.sqrt(k))
		k -= temp ** 2
		if k == 0:
			print(f'{temp} {1}')
		elif k < temp + 1:
			print(f'{k} {temp + 1}')
		else:
			print(f'{temp + 1} {min(k, 2 * temp + 2 - k)}')


for _ in range(int(input())):
	n = int(input())
	t = int(n ** 0.5)
	p = n - t ** 2
	if p == 0:
		print(t, 1)
		continue
	k = t + 1
	if p == k:
		print(p, p)
	elif p < k:
		print(p, t + 1)
	else:
		print(k, (t + 1) ** 2 - n + 1)


for _ in range(int(input())):
	n = int(input())
	tmp = 0
	p = 0
	for i in range(1, n + 1):
		tmp = i * i
		p = i
		if tmp >= n:
			break
	res_i = p
	res_j = 1
	if tmp - n == 0:
		print(str(res_i) + ' ' + str(res_j))
	elif tmp - n < p:
		print(str(res_i) + ' ' + str(res_j + (tmp - n)))
	else:
		tmp -= p
		tmp += 1
		res_i = p
		res_j = p
		for i in range(1, p + 1):
			if tmp == n:
				print(str(res_i) + ' ' + str(res_j))
				break
			tmp -= 1
			res_i -= 1


from math import ceil, floor
for _ in range(int(input())):
	k = int(input())
	t1 = ceil(k ** 0.5)
	t2 = floor(k ** 0.5) ** 2
	if k - t2 == 0:
		print(t1, 1)
	elif k - t2 <= t1:
		print(k - t2, t1)
	else:
		t = t1 * t1
		print(t1, t - k + 1)


from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
from math import factorial as f, ceil, gcd, sqrt, log
from sys import stdin, stdout
input = stdin.readline
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
mt = lambda r: [ls() for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)
for _ in range(it()):
	a = it()
	if a == 1:
		print(1, 1)
	else:
		i = 1
		j = 1
		while i ** 2 < a:
			i += 1
			j += 2
		rem = a - (i - 1) ** 2
		if rem == (j + 1) // 2:
			print(i, i)
		elif rem <= (j + 1) // 2:
			print(rem, i)
		else:
			rem -= j // 2
			print(i, i - rem + 1)


for _ in range(int(input())):
	k = int(input())
	x = int(k ** 0.5)
	if x * x == k:
		print(x, 1)
		continue
	rem = k - x ** 2
	if rem <= x + 1:
		print(rem, x + 1)
	else:
		rem -= x + 1
		print(x + 1, x + 1 - rem)


import math
rr = input
rri = lambda : int(rr())
rrm = lambda : list(map(int, rr().split()))
T = rri()

def solve():
	n = rri()
	root = int(math.sqrt(n))
	if root * root == n:
		return (root, 1)
	diff = n - root * root
	if diff <= root + 1:
		return (diff, root + 1)
	else:
		diff -= root + 1
		return (root + 1, root + 1 - diff)
for t in range(T):
	ans = solve()
	print(str(ans[0]) + ' ' + str(ans[1]))


import math
t = int(input())
for _ in range(t):
	k = int(input())
	x = k ** 0.5
	l = int(x)
	h = math.ceil(x)
	if l == h:
		print(l, 1)
	else:
		a = min(h, k - l * l)
		b = min(h, h * h - k + 1)
		print(a, b)


t = int(input())
for _ in range(t):
	k = int(input())
	n = int(k ** 0.5) + 1
	r = n
	c = n
	if k == (n - 1) ** 2:
		r = n - 1
		c = 1
	elif k > n ** 2 - n + 1:
		c = n ** 2 - k + 1
	elif k < n ** 2 - n + 1:
		r = k - (n - 1) ** 2
	print(f'{r} {c}')


from math import floor, sqrt
for _ in range(int(input())):
	Num = int(input())
	val = floor(sqrt(Num))
	if val ** 2 == Num:
		print(val, 1)
	else:
		N = val ** 2 + 1
		if Num >= N and Num <= N + val:
			print(Num - N + 1, val + 1)
		else:
			print(val + 1, (val + 1) ** 2 - Num + 1)


def f(n):
	if int(n ** 0.5) ** 2 == n:
		return True
	else:
		return False
n = int(input())
lis = []
for i in range(n):
	lis.append(int(input()))

def infin(n):
	if n > 4:
		a = ((int(n ** 0.5) + 1) ** 2 + int(n ** 0.5) ** 2 + 1) // 2
		if n > a and (not f(n)):
			print(int(n ** 0.5) + 1, (int(n ** 0.5) + 1) ** 2 - n + 1)
		elif n == a:
			print(int(n ** 0.5) + 1, int(n ** 0.5) + 1)
		elif n < a and (not f(n)):
			print(n - int(n ** 0.5) ** 2, int(n ** 0.5) + 1)
		elif f(n):
			print(int(n ** 0.5), 1)
		elif n < a and f(n - 1):
			print(1, int(n ** 0.5) + 1)
	elif 1 <= n <= 4:
		if n == 1:
			print(1, 1)
		elif n == 2:
			print(1, 2)
		elif n == 3:
			print(2, 2)
		elif n == 4:
			print(2, 1)
for i in lis:
	infin(i)


from sys import path_hooks, stdin, stdout
from collections import Counter, deque
import math
from copy import deepcopy
import random
import heapq
import sys
sys.setrecursionlimit(10 ** 5)

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

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

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

def intinput():
	return int(stdin.readline().strip())

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

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 * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans
coprime1 = {6: 100003, 5: 10007, 4: 1009, 3: 101, 2: 11, 1: 2, 7: 1000003, 8: 10000019, 9: 100000007}
coprime2 = {8: 10000169, 9: 100000049, 7: 1000033, 6: 100019, 5: 10009, 4: 1013, 3: 103, 2: 13, 1: 3}

def writ(ss):
	stdout.write(str(ss) + '\n')
mod = 10 ** 9 + 7

def sumn(n):
	return n * (n + 1) // 2
for test in range(intinput()):

	def solve():
		n = intinput()
		aa = 0
		prev = 0
		for i in range(1, 40000):
			prev = aa
			aa = i * i
			if aa >= n:
				break
		new = aa - prev
		x = min(n - prev, (new >> 1) + 1)
		y = min(aa - n + 1, (new >> 1) + 1)
		print(x, y)
	solve()


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print('1 1')
	elif n == 2:
		print('1 2')
	elif n == 3:
		print('2 2')
	elif n == 4:
		print('2 1')
	elif n == 8:
		print('3 2')
	elif n == 9:
		print('3 1')
	else:
		z = int(math.sqrt(n - 1)) ** 2
		m = n % z
		y = int(math.sqrt(z))
		if m <= y:
			column = y + 1
			row = m
		else:
			row = y + 1
			column = y + 1 - (m - y - 1)
		print(str(row) + ' ' + str(column))


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ans = math.ceil(math.sqrt(n))
	res = math.floor(math.sqrt(n))
	res *= res
	if n - res == 0:
		print(ans, 1)
	elif n - res <= ans:
		print(n - res, ans)
	else:
		akh = ans * ans
		print(ans, akh - n + 1)


from math import ceil

def solve():
	n = int(input())
	layer = ceil(n ** 0.5)
	middle = layer ** 2 - layer + 1
	if n <= middle:
		print(layer - middle + n, layer)
	else:
		print(layer, layer - n + middle)
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	n = int(input())
	r = int(n ** (1 / 2))
	c = 0
	if r ** 2 == n:
		print(r, 1)
	else:
		n -= r ** 2
		x = r
		c = r + 1
		r = 1
		n -= 1
		k = min(x, n)
		r += k
		n -= k
		c -= min(x, n)
		print(r, c)


import math
for i in range(int(input())):
	d = 0
	k = int(input())
	r = math.sqrt(k)
	if int(r + 0.5) ** 2 == k:
		r = int(r)
		d = 1
	else:
		r = math.ceil(r)
		c = r - 1
		c = c ** 2
		r = r ** 2
		g = math.ceil((r + c) / 2)
		d = 0
	if d == 1:
		print(r, 1)
	elif k > g:
		print(int(math.sqrt(r)), r - k + 1)
	elif k < g:
		print(k - c, int(math.sqrt(r)))
	else:
		print(int(math.sqrt(r)), int(math.sqrt(r)))


def solve(k):
	n = 0
	d_val = 1
	while True:
		if d_val == k:
			return (n + 1, n + 1)
		if d_val > k:
			return (n - (d_val - k) + 1, n + 1)
		if d_val + n >= k:
			return (n + 1, n - (k - d_val) + 1)
		d_val += n + n + 2
		n += 1
	return -1
for _ in range(int(input())):
	(row, column) = solve(int(input()))
	print(row, column)


import math
from collections import OrderedDict
t = int(input())
while t > 0:
	k = int(input())
	sr = math.sqrt(k)
	if sr % 1 == 0:
		print(int(sr), 1)
	else:
		low = int(sr)
		high = low + 1
		r = high
		c = high
		low = low ** 2 + 1
		high = high ** 2
		mid = (low + high) // 2
		if k == mid:
			print(r, r)
		elif k >= low and k < mid:
			print(r - (mid - k), c)
		else:
			print(r, c - (k - mid))
	t -= 1


t = int(input())
while t:
	k = int(input())
	from math import ceil
	x = ceil(k ** 0.5)
	mid = x ** 2 + 1 - x
	i = -1
	j = -1
	if k > mid:
		if x % 2 == 0:
			i = x - (k - mid)
			j = x
		else:
			j = x
			i = x - (k - mid)
	elif k < mid:
		if x % 2 == 1:
			j = x - (mid - k)
			i = x
		else:
			i = x
			j = x - (mid - k)
	else:
		i = x
		j = x
	print(j, i)
	t = t - 1


import math
for t in range(int(input())):
	k = int(input())
	a = math.sqrt(k)
	if a == int(a):
		print(str(int(a)) + ' ' + '1')
	else:
		b = k - int(a) ** 2
		if b <= int(a) + 1:
			print(str(b) + ' ' + str(int(a) + 1))
		else:
			print(str(int(a) + 1) + ' ' + str(2 * int(a) + 2 - b))


import math
p = int(input())
while p:
	n = int(input())
	if math.sqrt(n) % 1 == 0:
		x = int(math.sqrt(n)) - 1
		y = x + 1
	else:
		x = int(math.sqrt(n))
		y = x + 1
	a = x * x
	b = y * y
	c = n - a
	if n == a:
		print(x, end=' ')
		print(1)
	elif n == b:
		print(y, end=' ')
		print(1)
	else:
		d = (b - a) // 2
		e = d + 1
		if c <= d:
			l = c
			m = y
		else:
			l = y
			m = y - c + e
		print(l, end=' ')
		print(m)
	p -= 1


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	a = int(sqrt(n - 1))
	b = n - a * a
	if b < a + 1:
		print(b, a + 1)
	else:
		print(a + 1, 2 * a + 2 - b)


def check(n):
	if n ** 0.5 == int(n ** 0.5):
		b = int(n ** 0.5)
		a = 1
	else:
		a = int(n ** 0.5) + 1
		b = n - (a - 1) ** 2
		if b > a:
			(a, b) = (a - (b - a), a)
	print(b, a)
for _ in range(int(input())):
	n = int(input())
	check(n)


N = int(input())
cot = 1
A = [1]
for i in range(10 ** 5):
	A.append(A[-1] + cot)
	cot += 2
for j in range(N):
	K = int(input())
	for i in range(10 ** 5):
		if A[i] > K:
			half = i - 1
			if A[i] - half <= K:
				y = i
				x = A[i] - K - 1 + 1
			elif A[i] - half * 2 <= K:
				x = i
				y = i - (A[i] - half - K - 1)
			else:
				y = 1
				x = i
			print(y, x)
			break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	row = math.ceil(math.sqrt(n)) // 1
	start = row ** 2
	flag = 1
	for i in range(row - 1):
		if start == n:
			print(row, i + 1)
			flag = 0
			break
		start -= 1
	if flag:
		for i in range(row, 0, -1):
			if start == n:
				print(i, row)
				break
			start -= 1


import math
z = int(input())
for _ in range(z):
	n = int(input())
	row = math.ceil(math.sqrt(n))
	(r, c) = (-1, -1)
	elem = (row - 1) ** 2
	el = row * row
	dif = n - elem
	k = elem + row
	if n == k:
		col = row
	elif n < k:
		col = row
		row = dif % row
	else:
		col = el - n + 1
	print(row, col)


n = int(input())
for i in range(n):
	x = int(input())
	root = int(x ** 0.5)
	x = x - root * root
	if x == 0:
		print(root, 1)
	elif x <= root + 1:
		print(x, root + 1)
	else:
		print(root + 1, 2 * root + 2 - x)


t = int(input())
for i in range(t):
	k = int(input())
	if int(k ** 0.5) ** 2 == k:
		print(int(k ** 0.5), 1)
	else:
		a = int(k ** 0.5) + 1
		b = a ** 2 - a + 1
		if k == b:
			print(a, a)
		elif k > b:
			print(a, a - (k - b))
		else:
			print(a - (b - k), a)


from math import ceil, sqrt
for _ in range(int(input())):
	k = int(input())
	b = ceil(sqrt(k))
	s = (b - 1) ** 2 + 1
	m = s + b - 1
	e = b ** 2
	if k <= m:
		print(k - s + 1, b)
	else:
		print(b, e - k + 1)


from math import sqrt
import math
import time

def index(input):
	temp = sqrt(input - 1) + 1
	(frac, whole) = math.modf(temp)
	column = int(temp)
	ori = column
	row = 1
	colVal = (column - 1) ** 2 + 1
	bound = colVal + (column - 1)
	if input > bound:
		column = column - (input - bound)
	if frac != 0.0:
		if input < bound:
			row = input - colVal + 1
		else:
			row = ori
	return (row, column)
size = int(input())
keyboard = []
while size > 0:
	keyboard.append(int(input()))
	size = size - 1
for i in keyboard:
	(r, c) = index(i)
	print(r, c)


import sys
input = lambda : sys.stdin.readline().rstrip()
from bisect import bisect_left as bl, bisect_right as br
num = 1
ad = 2
a = [1]
far = 10 ** 9
while num < far:
	num += ad
	a.append(num)
	ad += 2
for _ in range(int(input())):
	k = int(input())
	ind = bl(a, k)
	if k == a[ind]:
		print(ind + 1, ind + 1)
	else:
		l = a[ind - 1]
		h = a[ind]
		dif = k - l
		if dif < ind:
			print(ind, ind - dif)
		else:
			print(dif - ind + 1, ind + 1)


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def dadd(d, p, val):
	if p in d:
		d[p].append(val)
	else:
		d[p] = [val]

def gi():
	return [xx for xx in input().split()]

def gtc(tc, *ans):
	print('Case #' + str(tc) + ':', *ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def bits(i, n):
	p = bin(i)[2:]
	return (n - len(p)) * '0' + p

def prec(a, pre):
	for i in a:
		pre.append(pre[-1] + i)
	pre.pop(0)

def YN(flag):
	print('YES' if flag else 'NO')

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
INF = 10 ** 18
uu = t
mod = 10 ** 9 + 7
while t > 0:
	t -= 1
	n = fi()
	l = ans = 0
	r = 10 ** 5
	while l <= r:
		mid = (l + r) // 2
		if mid ** 2 < n:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	n -= ans ** 2
	ans += 1
	if n <= ans:
		print(n, ans)
	else:
		print(ans, 2 * ans - n)


import math
t = int(input())
for k in range(t):
	k = int(input())
	n = int(math.sqrt(k))
	d = k - n * n
	if d == 0:
		print(n, 1)
	elif d <= n + 1:
		print(d, n + 1)
	else:
		print(n + 1, 2 * (n + 1) - d)


import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	l = math.ceil(n ** 0.5)
	a = l ** 2 - l + 1
	if n > a:
		r = l
		c = l + a - n
	elif n < a:
		r = l + n - a
		c = l
	else:
		r = l
		c = l
	print(r, c)


t = int(input())
while t > 0:
	t -= 1
	k = int(input())
	a = k ** 0.5
	a = int(a)
	b = a + 1
	asq = a ** 2
	if a * a == k:
		print(a, 1)
	elif k <= asq + a:
		print(k - asq, b)
	else:
		print(b, b ** 2 - k + 1)


t = int(input())
for u in range(t):
	(n, dau, cuoi, giua, k, pos) = (int(input()), 1, 1, 1, 1, 1)
	if n == 1:
		print('1 1')
	else:
		while cuoi < n:
			(cuoi, dau, k, pos) = (cuoi + k + 2, dau + k, k + 2, pos + 1)
		giua = (cuoi + dau) // 2
		if n < giua:
			print(pos - giua + n, pos)
		else:
			print(pos, pos - n + giua)


t = int(input())
import math

def find_range(n):
	left = int(math.sqrt(n))
	right = left + 1
	left_sqr = left * left
	right_sqr = right * right
	if left_sqr == n:
		print(left, 1)
		return
	if n - left_sqr < right_sqr - n:
		column_coord = left + 1
		row_coord = n - left_sqr
	else:
		row_coord = right
		column_coord = right_sqr - n + 1
	print(row_coord, column_coord)
for _ in range(t):
	n = int(input())
	find_range(n)


for _ in range(int(input())):
	n = int(input())
	i = 1
	while i * i < n:
		i += 1
	if n > i * i - i + 1:
		print(i, i * i - n + 1)
	elif n < i * i - i + 1:
		print(n - (i - 1) * (i - 1), i)
	else:
		print(i, i)


from collections import Counter
from itertools import accumulate, product, groupby
import operator
import math
from functools import reduce

def solve():
	k = int(input())
	layer = math.ceil(k ** 0.5)
	tn = 1 + (layer - 1) * 2
	tn_minus_one = tn - 2
	sn_minus_one = int(0.5 * (layer - 1) * (1 + tn_minus_one))
	start = sn_minus_one + 1
	left = k - start
	if left == layer - 1:
		(x, y) = (layer, layer)
	elif left < layer - 1:
		y = layer
		x = 1 + left
	else:
		x = layer
		y = layer - 1 - (left - layer + 1) + 1
	return [x, y]
for _ in range(int(input())):
	print(*solve())


from math import sqrt
for tt in range(int(input())):
	k = int(input())
	nk = int(sqrt(k))
	if k == nk ** 2:
		print(nk, 1)
		continue
	below = nk ** 2
	nk += 1
	diff = k - below
	if diff <= nk:
		print(diff, nk)
	else:
		diff -= nk
		print(nk, nk - diff)


from math import sqrt
t = int(input())
while t:
	t -= 1
	n = int(input())
	x = int(sqrt(n))
	if x * x == n:
		print(x, 1)
	else:
		x += 1
		val_at_pair = x * x - x + 1
		if n > val_at_pair:
			print(x, x - (n - val_at_pair))
		elif n < val_at_pair:
			print(x - (val_at_pair - n), x)
		else:
			print(x, x)


t = int(input())
for _ in range(t):
	k = int(input())
	i = 1
	while i * i < k:
		i += 1
	if k >= i * i - i + 1:
		print(i, i * i - k + 1)
	else:
		print(k - (i - 1) * (i - 1), i)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	x = int(n ** (1 / 2))
	a = n - x * x
	if a == 0:
		print(x, 1)
		continue
	x += 1
	if a <= x:
		print(a, x)
	else:
		print(x, x * 2 - a)


import math
for _ in range(int(input())):
	n = int(input())
	sr = round(math.sqrt(n))
	sq = sr ** 2
	if n == sq:
		print(sr, 1)
		continue
	if n < sq:
		print(sr, sq - n + 1)
	else:
		print(n - sq, sr + 1)


import math
import sys
from math import sqrt
from collections import defaultdict
from collections import Counter
import string
from collections import deque
from functools import cmp_to_key
import bisect
from collections import OrderedDict
import heapq as hq
from queue import PriorityQueue
MOD = 10 ** 9 + 7

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

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

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

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

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

def dparr(m, n):
	return [[0] * n for i in range(m)]
t = ii()
arr = []
for _ in range(t):
	n = ii()
	xi = xj = int(sqrt(n))
	if xi * xj != n:
		xi += 1
		xj += 1
	c = xi * xj - (xi - 1)
	if c == n:
		print(xi, xj)
	elif n < c:
		while n != c:
			c -= 1
			xi -= 1
		print(xi, xj)
	else:
		while n != c:
			c += 1
			xj -= 1
		print(xi, xj)


import math

def cast(cre, typ):
	return type(typ)(map(cre, typ))

def inp_lis(cre):
	if cre == str:
		return input().split()
	elif cre == bool:
		return cast(bool, cast(int, input().split()))
	else:
		return cast(cre, input().split())

def repl(str_, idx=-1, char=''):
	leng = len(str_)
	return str_[:idx] + char + str_[(leng + idx) % leng + 1:]

def solution():
	for t in range(int(input())):
		k = int(input())
		(r, c) = (1, 1)
		(to_right, to_up) = (0, 0)
		k_sqt_high = -int(math.sqrt(k) // -1)
		if k != 1:
			remain = abs(k - k_sqt_high ** 2)
			length = k_sqt_high - 1
			to_right = remain % length
			if remain // length >= 1:
				to_right = length
				to_up = remain % length
				if remain // length >= 2:
					to_up = length
			r = k_sqt_high - to_up
			c += to_right
		print('{0:} {1:}'.format(r, c))
	return
solution()


import math

def finding_position(content):
	y = math.sqrt(content)
	z = int(y)
	if z == y:
		i = z
		j = 1
	elif content <= z * z + z:
		j = z + 1
		i = content - z * z
	else:
		i = z + 1
		j = (z + 1) ** 2 - content + 1
	print(i, j)
t = int(input())
content_list = []
for k in range(t):
	table_content_list = input().split()
	for i in table_content_list:
		table_content = int(i)
		content_list.append(table_content)
for content in content_list:
	finding_position(content)


t = int(input())
for i in range(t):
	k = int(input())
	nearest_square = 0
	while nearest_square ** 2 < k:
		nearest_square += 1
	(row, col) = (nearest_square - 1, nearest_square - 1)
	lower = (nearest_square - 1) ** 2 + 1
	upper = nearest_square ** 2
	middle = (lower + upper) // 2
	if k < middle:
		row -= middle - k
	elif k > middle:
		col -= k - middle
	print(row + 1, col + 1)


import math

def solve():
	k = int(input())
	s = 1
	while s * s <= k:
		s += 1
	s -= 1
	last = s * s
	remains = k - last
	if remains == 0:
		print(s, 1)
		return
	if remains - s <= 0:
		print(remains, s + 1)
		return
	if remains - s > 0:
		print(s + 1, s + 1 - (remains - s) + 1)
		return
t = int(input())
while t > 0:
	t -= 1
	solve()


import math

def result(a):
	t = math.floor(math.sqrt(a))
	if t ** 2 == a:
		print(t, 1)
	else:
		v = (2 * (t + 1) - 1) // 2
		lef = a - t ** 2
		if lef < v + 1:
			print(lef, t + 1)
		elif lef == v + 1:
			print(t + 1, t + 1)
		else:
			dia = t ** 2 + v + 1
			fi = t + 1 - (a - dia)
			print(t + 1, fi)
for i in range(int(input())):
	result(int(input()))


import math
for _ in range(int(input())):
	k = int(input())
	u = math.ceil(math.sqrt(k))
	d = math.floor(math.sqrt(k))
	if u == d:
		print(u, 1)
	elif k - d ** 2 - 1 < u:
		print(k - d ** 2, u)
	else:
		print(u, u ** 2 - k + 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(1, n)
		continue
	rows = math.ceil(math.sqrt(n))
	(i, j) = (rows, 1)
	num = pow(rows, 2)
	flag = 0
	for k in range(rows - 1):
		if num == n:
			print(i, j)
			flag = 1
		j += 1
		num -= 1
	if flag:
		continue
	for k in range(rows):
		if num == n:
			print(i, j)
			flag = 1
		i -= 1
		num -= 1
	if flag:
		continue


t = int(input())
arr = []
s = 0
i = 1
while s < 10 ** 9:
	arr.append(i)
	s += i
	i += 2
	if len(arr) > 1:
		arr[-1] += arr[-2]

def bs_first_greater(arr, start, end, val):
	while start <= end:
		mid = (start + end) // 2
		if arr[mid] > val:
			if mid == start:
				return mid
			elif arr[mid - 1] <= val:
				return mid
			else:
				end = mid - 1
		else:
			start = mid + 1
	return -1
while t:
	t -= 1
	n = int(input())
	row = bs_first_greater(arr, 0, len(arr) - 1, n - 1)
	curr = arr[row]
	rleft = 1
	while curr != n:
		curr -= 1
		rleft += 1
	if rleft <= row + 1:
		print(row + 1, rleft)
	else:
		l = rleft - row
		print(row + 2 - l, row + 1)


from math import *
for i in range(int(input())):
	k = int(input())
	sqrt1 = int(sqrt(k))
	sqrt2 = sqrt1 + 1
	if sqrt(k) - sqrt1 == 0:
		print(sqrt1, 1)
	else:
		dif = k - sqrt1 ** 2
		if dif < sqrt2:
			print(dif, sqrt2)
		elif dif > sqrt2:
			print(sqrt2, sqrt2 ** 2 - k + 1)
		else:
			print(sqrt2, sqrt2)


from math import *
while True:
	try:
		t = eval(input())
		for i in range(t):
			k = eval(input())
			if k == 1:
				print(1, 1)
			else:
				t = ceil(sqrt(k))
				mid = t ** 2 - t + 1
				if k < mid:
					print(t - mid + k, t)
				else:
					print(t, t ** 2 - k + 1)
	except:
		break


from io import BytesIO
from os import read, fstat
input = BytesIO(read(0, fstat(0).st_size)).readline
import sys
ff = []
for i in range(31624):
	ff.append(i ** 2)

def solve_tc(ff):
	n = int(input())
	for i in range(len(ff)):
		if ff[i] >= n:
			if ff[i] - i + 1 > n:
				return str(i - (ff[i] - i + 1 - n)) + ' ' + str(i)
			else:
				return str(i) + ' ' + str(ff[i] - n + 1)
t = int(input())
for _ in range(t):
	sys.stdout.write(str(solve_tc(ff)) + '\n')


t = int(input())
cases = []
for i in range(t):
	cases.append(int(input()))

def answer(n):
	sqr = (int(n ** 0.5) + 1) ** 2
	rt = int(sqr ** 0.5)
	diff = n - (rt - 1) ** 2
	if diff == 0:
		return (rt - 1, 1)
	if diff <= rt:
		return (diff, rt)
	else:
		return (rt, 2 * rt - diff)
for i in cases:
	print(*answer(i))


casos = int(input())
cont = 0
while cont != casos:
	cont += 1
	num = int(input())
	if num ** 0.5 % 1 == 0:
		cont2 = int(1 + num ** 0.5)
	if num ** 0.5 % 1 != 0:
		cont2 = int(1 + num ** 0.5) + 1
	anterior = (cont2 - 1) ** 2 - 2 * (cont2 - 1) + 1
	funcion = cont2 ** 2 - 2 * cont2 + 1
	cont4 = num - anterior
	if cont4 > (funcion - anterior) // 2 + 1:
		y = cont2 - 1
		i = anterior + cont2 - 1
		x = num - i
		print(str(y) + ' ' + str(cont2 - 1 - x))
	else:
		x = cont2 - 1
		y = num - anterior
		print(str(y) + ' ' + str(x))


for _ in range(int(input())):
	k = int(input())
	sr = int((k - 1) ** 0.5)
	r = k - sr * sr
	if r <= sr:
		print(r, sr + 1)
	else:
		print(sr + 1, sr + sr + 2 - r)


for _ in range(int(input())):
	n = int(input())
	a = int(n ** 0.5)
	b = a ** 2
	c = n - b
	if not c:
		print(a, 1)
	elif c <= a:
		print(c, a + 1)
	else:
		print(a + 1, 2 * a + 2 - c)


import math
tests = int(input())
for _ in range(tests):
	m = int(input())
	sqt = int(math.sqrt(m))
	remain = m - sqt ** 2
	if not remain:
		print(sqt, 1)
	else:
		sqt += 1
		if remain < sqt:
			print(remain, sqt)
		else:
			print(sqt, 2 * sqt - remain)


def getLayer(num):
	return int((num - 1) ** 0.5)
for _ in range(int(input())):
	k = int(input())
	x = getLayer(k)
	xsquare = x * x
	row = 1
	col = x + 1
	if k > xsquare:
		row = k - xsquare
	if row > x + 1:
		col = 2 * (x + 1) - row
		row = x + 1
	print(row, col)


def fuck(x):
	for i in range(1, 99999):
		if i * i >= x:
			l = i - 1
			x -= l * l
			if x <= l:
				return (x, l + 1)
			else:
				return (l + 1, i * i - x - l * l + 1)
for i in range(0, int(input())):
	(a, b) = fuck(int(input()))
	print(a, b)


n = int(input())
for i in range(n):
	x = int(input())
	mn = int(x ** 0.5)
	mx = int(x ** 0.5) + 1
	if x == int(x ** 0.5) ** 2:
		print(int(x ** 0.5), 1)
		continue
	if x - (mn ** 2 + 1) < mx:
		ans_x = x - mn ** 2
		ans_y = mx
	else:
		ans_x = mx
		ans_y = 1 + (mx ** 2 - x)
	print(ans_x, ans_y)


from sys import stdin
import bisect
a = []
for i in range(1, 100001):
	a.append(i * i)

def find_lt(a, x):
	idx = bisect.bisect_left(a, x)
	if a[idx] == x:
		return (idx + 1, a[idx])
	return (idx + 1, a[idx - 1])
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	(idx, val) = find_lt(a, n)
	size = idx
	if n == val:
		print(size, 1)
	elif n - val < size:
		print(n - val, size)
	elif n - val > size:
		print(size, size - (n - val) % size)
	else:
		print(size, size)


import math
n = int(input())
for _ in range(n):
	s = int(input())
	prev_layer = math.floor(math.sqrt(s - 1))
	next_layer = math.ceil(math.sqrt(s))
	first = prev_layer ** 2 + 1
	last = next_layer ** 2
	mid = int((first + last) / 2)
	if s > mid:
		print(next_layer, next_layer - s + mid)
	elif s < mid:
		print(next_layer - mid + s, next_layer)
	else:
		print(next_layer, next_layer)


import math
for _ in range(int(input())):
	k = int(input())
	a = int(k ** 0.5)
	if a ** 2 == k:
		print(int(k ** 0.5), 1)
	elif k > a ** 2 + (2 * a + 1) // 2:
		print(a + 1, (a + 1) ** 2 - k + 1)
	else:
		print(k - a ** 2, a + 1)


import math

def solve():
	n = int(input())
	row = math.ceil(math.sqrt(n))
	(r, c) = (-1, -1)
	element = (row - 1) ** 2
	ele = row * row
	diff = n - element
	k = element + row
	if n == k:
		col = row
	elif n < k:
		col = row
		row = diff % row
	else:
		col = ele - n + 1
	print(row, col)
t = int(input())
while t:
	solve()
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	k = math.ceil(n ** 0.5)
	x = k ** 2 - k + 1
	if n > x:
		row = k
		col = k ** 2 - n + 1
	elif n < x:
		col = k
		row = n - ((k - 1) ** 2 + 1) + 1
	else:
		col = k
		row = k
	print(row, col)


import sys
import math
from math import factorial, inf, gcd, sqrt
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
from bisect import *
import random
from sys import stdin, stdout
sys.setrecursionlimit(10 ** 5)

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

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

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

def lmp():
	return list(mp())
ti = int(input())
for i in range(ti):
	n = iinp()
	m = int(sqrt(n))
	if m * m == n:
		print(m, 1)
	else:
		k = n - m * m
		if k <= m + 1:
			print(k, m + 1)
		else:
			k -= m
			print(m + 1, m + 2 - k)


n2 = int(input())
while n2:
	n = int(input())
	x = 1
	while x * x < n:
		x += 1
	if x * x - n < x:
		row = x
		col = x * x - n + 1
	else:
		col = x
		z = x * x - x + 1
		row = x - (z - n)
	print('{} {}'.format(row, col))
	n2 -= 1


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

def si():
	return input().rstrip()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def solve():
	for _ in range(1, ii() + 1):
		n = ii()
		x = ceil(sqrt(n))
		x1 = int(sqrt(n))
		n -= x1 * x1
		if n == 0:
			print(x, 1)
		elif n <= x:
			print(n, x)
		else:
			n -= x
			print(x, x - n)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


import math
for t in range(int(input())):
	n = int(input())
	ans = int(math.ceil(math.sqrt(n)))
	res = int(math.sqrt(n))
	res *= res
	if n - res == 0:
		print(ans, 1)
	elif n - res <= ans:
		print(n - res, ans)
	else:
		ptr = ans * ans
		print(ans, ptr - n + 1)


from math import ceil, sqrt
for _ in range(int(input())):
	k = int(input())
	a = sqrt(k)
	if ceil(a) - a > 0.5:
		b = abs(int(a) ** 2 - k)
		c = ceil(a)
	else:
		b = ceil(sqrt(k))
		c = b * b - k + 1
	print(b, c)


def get_row_col(k):
	n = int(k ** 0.5)
	if k == 1:
		return (1, 1)
	num = (n - 1) ** 2
	while num != k:
		(row, col) = (1, n)
		while row <= n:
			num += 1
			if num == k:
				return (row, col)
			row += 1
		row -= 1
		col -= 1
		while col > 0:
			num += 1
			if num == k:
				return (row, col)
			col -= 1
		n += 1
t = int(input())
inp = []
for _ in range(t):
	inp.append(int(input()))
for val in inp:
	ans = get_row_col(val)
	print(ans[0], ans[1])


import math
testCases = int(input())
for a in range(testCases):
	cellNumber = int(input())
	local = 0
	sideLength = 0
	numberLeft = cellNumber
	for i in range(int(math.sqrt(cellNumber)), -1, -1):
		if cellNumber - i ** 2 > 0:
			local = i ** 2
			sideLength = i + 1
			break
	numberLeft -= local

	def calculatePosition():
		pos = [0, 0]
		if numberLeft <= sideLength:
			pos[1] = str(sideLength)
			pos[0] = str(numberLeft)
		else:
			pos[1] = str(sideLength - (numberLeft - sideLength))
			pos[0] = str(sideLength)
		return ' '.join(pos)
	print(calculatePosition())


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = math.sqrt(n)
	if s == int(s):
		print(int(s), 1)
	else:
		k = int(s)
		x = n - k * k
		if x > k + 1:
			a = k + 1
			b = 1 + ((k + 1) * (k + 1) - n)
		else:
			a = n - k * k
			b = k + 1
		print(a, b)


for i in range(int(input())):
	n = int(input())
	a = int((n - 1) ** 0.5)
	if n - a * a <= a + 1:
		print(n - a * a, a + 1)
	else:
		print(a + 1, (a + 1) ** 2 - n + 1)


for t in range(int(input())):
	n = int(input())
	k = round(n ** 0.5 + 0.499999999)
	c = k ** 2 - (k - 1)
	if n > c:
		print(k, k ** 2 - n + 1)
	elif n < c:
		print(k - (c - n), k)
	else:
		print(k, k)


import math
n1 = int(input())
for q in range(n1):
	s = 1
	m = -1
	n = -1
	n2 = int(input())
	if n2 == 1:
		print(1, 1)
		continue
	k = math.ceil(math.sqrt(n2))
	if n2 > k * k - k + 1:
		m = k * k - n2 + 1
		n = k
	else:
		m = k
		n = n2 - math.pow(k - 1, 2)
	print(int(n), int(m))


import math
t = int(input())
for i in range(t):
	n = int(input())
	if math.sqrt(n) == int(math.sqrt(n)):
		print(int(math.sqrt(n)), 1)
	else:
		x = math.floor(math.sqrt(n))
		if n < x * x + x + 1:
			print(n - x * x, x + 1)
		else:
			print(x + 1, x + 1 - (n - (x * x + x + 1)))


from math import sqrt, floor
t = int(input())
for _ in range(t):
	k = int(input())
	prev = floor(sqrt(k))
	if k == prev ** 2:
		(r, c) = (prev, 1)
	else:
		(n, i) = ((prev + 1) ** 2 - prev ** 2, k - prev ** 2)
		(r, c) = (prev + 1, prev + 1 - i + n // 2 + 1) if i > n // 2 else (i, prev + 1)
	print(r, c)


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
from decimal import Decimal as BIGFLOAT
mod = 1000000007
MOD = mod
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

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

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False
t = int(input())
for tt in range(t):
	k = int(input())
	mc = math.ceil(math.sqrt(k))
	filled = (mc - 1) * (mc - 1)
	if filled + mc == k:
		print(mc, mc)
	elif filled + mc > k:
		print(mc - (filled + mc - k), mc)
	else:
		print(mc, mc - abs(mc + filled - k))


t = int(input())
for i in range(t):
	k = int(input())
	y = int(k ** 0.5)
	if y ** 2 == k:
		print(y, 1)
	else:
		y = y + 1
		if k >= y ** 2 - y + 1:
			i = y ** 2 - k
			print(y, i + 1)
		else:
			i = k - (y - 1) ** 2
			print(i, y)


import math
t = int(input())
for r in range(t):
	k = int(input())
	j = 0
	f = 0
	a = math.sqrt(k - 1) + 1
	j = int(a)
	if a * a == j:
		f = 1
	if f == 1 and k != 1:
		print(1, j + 1, sep=' ')
	else:
		q = j ** 2 - j + 1
		if k <= q:
			p = q - k
			i = j - p
			print(i, j, sep=' ')
		else:
			i = j
			j = i ** 2 - k + 1
			print(i, j, sep=' ')


from math import sqrt, log2
t = int(input())
mas = []
for i in range(t):
	v = int(input())
	mas.append(v)
for t in mas:
	if int(sqrt(t)) == sqrt(t):
		print(int(sqrt(t)), 1)
	else:
		i = int(sqrt(t)) + 1
		mid = int(i ** 2 - (i ** 2 - ((i - 1) ** 2 + 1)) / 2)
		if t < mid:
			print(t - (i - 1) ** 2, i)
		elif t > mid:
			print(i, i - (t - mid))
		else:
			print(i, i)


import string
import math
import sys
input = sys.stdin.buffer.readline
lowercase = string.ascii_lowercase
uppercase = string.ascii_uppercase
MOD = 1000000007

def preprocess():
	pass

def solve():
	k = int(input())
	iteration = math.ceil(math.sqrt(k))
	last_square = (iteration - 1) * (iteration - 1)
	row = 1
	col = 1
	if k > last_square + iteration:
		row = iteration
		col = iteration - (k - (last_square + iteration))
	else:
		col = iteration
		row = k - last_square
	print(row, col)
t = int(input())
while t > 0:
	solve()
	t -= 1


import math
t = int(input())
for i in range(t):
	k = int(input())
	num = math.ceil(math.sqrt(k))
	current = num ** 2
	row = num
	col = 1
	while col < num and current != k:
		col += 1
		current -= 1
	while row > 1 and current != k:
		row -= 1
		current -= 1
	print(row, col)


for _ in range(int(input())):
	k = int(input())
	n = 1
	cnt = 0
	while k - n > 0:
		k -= n
		n += 2
		cnt += 1
	if k == cnt + 1:
		print(cnt + 1, cnt + 1)
	elif k > cnt + 1:
		print(cnt + 1, cnt - (k - cnt - 2))
	else:
		print(k, cnt + 1)


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
MOD = 1000000007
PI = 3.141592653589793
I = lambda : int(input())
S = lambda : input()
M = lambda : map(int, input().split())
Ms = lambda : map(str, input().split())
ARR = lambda : list(map(int, input().split()))

def solve():
	k = I()
	root = int(mt.sqrt(k))
	if root * root < k:
		root += 1
	perfectSqr = root * root
	i = perfectSqr - k
	if i < root:
		print(root, i + 1)
	else:
		print(k - (root - 1) ** 2, root)
tc = I()
for _ in range(tc):
	solve()


from math import ceil
a = list((i ** 2 for i in range(1, 31624)))
for t in range(int(input())):
	k = int(input())
	for b in a:
		if b < k:
			continue
		else:
			p2 = b
			break
	p1 = a[a.index(p2) - 1]
	ind = ceil((p1 + p2) / 2)
	if k == 1:
		print(1, 1)
	elif k == ind:
		print(int(p2 ** 0.5), int(p2 ** 0.5))
	elif k < ind:
		print(k - p1, int(p2 ** 0.5))
	else:
		print(int(p2 ** 0.5), p2 - k + 1)


t = int(input())
for i in range(t):
	n = int(input())
	x = int(n ** 0.5)
	x += 1
	x2 = x * x
	if x - 1 == n ** 0.5:
		print(x - 1, 1)
	elif n >= x2 - x + 1:
		print(x, x2 - n + 1)
	else:
		print(n - (x - 1) * (x - 1), x)


from math import sqrt
for _ in range(int(input())):
	k = int(input())
	a = int(sqrt(k))
	if a * a == k:
		print(a, 1)
	else:
		a += 1
		m = a * (a - 1) + 1
		if k >= m:
			print(a, a + m - k)
		else:
			print(a + k - m, a)


for _ in range(int(input())):
	k = int(input())
	n = int(k ** 0.5)
	df = k - n * n
	if df == 0:
		print(n, 1)
	elif df <= n + 1:
		print(df, n + 1)
	elif df > n + 1:
		print(n + 1, 2 * (n + 1) - df)


import math
t = int(input())
op = []
for i in range(t):
	k = int(input())
	sr = int(math.sqrt(k))
	abs_sqr = sr * sr
	if abs_sqr == k:
		ans = ''
		ans += str(sr)
		ans += ' '
		ans += str(1)
		op.append(ans)
	else:
		col = 0
		row = 0
		max_col = int(sr) + 1
		max_row = int(sr) + 1
		new_sq = (sr + 1) * (sr + 1)
		centre = new_sq - int(sr)
		diff = abs(k - centre)
		if k > centre:
			row = max_row
			col = max_col - diff
		else:
			row = max_row - diff
			col = max_col
		ans = ''
		ans += str(row)
		ans += ' '
		ans = ans + str(col)
		op.append(ans)
for i in op:
	print(i)


import math
T = int(input())
for t in range(0, T):
	k = float(input())
	sqr = math.sqrt(k)
	isq = int(sqr)
	strt = isq ** 2 + 1
	end = (isq + 1) ** 2
	mid = strt + isq
	if sqr == isq:
		print(isq, 1)
	elif k == mid:
		print(isq + 1, isq + 1)
	elif k == strt:
		print(1, isq + 1)
	elif k > strt and k < mid:
		print(1 + int(k) - strt, isq + 1)
	elif k < end and k > mid:
		print(isq + 1, 1 + (end - int(k)))


for _ in range(int(input())):
	find = int(input())
	row = int((find - 1) ** 0.5)
	if find - row ** 2 <= row + 1:
		print(find - row ** 2, row + 1)
	else:
		print(row + 1, (row + 1) ** 2 - find + 1)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for ik in range(int(input())):
	k = int(input())
	sq = int(math.sqrt(k))
	if sq * sq == k:
		print(sq, 1)
		continue
	col = sq + 1
	diff = k - sq * sq
	if diff <= sq + 1:
		print(diff, col)
	else:
		diff -= sq + 1
		print(sq + 1, col - diff)


import math
import sys

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

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

def binarySearch(a, item, l, r):
	while l <= r:
		mid = (l + r) // 2
		if a[mid] == item:
			return mid
		if a[mid] < item:
			l = mid + 1
		else:
			r = mid - 1
	return -1

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

def _01knapsack(W, wt, p, n):
	k = [[0 for i in range(W + 1)] for i in range(n + 1)]
	for x in range(n + 1):
		for w in range(W + 1):
			if x == 0 or w == 0:
				k[x][w] = 0
			elif wt[x - 1] <= w:
				k[x][w] = max(k[x - 1][w], k[x - 1][w - wt[x - 1]] + p[x - 1])
			else:
				k[x][w] = k[x - 1][w]
	return k[n][W]
dp = [1]
for i in range(1, 100001):
	dp.append(dp[i - 1] + 2 * i)

def solve():
	n = int(input())
	idx = 0
	flag = 1
	for i in range(len(dp)):
		if n == dp[i]:
			print(i + 1, i + 1)
			flag = 0
			break
		if n < dp[i]:
			idx = i - 1
			break
	if flag == 1:
		if n > dp[idx] and n <= dp[idx] + idx:
			print(idx + 1, idx - n + dp[idx] + 1)
		else:
			idx += 1
			print(idx + n - dp[idx] + 1, idx + 1)
t = int(input())
for _ in range(t):
	solve()


import math
tc = int(input())
for i in range(tc):
	x = int(input())
	y = math.floor(x ** 0.5)
	if y == x ** 0.5:
		print(f'{int(x ** 0.5)} 1')
	elif x - y ** 2 < y + 1:
		print(f'{x - y ** 2} {int(y) + 1}')
	elif x - y ** 2 > y + 1:
		print(f'{int(y) + 1} {(y + 1) * 2 - (x - y ** 2)}')
	elif x - y ** 2 == y + 1:
		print(f'{int(y) + 1} {int(y) + 1}')


import os, sys
from io import BytesIO, IOBase

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, 8192))
			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, 8192))
			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')

class dict(dict):

	def __missing__(self, key):
		return 0
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda dtype: dtype(input().strip())
inp_d = lambda dtype: [dtype(x) for x in input().split()]
inp_2d = lambda dtype, n: [inp(dtype) for _ in range(n)]
inp_2ds = lambda dtype, n: [inp_d(dtype) for _ in range(n)]
inp_enu = lambda dtype: [(i, x) for (i, x) in enumerate(inp_d(dtype))]
inp_enus = lambda dtype, n: [[i] + [inp_d(dtype)] for i in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
for _ in range(inp(int)):
	(n, root) = (inp(int), 1)
	while root * root < n:
		root += 1
	(cur, r, c) = ((root - 1) ** 2 + 1, root, root)
	for i in range(1, root + 1):
		if cur == n:
			r = i
			break
		cur += 1
	else:
		for i in range(root - 1, 0, -1):
			if cur == n:
				c = i
				break
			cur += 1
	print(r, c)


import sys
from os import path
if path.exists('Input.txt'):
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
input = lambda : sys.stdin.readline().rstrip()
from collections import deque
ff = []
for i in range(17000000000):
	ff.append(i ** 2)
	if i ** 2 > 100000000000.0 + 1:
		break

def solve_tc(ff):
	n = int(input())
	for i in range(len(ff)):
		if ff[i] >= n:
			if ff[i] - i + 1 > n:
				return str(i - (ff[i] - i + 1 - n)) + ' ' + str(i)
			else:
				return str(i) + ' ' + str(ff[i] - n + 1)
t = int(input())
for _ in range(t):
	sys.stdout.write(str(solve_tc(ff)) + '\n')


def table(k):
	s = 0
	cr = 0
	i = 1
	column = 1
	row = 1
	while s < k:
		cr += 1
		s += i
		if k <= s - cr + 1:
			column = cr
			row = k - (s - i + 1) + 1
		else:
			row = cr
			column = s - k + 1
		i += 2
	print(row, column)
n = int(input())
while n != 0:
	k = int(input())
	table(k)
	n -= 1


t = int(input())
import math
for _ in range(t):
	k = int(input())
	num = 0
	rng = int(math.sqrt(math.pow(10, 9)))
	power = 999999999999
	colNum = 1
	row = 0
	col = 0
	ans = []
	if k == 1:
		print(1, 1)
	else:
		for i in range(2, rng + 2):
			power = i ** 2
			row = i
			if k in range(power - (row * 2 - 1), power + 1):
				break
		num = power
		r = row * 1
		for i in range(r - 1):
			if num != k:
				num -= 1
				colNum += 1
			else:
				ans = True
				break
		if ans:
			print(row, colNum)
		else:
			for i in range(r):
				if num != k:
					num -= 1
					row -= 1
				else:
					print(row, colNum)
					break


n = int(input())
for i in range(n):
	g = int(input())
	sqrtg = int(g ** 0.5) + 1
	difg = sqrtg ** 2 - g + 1
	if (sqrtg - 1) ** 2 == g:
		print(sqrtg - 1, 1)
	elif difg > sqrtg:
		y = sqrtg
		x = sqrtg ** 2 - g + 1
		st1 = (sqrtg - 1) ** 2 + 1
		x = g - st1 + 1
		print(x, y)
	else:
		print(sqrtg, difg)


import math
for _ in range(int(input())):
	k = int(input())
	c = math.ceil(math.sqrt(k))
	m = c * c - c + 1
	if k > m:
		z = k - m
		z = c - z
		print(c, z)
	else:
		z = m - k
		z = c - z
		print(z, c)


import math
for i in range(int(input())):
	number = int(input())
	sqrt = number ** 0.5
	ceil = int(math.ceil(sqrt) ** 2)
	if sqrt.is_integer() == True:
		floor = int((sqrt - 1) ** 2 + 1)
	else:
		floor = int(math.floor(sqrt) ** 2 + 1)
	mid = (ceil + floor) // 2
	if number >= mid:
		row = int(ceil ** 0.5)
		col = int(ceil ** 0.5) - (number - mid)
	else:
		col = int(ceil ** 0.5)
		row = int(floor ** 0.5) - (mid - number) + 1
	print(row, col)


t = int(input())
while t:
	k = int(input())
	n = int(k ** 0.5)
	if k ** 0.5 == n:
		print(n, 1)
	elif (n + 1) ** 2 - k <= n:
		print(n + 1, (n + 1) ** 2 - k + 1)
	else:
		print(k - n ** 2, n + 1)
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	p1 = int(math.ceil(math.sqrt(n)))
	p2 = int(math.sqrt(n))
	p2 *= p2
	if n - p2 == 0:
		print(p1, 1)
	elif n - p2 <= p1:
		x1 = n - p2
		y1 = p1
		print(x1, y1)
	else:
		temp = p1 * p1
		x1 = p1
		y1 = temp - n + 1
		print(x1, y1)


from math import ceil
for i in range(int(input())):
	k = int(input())
	x = ceil(k ** 0.5)
	max_value = x ** 2
	min_value = max_value - x + 1
	if min_value <= k <= max_value:
		print(x, max_value - k + 1)
	else:
		print(x - (min_value - k), x)


import math
t = int(input())
while t:
	k = int(input())
	x = int(math.sqrt(k))
	y = x * x
	p = x + 1
	q = p * p
	if k == y:
		print(x, 1)
	elif q - k <= p - 1:
		print(p, q - k + 1)
	else:
		a = 1
		for i in range(y + 1, 10 ** 9 + 1):
			if i == k:
				break
			else:
				a += 1
		print(a, p)
	t -= 1


import math
n = input()
for _ in range(int(n)):
	num = int(input())
	round_num = int(math.ceil(math.sqrt(int(num))))
	leftmost = round_num ** 2
	inter_point = leftmost - (round_num - 1)
	topmost = inter_point - (round_num - 1)
	if num == leftmost:
		print('{0} 1'.format(round_num))
		continue
	if num >= inter_point:
		print('{0} {1}'.format(round_num, leftmost - num + 1))
	else:
		print('{0} {1}'.format(num - topmost + 1, round_num))


from collections import defaultdict
import math

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

def gcd(n, m):
	return math.gcd(n, m)

def foo(n):
	return n * n + -2 * n + 2
t = int(input())
for t1 in range(0, t):
	n = int(input())
	i = 1
	start = foo(i)
	last = i
	while start <= n:
		last = i
		i += 1
		start = foo(i)
	start = foo(last)
	end = last * last
	(l, r) = (0, 0)
	diff = end - start + 1
	half = diff // 2
	d = n - start
	if d <= half:
		l = d + 1
		r = last
	else:
		l = last
		r = end - n + 1
	print(l, r)


import sys
from sys import stdin
tt = int(stdin.readline())
ANS = []
for loop in range(tt):
	k = int(stdin.readline())
	l = 0
	r = 100000
	while r - l != 1:
		m = (l + r) // 2
		if m ** 2 >= k:
			r = m
		else:
			l = m
	mx = r
	mid = (r ** 2 + (r - 1) ** 2 + 1) // 2
	if k <= mid:
		y = r
		x = k - (r - 1) ** 2
	else:
		x = r
		y = r ** 2 + 1 - k
	ANS.append(str(x) + ' ' + str(y))
print('\n'.join(ANS))


from math import sqrt, ceil
for _ in range(int(input())):
	k = int(input())
	v = ceil(sqrt(k))
	m = v ** 2 - (v ** 2 - (v - 1) ** 2) // 2
	if k < m:
		print(v - m + k, v)
	else:
		print(v, v - k + m)


import os
import sys
from io import BytesIO, IOBase
_print = print
BUFSIZE = 8192

def dbg(*args, **kwargs):
	_print('\x1b[95m', end='')
	_print(*args, **kwargs)
	_print('\x1b[0m', end='')

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

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

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())

def A002522(n):
	if n < 0:
		return -1
	return n * n + 1
from itertools import product

def offset_generator(nums, offset=1, form=0):
	start = 0 if form == 1 else -offset
	end = 1 if form == -1 else offset + 1
	for tp in product(range(start, end), repeat=len(nums)):
		for (num, off) in zip(nums, tp):
			yield (num + off)

def solve():
	n = itg()
	col = 0
	for c in offset_generator([int(n ** 0.5)], 3):
		if A002522(c) <= n:
			col = c
		else:
			break
	top = A002522(col)
	corner = top + col
	if n <= corner:
		row = n - top
	else:
		row = col
		col -= n - corner
	return (row + 1, col + 1)

def main():
	for _ in range(itg()):
		print(*solve())
DEBUG = 0
URL = 'https://codeforces.com/contest/1560/problem/C'
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
else:
	if DEBUG != 2:
		dbg = lambda *args, **kwargs: ...
		(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	if DEBUG == 3:

		def print(*args, **kwargs):
			_print(*args, **kwargs)
			sys.stdout.flush()
	main()


for _ in range(int(input())):
	x = int(input())
	k = x - 1
	m = int(k ** 0.5)
	n = k + 1 - m * m
	print(min((m := (m + 1)), n), min(m, 2 * m - n))


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	lol = ceil(sqrt(n))
	lim = lol * lol
	y = lol
	x = 1
	kek = lol
	cur = lim
	while kek > 1 and n != cur:
		x += 1
		kek -= 1
		cur -= 1
	while n != cur:
		y -= 1
		cur -= 1
	print(y, x)


for t in range(int(input())):
	n = int(input())
	i = 0
	while i * i < n:
		i += 1
	d = i * i - n + 1
	k = d - i
	if d >= i:
		print(i - k, i)
	else:
		print(i, i * i - n + 1)


from math import sqrt, ceil
t = int(input())
for tt in range(t):
	k = int(input())
	f = ceil(sqrt(k))
	if k >= f * f - f + 1:
		r = f
		c = f * f - k + 1
	else:
		c = f
		r = k - (f - 1) ** 2
	print(r, c)


from bisect import bisect_left
z = [1]
for x in range(3, 99999999999, 2):
	val = x + z[-1]
	if val > 10 ** 9 + 100000:
		break
	z.append(val)
n = int(input())
for _ in range(n):
	a = int(input())
	pos = bisect_left(z, a)
	if z[pos] == a:
		print(pos + 1, 1)
		continue
	diff = (z[pos] - z[pos - 1]) // 2
	pos_list = [z[pos - 1] + 1, z[pos - 1] + diff + 1, z[pos] - diff, z[pos]]
	if a == pos_list[1]:
		print(pos + 1, pos + 1)
		continue
	if a == pos_list[0]:
		print(1, pos + 1)
		continue
	if a == pos_list[3]:
		print(1, pos + 1)
		continue
	if pos_list[0] <= a <= pos_list[1]:
		print(a - pos_list[0] + 1, pos + 1)
	else:
		print(pos + 1, pos_list[3] - a + 1)


import math
for i in range(int(input())):
	n = int(input())
	p = pow(n, 0.5)
	xn = math.ceil(p)
	diag = xn ** 2 - xn + 1
	row = xn
	column = xn
	if n > diag:
		dif = n - diag
		column -= dif
	if n < diag:
		dif = diag - n
		row -= dif
	print(row, column)


t = int(input())
for p in range(t):
	n = int(input())
	n -= 1
	k = int(n ** 0.5)
	n += 1
	if k == 0:
		print(1, 1)
	elif n - k * k < (k + 1) * (k + 1) - n:
		print(n - k * k, k + 1)
	else:
		print(k + 1, (k + 1) * (k + 1) - n + 1)


for i in range(int(input())):
	x = int(input())
	t = int(x ** 0.5)
	s = x - t ** 2
	l = []
	l = [t, 1]
	if s == 0:
		l = [1, t]
	elif s <= t + 1:
		l = [t + 1, s]
	else:
		l = [2 * t - s + 2, t + 1]
	print(l[1], l[0])


t = int(input())
from math import sqrt, floor
for i in range(t):
	n = int(input())
	if sqrt(n) == floor(sqrt(n)):
		row = int(sqrt(n))
	else:
		a = int(sqrt(n))
		row = a + 1
	column = int(row ** 2) - n
	if column < row:
		print(row, column + 1)
	else:
		print(2 * row - 1 - column, row)


import math
n = int(input())
while n > 0:
	n -= 1
	a = int(input())
	s = math.sqrt(a)
	s = math.floor(s)
	over = a - s * s
	if over == 0:
		print(s, 1)
	elif over > 0:
		mark = s + 1
		if over < mark:
			print(over, mark)
		elif over == mark:
			print(mark, mark)
		elif over > mark:
			print(mark, 2 * mark - over)


import math as ma
t = int(input())

def coords(num):
	if int(ma.sqrt(num)) - ma.sqrt(num) != 0:
		base = int(ma.sqrt(num)) + 1
	else:
		base = int(ma.sqrt(num))
	if num < base * base - base + 1:
		print(num - (base - 1) * (base - 1), base)
	elif num > base * base - base + 1:
		print(base, base * base - num + 1)
	else:
		print(base, base)
for i in range(t):
	num = int(input())
	coords(num)


for _ in range(int(input())):
	n = int(input())
	y = int(n ** 0.5)
	n -= y ** 2
	x = n // (y + 1)
	if n == 0:
		print(y, 1)
	elif x < 1 or n == y + 1:
		print(n, y + 1)
	else:
		print(y + 1, y * 2 + 2 - n)


import math
t = int(input())
while t:
	k = int(input())
	d = math.sqrt(k)
	e = math.ceil(d)
	if k <= (e - 1) * (e - 1) + e:
		x = k - (e - 1) * (e - 1)
		y = e
		print(x, y)
	else:
		x = e
		y = e * e + 1 - k
		print(x, y)
	t = t - 1


import math
t = int(input())
while t:
	n = int(input())
	s = int(math.sqrt(n))
	if math.sqrt(n) == s:
		print(s, 1, sep=' ')
	elif n <= s * s + s + 1:
		print(n - s * s, s + 1, sep=' ')
	else:
		print(s + 1, (s + 1) * (s + 1) - n + 1, sep=' ')
	t = t - 1


def bSearch(k):
	left = 1
	right = 32000
	while left < right:
		mid = left + (right - left) // 2
		if k > mid * mid:
			left = mid + 1
		else:
			right = mid
	return left
t = int(input())
while t:
	k = int(input())
	maxtrixSize = bSearch(k)
	diagonal = maxtrixSize * maxtrixSize - maxtrixSize
	if k > diagonal:
		row = maxtrixSize
		col = 1 + (diagonal + maxtrixSize - k)
	else:
		col = maxtrixSize
		row = maxtrixSize - 1 - (diagonal - k)
	print(row, col)
	t -= 1


import math
t = int(input())
for _ in range(t):
	k = int(input())
	num = int(math.ceil(math.sqrt(k)))
	start = (num - 1) ** 2 + 1
	end = num * num
	diff = k - start
	cut = start + num - 1
	row = -1
	column = -1
	if diff <= cut - start:
		column = num
		row = k - start + 1
	else:
		row = num
		column = end - k + 1
	print(row, column)


import math
trails = int(input())
answer_list = []
for x in range(trails):
	number = int(input())
	answer = [0, 0]
	sqrt = math.sqrt(number)
	rounded = round(sqrt)
	if rounded < sqrt:
		low_s = rounded
		high_s = low_s + 1
		low = low_s * low_s
		high = high_s * high_s
		answer[0] = high_s
		answer[1] = number - low
	elif rounded > sqrt:
		low_s = rounded - 1
		high_s = rounded
		low = low_s * low_s
		high = high_s * high_s
		if number == low + (high - low) // 2 + 1:
			answer[0] = high_s
			answer[1] = high_s
		else:
			answer[0] = high - number + 1
			answer[1] = high_s
	else:
		answer[0] = 1
		answer[1] = rounded
		answer_list.append(answer)
		continue
	answer_list.append(answer)
for g in answer_list:
	print(g[1], end=' ')
	print(g[0])


import sys
import math
from bisect import bisect_left
from collections import Counter, defaultdict
L = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input()
mod = 10 ** 9 + 7

def solve():
	n = I()
	x = n
	i = 1
	c = 1
	while 1:
		if x <= i:
			break
		c += 1
		x -= i
		i += 2
	a = c * (c - 1) + 1 - c
	b = c * (c - 1) + c
	if c * (c - 1) + 1 == n:
		print(c, c)
	elif c * (c - 1) + 1 > n:
		print(n - a, c)
	else:
		print(c, b - n + 1)
for _ in range(I()):
	solve()


from math import floor as fl
from math import sqrt

def main():
	k = int(input())
	shell = fl(sqrt(k - 0.5))
	diag = 1 + shell ** 2 + shell
	if k == diag:
		print('{} {}'.format(shell + 1, shell + 1))
	elif k < diag:
		col = shell + 1
		row = shell - abs(diag - k) + 1
		print('{} {}'.format(row, col))
	else:
		row = shell + 1
		col = shell - abs(diag - k) + 1
		print('{} {}'.format(row, col))
tt = int(input())
for _ in range(tt):
	main()


polycarp = []
for i in range(0, 31624):
	polycarp.append(i * i)
t = int(input())
solucoes = []
for j in range(0, t):
	k = int(input())
	for i in range(0, k + 1):
		if k >= polycarp[i] and k < polycarp[i + 1]:
			if k == polycarp[i]:
				solucoes.append([i, 1])
				break
			else:
				aux = k - polycarp[i]
				if aux <= i + 1:
					solucoes.append([aux, i + 1])
					break
				else:
					aux2 = polycarp[i + 1] - k
					solucoes.append([i + 1, 1 + aux2])
					break
for j in range(0, t):
	print(str(solucoes[j][0]) + ' ' + str(solucoes[j][1]))


from math import sqrt, floor

def solve1(k):
	i = 1
	f = 3
	s = 1
	if n == 1:
		return (1, 1)
	while (s := (i * f + 1)) < n:
		i = i + 1
		f = f + 1
	rem = n - ((i - 1) * (f - 1) + 1)
	if rem == 0:
		return (1, i + 1)
	if rem <= i + 1:
		return (rem, i + 1)
	if rem > i + 1:
		return (i + 1, 2 * i - rem + 2)
	return (0, 0)

def solve2(k):
	i = floor(sqrt(k - 1))
	n_i = i + 1
	rem = k - i ** 2
	if rem <= n_i:
		return (rem, n_i)
	return (n_i, 2 * n_i - rem)
for s in [*open(0)][1:]:
	x = int(s)
	print(*solve2(x))


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(1, 1)
		continue
	k = int(n ** 0.5) - 2
	while k * k < n:
		k += 1
	pos = n - (k - 1) * (k - 1)
	if pos < k:
		rw = pos
		col = k
	else:
		pos = k * k + 1 - n
		rw = k
		col = pos
	print(rw, col)


import math
t = int(input())
for i in range(t):
	k = int(input())
	if k > 1:
		diagnum = int((math.ceil(k ** 0.5 - 1) ** 2 + 1 + math.ceil(k ** 0.5) ** 2) / 2)
		pos = math.ceil(diagnum ** 0.5)
		if k < diagnum:
			print(pos - diagnum + k, pos)
		else:
			print(pos, pos - k + diagnum)
	else:
		print(1, 1)


import math
t = int(input())
for _ in range(t):
	floor = 0
	ceil = 0
	k = int(input())
	x = k ** 0.5
	floor = math.floor(x)
	ceil = math.ceil(x)
	if x == floor:
		print(int(x), 1)
		continue
	mid = (ceil ** 2 + floor ** 2 + 1) // 2
	if k <= mid:
		print(ceil - (mid - k), ceil)
	else:
		print(ceil, ceil - (k - mid))


import math
for i in range(int(input())):
	k = int(input())
	t = int(k ** 0.5)
	p = k - t ** 2
	if p > 0:
		if p <= t:
			print(p, t + 1)
		else:
			print(t + 1, (t + 1) ** 2 - k + 1)
	else:
		print(t, 1)


from itertools import product
import itertools
import math
import sys
import heapq
from collections import deque
MOD = 1000000000007

def find(parent, i):
	if parent[i] != i:
		parent[i] = find(parent, parent[i])
	return parent[i]

def union(parent, rank, xx, yy):
	x = find(parent, xx)
	y = find(parent, yy)
	if rank[x] > rank[y]:
		parent[y] = x
	elif rank[y] > rank[x]:
		parent[x] = y
	else:
		parent[y] = x
		rank[x] += 1
ans = 0
K = int(sys.stdin.readline().strip())
x = 0
y = 0
for _ in range(K):
	q = int(sys.stdin.readline().strip()) - 1
	sqr = int(q ** 0.5)
	r = q - sqr ** 2
	if r <= sqr:
		x = sqr
		y = r
	else:
		x = sqr * 2 - r
		y = sqr
	print(y + 1, x + 1)


import math
t = int(input())
for _ in range(t):
	x = int(input())
	n = math.ceil(x ** 0.5)
	a = n ** 2 - (n - 1) ** 2
	mid = n ** 2 - a // 2
	if x < mid:
		print(n - abs(mid - x), n)
	elif x > mid:
		print(n, n - abs(mid - x))
	else:
		print(n, n)


from math import ceil, sqrt
t = int(input())
while t:
	t -= 1
	n = int(input())
	k = sqrt(n)
	if ceil(k) - k > 0.5:
		b = abs(int(k) ** 2 - n)
		c = ceil(k)
	else:
		b = ceil(k)
		c = b * b - n + 1
	print(b, c)


def bs(l, low, high, x):
	index = -1
	while low <= high:
		mid = (low + high) // 2
		if l[mid] == x:
			return mid
		elif l[mid] < x:
			index = mid
			low = mid + 1
		else:
			high = mid - 1
	return index
n = 100000
l = [0] * (n + 1)
for i in range(1, 100000):
	l[i] = i * i
for t in range(int(input())):
	k = int(input())
	index = bs(l, 0, n - 1, k)
	m = k - index * index
	if m == 0:
		print(index, 1, sep=' ')
	elif m <= index + 1:
		row = m
		col = index + 1
		print(row, col, sep=' ')
	else:
		row = index + 1
		col = index + 1 - (m - (index + 1))
		print(row, col, sep=' ')


from __future__ import division, print_function
import os, math
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	for _ in range(int(input())):
		k = int(input())
		n = math.floor(math.sqrt(k - 1)) + 1
		ans = pow(n - 1, 2)
		if k - ans <= n:
			print(k - ans, n)
		else:
			print(n, 1 + pow(n, 2) - k)
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math

def solve(k):
	if k == 1:
		return '1 1'
	n = math.floor(math.sqrt(k))
	if k == n ** 2:
		return f'{n} 1'
	if k < n ** 2 + n + 1:
		return f'{k - n ** 2} {n + 1}'
	else:
		return f'{n + 1} {(n + 1) ** 2 - k + 1}'

def main():
	ans = []
	t = int(input())
	for _ in range(t):
		k = int(input())
		ans.append(solve(k))
	for a in ans:
		print(a)
main()


t = int(input())
for z in range(t):
	n = int(input())
	x = 1
	while x * x < n:
		x += 1
	i = x
	j = 1
	if x * x == n:
		print(i, j)
	else:
		h = x * x - n
		if j + h <= x:
			j += h
		else:
			j = x
			h -= x - 1
			i -= h
		print(i, j)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
import string
ORDA = 97

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):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	k = ii()
	r_ = math.ceil(math.sqrt(k))
	d = r_ ** 2 - k
	if r_ ** 2 - r_ + 1 <= k <= r_ ** 2:
		print(r_, d + 1)
	else:
		print(k - (r_ - 1) ** 2, r_)


kol = int(input())
for i in range(kol):
	k = int(input())
	sp = [1, 1]
	vs = 1
	vs1 = 1
	pred = 1
	while vs < k:
		pred += 2
		vs += pred
		vs1 += 1
	w = abs(vs - pred - k)
	if w < vs1:
		print(w, vs1)
	else:
		print(vs1, vs1 * 2 - w)


T = int(input())
for _ in range(T):
	v = int(input())
	s = 1
	while s ** 2 < v:
		s += 1
	if v > s ** 2 - s:
		print(s, s ** 2 - v + 1)
	else:
		print(v - (s - 1) ** 2, s)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
T = int(input())
while T:
	T -= 1
	k = int(input())
	x = int(k ** 0.5)
	if x * x == k:
		print(x, 1)
		continue
	rem = k - x ** 2
	if rem <= x + 1:
		print(rem, x + 1)
	else:
		rem -= x + 1
		print(x + 1, x + 1 - rem)


import math
x = int(input())
for i in range(x):
	a = int(input())
	b = math.floor(a ** 0.5)
	c = b + 1
	b2 = b ** 2
	c2 = c ** 2
	if math.sqrt(a) == int(a ** 0.5):
		print(b, 1)
	elif a - b2 <= b:
		print(a - b2, c)
	elif c2 - a <= b - 1:
		print(c, c2 - a + 1)
	else:
		print(c, c)


col = [1, 2]
for i in range(31623):
	col.append(col[-1] + col[-1] - col[-2] + 2)
diag = [1, 3]
for i in range(31623):
	diag.append(diag[-1] + diag[-1] - diag[-2] + 2)
t = int(input())
for i in range(t):
	k = int(input())
	l = 0
	for j in range(len(col)):
		if col[j] > k:
			l = j - 1
			break
	if col[l] <= k <= diag[l]:
		for j in range(l + 1):
			if col[l] + j == k:
				print(f'{j + 1} {l + 1}')
				break
	else:
		for j in range(l):
			if diag[l] + j + 1 == k:
				print(f'{l + 1} {l - j}')
				break


t = int(input())
for _ in range(t):
	k = int(input())
	d = int((k - 1) ** 0.5)
	if k <= d ** 2 + d + 1:
		(r, c) = (k - d ** 2, d + 1)
	else:
		(r, c) = (d + 1, (d + 1) ** 2 - k + 1)
	print(r, c)


from math import ceil
for _ in range(int(input())):
	k = int(input())
	layer = ceil(k ** 0.5)
	start = (layer - 1) ** 2 + 1
	end = layer ** 2
	if start <= k <= start + layer - 1:
		c = layer
		r = k - start + 1
	else:
		r = layer
		c = end - k + 1
	print(r, c)


import decimal
from math import sqrt
for _ in range(int(input())):
	k = int(input())
	sc = int(sqrt(k))
	if sc * sc == k:
		print(sc, 1)
	else:
		(sm, bg) = (sc * sc, (sc + 1) * (sc + 1))
		sm += 1
		(r, c) = (-1, -1)
		if (sm + bg) / 2 >= k:
			c = sc + 1
			r = sc + 1 - abs((sm + bg) / 2 - k)
		else:
			r = sc + 1
			c = sc + 1 - abs((sm + bg) / 2 - k)
		print(int(r), int(c))


def sqrt(n):
	return int(n ** 0.5)
t = int(input())
for _ in range(t):
	k = int(input())
	sq = sqrt(k)
	if sq ** 2 != k:
		sq += 1
	tmp = sq ** 2 - k + 1
	y = min(tmp, sq)
	tmp = k - (sq - 1) ** 2
	x = min(tmp, sq)
	print(x, y)


def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return mid
a = [1]
ind = 0
i = 1
overall = 1
while True:
	overall += i + 1
	a.append(overall)
	overall += i
	if overall > 1000000000:
		break
	i += 1
for k in range(int(input())):
	n = int(input())
	ind = binarySearch(a, 0, len(a) - 1, n)
	finalInd = -1
	if ind + 1 >= len(a):
		for j in [ind - 1, ind]:
			if n >= a[j] - j and n <= a[j] + j:
				finalInd = j
	else:
		for j in [ind - 1, ind, ind + 1]:
			if n >= a[j] - j and n <= a[j] + j:
				finalInd = j
	if a[finalInd] == n:
		print(finalInd + 1, finalInd + 1)
	elif a[finalInd] > n:
		diff = abs(n - a[finalInd])
		print(abs(finalInd - diff) + 1, finalInd + 1)
	else:
		diff = abs(n - a[finalInd])
		print(finalInd + 1, abs(diff - finalInd) + 1)


import math
low_a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
high_a = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
t = int(input())
for i in range(t):
	num = int(input())
	temp = math.sqrt(num)
	if temp == int(temp):
		print(int(temp), 1)
	else:
		a = math.ceil(temp)
		t = (a * a + (a - 1) * (a - 1) + 1) / 2
		if num >= t:
			print(int(a), int(a + t - num))
		else:
			print(int(a + num - t), int(a))


from collections import Counter
from itertools import accumulate, product, groupby
import operator
import math
from functools import reduce

def solve():
	k = int(input())
	layer = math.ceil(k ** 0.5)
	pos_in_layer = k - (layer - 1) ** 2
	if pos_in_layer <= layer:
		return [pos_in_layer, layer]
	else:
		pos_in_layer -= layer
		return [layer, layer - pos_in_layer]
for _ in range(int(input())):
	print(*solve())


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
for _ in range(II()):
	k = II()
	if k == 1:
		print(1, 1)
		continue
	(l, r) = (1, int(100000.0) + 1)
	while l <= r:
		m = (l + r) // 2
		if m ** 2 < k:
			l = m + 1
			n = m
		else:
			r = m - 1
	if k <= n * n + n + 1:
		print(k - n * n, n + 1)
	else:
		print(n + 1, (n + 1) ** 2 - k + 1)


t = int(input())
cases = []
while t > 0:
	cases.append(int(input()))
	t -= 1
r = 1
c = 1
for case in cases:
	indx = int(case ** 0.5 // 1)
	if int((indx + 1) ** 2) > case and int((indx + 1) ** 2 - case) <= indx:
		r = indx + 1
		c = (indx + 1) ** 2 - case + 1
	elif case == int(indx ** 2):
		r = indx
		c = 1
	elif case == int(indx ** 2 + 1):
		c = indx + 1
		r = 1
	else:
		c = indx + 1
		r = case - indx ** 2
	print(r, c)


t = int(input())
for _ in range(t):
	k = int(input())
	acc = 0
	ans = [0, 0]
	for i in range(1, 1000000):
		tmp = (i - 1) * 2 + 1
		acc += tmp
		if acc >= k:
			acc -= tmp
			tmp = k - acc
			if tmp > i:
				ans[0] = i
				ans[1] = i - (tmp - i)
			else:
				ans[1] = i
				ans[0] = tmp
			print(*ans)
			break


test = int(input())

def pos(x):
	n = x ** 0.5 // 1
	n = int(n)
	if x - n ** 2 == 0:
		print(n, 1, '')
	elif x - n ** 2 <= n + 1:
		r = x - n ** 2
		c = n + 1
		print(r, c, '')
	else:
		c = (n + 1) ** 2 - x + 1
		r = n + 1
		print(r, c, '')
for case in range(test):
	enter = int(input())
	pos(enter)


import math
t = int(input())
answer = []
for i in range(0, t):
	k = int(input())
	i = int(math.sqrt(k)) + 1
	if k > i ** 2 - i and k <= i ** 2:
		r = i
		c = i ** 2 - k + 1
	elif k == (i - 1) ** 2:
		r = i - 1
		c = 1
	else:
		c = i
		r = k - (i - 1) ** 2
	arr = [r, c]
	answer.append(arr)
for j in range(0, len(answer)):
	print(*answer[j], sep=' ')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
from itertools import accumulate as ac
from random import randint as ri
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
pre = []
for i in range(1, int(100000.0)):
	pre.append(i * i)
t = ip()
for _ in range(t):
	k = ip()
	pos = bl(pre, k + 1)
	idx = pos
	pos -= 1
	val = pre[pos]
	k -= val
	if k == 0:
		ans = [idx, 1]
	else:
		idx += 1
		x = 1
		y = idx
		if k <= idx:
			x = k
		else:
			k -= idx
			x = idx
			y = idx
			y -= k
		ans = [x, y]
	print(*ans)


for s in [*open(0)][1:]:
	k = int(s) - 1
	m = int(k ** 0.5)
	n = k + 1 - m * m
	print(min((m := (m + 1)), n), min(m, 2 * m - n))


for _ in range(int(input())):
	n = int(input())
	d = int(n ** 0.5)
	for i in range(max(1, d - 3), d + 3):
		if i * i >= n:
			d = i
			break
	mid = d * d - d + 1
	if n > mid:
		x = d
		y = d - n + mid
	else:
		x = n - (d - 1) * (d - 1)
		y = d
	print(x, y)


def mod(a, b):
	c = 0
	if a > b:
		c = a - b
	else:
		c = b - a
	return c
a = int(input())
for i in range(a):
	b = int(input())
	c = (b ** 0.5 // 1) ** 2
	x = c + 1
	y = (c ** 0.5 + 1) ** 2
	z = c ** 0.5 + 1
	if mod(y, b) < mod(x, b):
		row = z
		column = z - (b - (x + y) // 2)
	if mod(y, b) > mod(x, b):
		column = z
		row = z - ((x + y) // 2 - b)
	if mod(y, b) == mod(x, b):
		row = z
		column = z
	if b ** 0.5 == b ** 0.5 // 1:
		column = 1
		row = b ** 0.5 // 1
	row = int(row)
	column = int(column)
	print(str(row) + ' ' + str(column))


import math
n = int(input())
for i in range(n):
	k = int(input())
	root = math.floor(math.sqrt(k))
	if k == root ** 2:
		row = root
		col = 1
	elif k - root ** 2 <= root + 1:
		col = root + 1
		row = k - root ** 2
	else:
		row = root + 1
		col = (root + 1) ** 2 - k + 1
	print(f'{row} {col}')


import math

def get(n):
	x = math.ceil(math.sqrt(n))
	sq = x ** 2
	col = x if sq - n >= x else sq - n + 1
	row = x if sq - n < x else x - (sq - n - x + 1)
	return ' '.join([str(row), str(col)])
t = int(input())
for _ in range(t):
	k = int(input())
	print(get(k))


t = int(input())
for _ in range(t):
	k = int(input())
	import math

	def isPerfectSquare(n):
		if math.ceil(math.sqrt(n)) == math.floor(math.sqrt(n)):
			return True
		else:
			return False

	def nextPerfectSquare(N):
		nextN = math.floor(math.sqrt(N)) + 1
		return nextN * nextN
	if isPerfectSquare(k) == True:
		t = k
		r = int(math.sqrt(t))
		c = 1
		print(r, end=' ')
		print(c)
	elif isPerfectSquare(k) == False:
		t = nextPerfectSquare(k)
		x = int(math.sqrt(t))
		y = t - k + 1
		if y > x:
			z = y % x
			c = x
			r = x - z
		else:
			r = x
			c = y
		print(r, end=' ')
		print(c)


from math import *

def solve():
	number = int(input())
	q = int(sqrt(number - 1) + 1)
	p = number - (q - 1) * (q - 1)
	if p <= q:
		print(p, q)
	else:
		print(q, q + q - p)
T = int(input())
for i in range(T):
	solve()


import math
t = int(input())
for i in range(t):
	inn = int(input())
	col_index = 1
	cur_value = 1
	col_index = math.floor(math.sqrt(inn - 1)) + 1
	cur_value = (col_index - 1) ** 2 + 1
	if inn <= cur_value + col_index - 1:
		col = col_index
		row = inn - cur_value + 1
	else:
		cur_value = cur_value + col_index - 1
		row = col_index
		col = col_index - (inn - cur_value)
	print(row, col)


def Solution2(num):
	if num == 1:
		return [1, 1]
	else:
		k = 2
		prev_act = 1
		while 1:
			act = prev_act + k
			upper = act + k // 2
			lower = act - k // 2
			if num >= lower and num <= upper:
				diff = abs(num - act)
				index = k // 2 + 1
				if num == act:
					return [index, index]
				elif num > act:
					return [index, index - diff]
				elif num < act:
					return [index - diff, index]
			k += 2
			prev_act = act
t = int(input())
a = [None] * t
for i in range(t):
	a[i] = int(input())
for i in range(t):
	temp = Solution2(a[i])
	print(temp[0], temp[1])


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	low = 1
	high = pow(10, 9)
	row = 1
	while low <= high:
		mid = (low + high) // 2
		if mid * mid >= n:
			high = mid - 1
			row = mid
		else:
			low = mid + 1
	max_num = row * row
	main_num = max_num - row + 1
	if n == main_num:
		print(row, row)
		continue
	if n < main_num:
		c = row
		delta = main_num - n
		r = row - delta
		print(r, c)
	else:
		r = row
		delta = n - main_num
		c = row - delta
		print(r, c)


num = [0, 1]
step = 1
while num[-1] < 1000000000:
	num.append(num[-1] + step)
	step += 2
for _ in range(int(input())):
	k = int(input())
	l = 1
	r = len(num) + 1
	while l + 1 < r:
		m = (l + r) // 2
		if num[m] <= k:
			l = m
		else:
			r = m
	r = 1
	if k - num[l] + 1 > l:
		r = l
		k -= num[l]
		k -= l - 1
	else:
		r = 1 + k - num[l]
		k -= num[l]
		k -= r - 1
	if r == l:
		l -= k
	print(r, l)


import math
nn = int(input())
for i in range(nn):
	n = int(input())
	sqrtN = math.sqrt(n)
	intSqrtN = math.floor(sqrtN)
	module0 = n - intSqrtN * intSqrtN
	c = 1
	r = intSqrtN
	if module0 != 0:
		res = module0 - (intSqrtN + 1)
		if res <= 0:
			c = intSqrtN + 1
			r = module0
		else:
			r = intSqrtN + 1
			c = intSqrtN + 1 - res
	print(r, c)


import math, sys, itertools
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in wtf[1:]:
	i = int(t)
	tmp0 = math.sqrt(i)
	tmp1 = math.ceil(tmp0)
	n = 2 * tmp1 - 1
	r = tmp1 ** 2
	l = r - n + 1
	m = l + n // 2
	if m == i:
		print(tmp1, tmp1)
	elif i > m:
		print(tmp1, tmp1 - i + m)
	elif i < m:
		print(tmp1 - m + i, tmp1)


for _ in range(int(input())):
	k = int(input())
	i = 1
	while i * i < k:
		i += 1
	if k == i * i:
		print(i, 1)
		continue
	i -= 1
	e = k - i * i
	if e <= i + 1:
		print(e, i + 1)
		continue
	e = 2 * i + 1 - e
	print(i + 1, e + 1)


import math as M
import collections as C
import sys
IP = lambda : list(map(int, input().split()))
ip = lambda : input()
INF = sys.maxsize
MAX = 10 ** 9 + 7
for _ in range(int(ip())):
	n = int(ip())
	y = 1
	cur = x = M.ceil(n ** 0.5)
	tmp = cur ** 2
	if tmp - cur + 1 >= n:
		y = cur
		x -= tmp - n - cur + 1
	else:
		y = tmp - n + 1
	print(x, y)


from math import *
t = int(input())
for i in range(t):
	k = int(input())
	if k >= 5:
		k1 = 0
		s = int(sqrt(k))
		s1 = s ** 2
		if s1 == k:
			print(s, 1)
		else:
			for r in range(1, s + 2):
				s1 += 1
				if s1 == k:
					indx = r
					k1 = 1
					break
			if k1 == 1:
				print(indx, s + 1)
			else:
				for l in range(s, 0, -1):
					s1 += 1
					if s1 == k:
						indx = l
						break
				print(s + 1, l)
	elif k == 1:
		print(1, 1)
	elif k == 2:
		print(1, 2)
	elif k == 3:
		print(2, 2)
	elif k == 4:
		print(2, 1)


t = int(input())
for z in range(t):
	n = int(input())
	a = int(n ** 0.5)
	if a * a + a + 1 == n:
		print(a + 1, a + 1)
	elif a * a + a + 1 < n:
		print(a + 1, (a + 1) * (a + 1) - n + 1)
	elif a * a == n:
		print(a, 1)
	else:
		print(n - a * a, a + 1)


from math import floor, sqrt
t = int(input())
for _ in range(t):
	k = int(input())
	d = floor(sqrt(k))
	e = k - d * d
	if e == 0:
		print(d, 1)
	elif e <= d + 1:
		print(e, d + 1)
	else:
		print(d + 1, d - (e - d - 1) + 1)


import math
t = int(input())
for i in range(t):
	n = int(input())
	k = math.floor(n ** 0.5) + 1
	if (n ** 0.5).is_integer():
		print(math.floor(n ** 0.5), 1)
	elif k ** 2 - n >= k - 1:
		print(2 * k + n - 1 - k ** 2, k)
	else:
		print(k, k ** 2 - n + 1)


t = int(input())

def inf():
	for num in range(t):
		k = int(input())
		a = x = i = 1
		while k >= x + a:
			x += a
			a += 2
			i += 1
		m = k - x + 1
		if m <= i:
			print(f'{m}', end=' ')
			print(i)
		else:
			print(f'{i}', end=' ')
			print(i - (m - i))
inf()


t = int(input())
for _ in range(t):
	k = int(input())
	i = 0
	while True:
		if i * i > k:
			break
		i += 1
	n = i - 1
	if k == n * n:
		print(n, 1)
		continue
	if n * n + i == k:
		print(i, i)
	elif n * n + i > k:
		print(k - n * n, i)
	else:
		print(i, i * i - k + 1)


for _ in range(int(input())):
	k = int(input())
	col = 1
	nums = 1
	while nums < k:
		k -= nums
		col += 1
		nums += 2
	if k > nums // 2:
		print(col, nums - k + 1)
	else:
		print(k, col)


import sys
for _ in range(int(sys.stdin.readline())):
	k = int(sys.stdin.readline())
	target_range = 1
	if k == 1:
		print(f'1 1')
		continue
	while k > target_range * target_range:
		target_range += 1
	target_range -= 1
	(start, end) = (target_range ** 2 + 1, (target_range + 1) ** 2)
	middle = (end + start) // 2
	if k < middle:
		print(f'{target_range + 1 - abs(middle - k)} {target_range + 1}')
	else:
		print(f'{target_range + 1} {target_range + 1 - abs(middle - k)}')


import math
t = int(input())
for i in range(t):
	k = int(input())
	q = math.floor(math.sqrt(k)) + 1
	if (q - 1) * (q - 1) == k:
		print(q - 1, 1)
	elif q * q - q + 1 <= k:
		print(q, q * q - k + 1)
	elif q * q - q + 1 > k:
		print(k - (q * q - 2 * q + 1), q)


for s in [*open(0)][1:]:
	n = int(s) - 1
	r = int(n ** 0.5)
	s = r * r
	l = r + 1
	n += 1
	print(min(l, n - s), l + min(0, l - n + s))


import math
data_amount = int(input())
dataset = []
for i in range(data_amount):
	item = int(input())
	dataset.append(item)
default_answers = {1: [1, 1], 2: [1, 2], 3: [2, 2], 4: [2, 1], 5: [1, 3], 6: [2, 3], 7: [3, 3], 8: [3, 2], 9: [3, 1]}

def compute_answer(target_num):
	if target_num > 9:
		num_square = math.floor(math.sqrt(target_num))
		col = 1
		row = 1
		if num_square != 1:
			col = num_square + 1
			if target_num >= num_square ** 2 + 1 and target_num <= (num_square + 1) ** 2 - num_square:
				row = target_num - num_square ** 2
			else:
				row = num_square + 1
				col = row ** 2 - target_num + 1
				if num_square ** 2 == target_num:
					row = num_square
					col = 1
		print(row, col)
	else:
		(x, y) = default_answers[target_num]
		print(x, y)
for target_num in dataset:
	compute_answer(target_num)


for _ in range(int(input())):
	n = int(input())
	if n ** 0.5 == int(n ** 0.5):
		print(int(n ** 0.5), 1)
	else:
		m = n
		while m ** 0.5 != int(m ** 0.5):
			m += 1
		k = int(m ** 0.5)
		l = k - 1
		first = l ** 2 + 1
		if n < first + k:
			print(n - first + 1, k)
		else:
			print(k, k ** 2 - n + 1)


from sys import *
input = stdin.readline
import random
from bisect import *
import math
from collections import *
import operator
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
for _ in range(int(input())):
	k = int(input())
	temp = math.ceil(math.sqrt(k))
	rem = k % temp
	if temp * temp == k:
		print(temp, 1)
	else:
		prev = (temp - 1) ** 2
		diff = k - prev
		if diff <= temp:
			print(diff, temp)
		else:
			diff = temp - (diff - temp)
			print(temp, diff)


from collections import Counter
from sys import stdin, stdout
import math
from collections import defaultdict

def nextPerfectSquare(N):
	nextN = math.floor(math.sqrt(N)) + 1
	return nextN * nextN
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = nextPerfectSquare(n)
	b = math.sqrt(a)
	c = (b - 1) ** 2
	if n == 1:
		print(1, 1)
	elif n == 2:
		print(1, 2)
	elif n == 3:
		print(2, 2)
	elif n == 4:
		print(2, 1)
	elif int(c) == n:
		print(int(b - 1), 1)
	elif n <= c + b:
		print(int(n - c), int(b))
	else:
		print(int(b), int(a - n + 1))


from math import sqrt
a = []
for _ in range(int(input())):
	t = int(input())
	c = int(sqrt(t))
	if t == c * c:
		a.append((c, 1))
	elif t - c * c < c + 1:
		a.append((t - c * c, c + 1))
	else:
		a.append((c + 1, c + 1 - t + c * c + c + 1))
for i in a:
	print(i[0], i[1])


def main():
	ncases = int(input())
	import math

	def solve(n):
		a = int(math.sqrt(n))
		b = a + 1
		diffa = n - a ** 2
		diffb = b ** 2 - n
		if diffa == 0:
			return (a, 1)
		if diffa < diffb:
			return (diffa, a + 1)
		else:
			return (b, diffb + 1)
	while ncases:
		n = int(input())
		print(*solve(n))
		ncases -= 1
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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 types import GeneratorType

def bootstrap(func, stack=[]):

	def wrapped_function(*args, **kwargs):
		if stack:
			return func(*args, **kwargs)
		else:
			call = func(*args, **kwargs)
			while True:
				if type(call) is GeneratorType:
					stack.append(call)
					call = next(call)
				else:
					stack.pop()
					if not stack:
						break
					call = stack[-1].send(call)
			return call
	return wrapped_function
main()


ans = [0]
for i in range(1, 31625):
	ans.append(i ** 2 - i + 1)
for _ in range(int(input())):
	k = int(input())
	for i in range(1, 31625):
		if ans[i - 1] <= k < ans[i]:
			temp = ans[i] - i + 1
			if k < temp:
				temp = k - ans[i - 1]
				print(i - 1, i - 1 - temp)
			else:
				temp = ans[i] - k
				print(i - temp, i)


import math

def search_coordinate(k):
	s = search_floor_sqrt(k)
	first_num = math.pow(s - 1, 2) + 1
	remain = int(k - first_num)
	if remain <= s - 1:
		print(remain + 1, s)
	else:
		remain -= s - 1
		print(s, s - remain)

def search_floor_sqrt(k):
	if k == 1:
		return 1
	return int(math.ceil(math.sqrt(k)))
t = int(input())
for i in range(t):
	k = int(input())
	search_coordinate(k)