Melody Pond was stolen from her parents as a newborn baby by Madame Kovarian, to become a weapon of the Silence in their crusade against the Doctor. Madame Kovarian changed Melody's name to River Song, giving her a new identity that allowed her to kill the Eleventh Doctor.

Heidi figured out that Madame Kovarian uses a very complicated hashing function in order to change the names of the babies she steals. In order to prevent this from happening to future Doctors, Heidi decided to prepare herself by learning some basic hashing techniques.

The first hashing function she designed is as follows.

Given two positive integers $(x, y)$ she defines $H(x,y):=x^2+2xy+x+1$.

Now, Heidi wonders if the function is reversible. That is, given a positive integer $r$, can you find a pair $(x, y)$ (of positive integers) such that $H(x, y) = r$?

If multiple such pairs exist, output the one with smallest possible $x$. If there is no such pair, output "NO".


-----Input-----

The first and only line contains an integer $r$ ($1 \le r \le 10^{12}$).


-----Output-----

Output integers $x, y$ such that $H(x,y) = r$ and $x$ is smallest possible, or "NO" if no such pair exists.


-----Examples-----
Input
19

Output
1 8

Input
16

Output
NO

Source: codeforces | Difficulty: EASY
Tags: Number theory

Mathematics

Complete search


Solutions:
import math
n = int(input())
flag = 0
for x in range(1, int(math.sqrt(n))):
	if (pow(x, 2) + x + 1 - n) / (-2 * x) == int((pow(x, 2) + x + 1 - n) / (-2 * x)):
		print(x, (pow(x, 2) + x + 1 - n) // -2 * x)
		flag = 1
		break
if flag == 0:
	print('NO')


r = int(input())
r -= 1
x = 1
ok = False
while x * x <= r:
	if r % x == 0:
		m = r // x
		if (m - 1 - x) % 2 == 0:
			y = (m - 1 - x) // 2
			if y > 0:
				print(x, ' ', y)
				ok = True
				break
	x += 1
if ok is False:
	print('NO')


r = int(input())
if r <= 4 or r % 2 == 0:
	print('NO')
else:
	print(1, (r - 3) // 2)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(Decimal, input().split())
r = inp()
x = 1
while x * (x + 1) <= r:
	if (r - x * (x + 1) - 1) % (2 * x) == 0:
		y = (r - x * (x + 1) - 1) // (2 * x)
		if x <= y:
			print(x, y)
			sys.exit()
	x += 1
print('NO')


n = int(input())
x = 1
y = 1
flag = 1
while True:
	a = n - 1 - x - x * x
	if a < 2 * x:
		flag = 0
		break
	elif a % 2 == 0:
		y = a // (2 * x)
		print(x, y)
		break
	x += 1
if flag == 0:
	print('NO')


def getFacts(n):
	facts = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			facts.append(i)
			if i != n // i:
				facts.append(n // i)
	return facts

def main():
	r = int(input())
	factors = getFacts(r - 1)
	min_x = float('inf')
	min_y = -1
	for f in factors:
		y = (r - 1) // f
		y -= f
		y -= 1
		y = y / 2
		if y == int(y) and y > 0:
			if f < min_x:
				min_x = f
				min_y = y
	if min_y == -1:
		print('NO')
		return
	print(min_x, int(min_y))
main()


r = int(input())
i = 1
while i * i <= r - 1:
	if (r - 1) % i == 0:
		x = i
		if ((r - 1) / x - x - 1) % 2 == 0 and ((r - 1) / x - x - 1) / 2 > 0:
			print(str(x) + ' ' + str(int(((r - 1) / x - x - 1) / 2)))
			exit()
	i += 1
print('NO')


n = int(input())
if n % 2 == 0 or n == 1 or n == 3:
	print('NO')
else:
	print(1, (n - 3) // 2)


n = int(input())
if n % 2 == 1 and n > 4:
	x = n // 2 - 1
	print(1, x)
else:
	print('NO')


import math

def H(x, y):
	return x ** 2 + 2 * x * y + x + 1
r = int(input())
found = False
for x in range(1, int(math.sqrt(r)) + 2):
	yp = (-1 * x - 1) / 2 + (r - 1) / (2 * x)
	if yp <= 0:
		continue
	if yp == int(yp):
		print(x, int(yp))
		found = True
		break
if not found:
	print('NO')


import math
r = int(input())
r -= 1
for x in range(1, int(math.sqrt(r))):
	if r % x == 0:
		res = r / x
		res -= x + 1
		if res % 2 == 0 and res > 0:
			y = int(res / 2)
			print(x, y)
			exit()
print('NO')


r = int(input())
if r % 2 == 0:
	print('NO')
elif r >= 5:
	x = 1
	y = (r - 1) // 2 - 1
	print(x, y)
else:
	print('NO')


r = int(input())
i = 1
while True:
	a = i * i + i + 1
	if a < r and (a - r) % (2 * i) == 0:
		a = (a - r) // (2 * -i)
		print(f'{i} {a}')
		break
	elif a >= r:
		print('NO')
		break
	i += 1


def findx(n):
	m = n - 1
	for x in range(1, int(n ** 0.5)):
		if m % x == 0:
			z = n - x ** 2 - x - 1
			if z % (2 * x) == 0:
				print(x, z // (2 * x))
				return
	print('NO')
findx(int(input()))


r = int(input())
if r < 5 or r % 2 == 0:
	print('NO')
	return
print(1, (r - 3) // 2)


a = int(input()) - 1
if a in (0, 2):
	print('NO')
elif a % 2 == 1:
	print('NO')
else:
	print(1, a // 2 - 1)


import math

def check(r):
	for x in range(1, int(math.sqrt(r - 1)) + 2):
		if (r - 1) % x == 0:
			if (r - 1) / x <= x + 1:
				print('NO')
				return
			if (r - 1) / x > x + 1 and ((r - 1) / x - (x + 1)) % 2 == 0:
				print(x, end=' ')
				print(int(((r - 1) / x - (x + 1)) / 2))
				return
	print('NO')
r = int(input())
check(r)


n = int(input())
n = n - 1
x = int(n ** 0.5)
flag = True
for i in range(1, x + 1):
	if n % i == 0:
		temp = n // i
		temp = temp - i - 1
		if temp == 0:
			continue
		if temp % 2 == 0:
			a = i
			b = temp // 2
			flag = False
			break
if flag:
	print('NO')
else:
	print(a, b)


xsumy = int(input())
if xsumy % 2 == 0 or xsumy < 5:
	print('NO')
else:
	print(1, (xsumy - 3) // 2)


n = int(input())
fl = 0
i = 1
while i * i <= n:
	if (n - i ** 2 - i - 1) % (2 * i) == 0 and n > i ** 2 + i + 1:
		print(i, (n - i ** 2 - i - 1) // (2 * i))
		fl = 1
		break
	i += 1
if fl == 0:
	print('NO')


def __starting_point():
	r = int(input())
	if r < 5:
		print('NO')
	elif r % 2 == 0:
		print('NO')
	else:
		y = (r - 3) // 2
		print('1 ' + str(y))
__starting_point()


import math
r = int(input())
ok = 0
x = 0
y = 0
for i in range(1, math.floor(math.sqrt(r - 1)) + 1):
	if (r - 1) % i == 0 and ((r - 1) / i - 1 - i) % 2 == 0:
		x = i
		y = int(((r - 1) / i - 1 - i) / 2)
		if x == 0 or y == 0:
			print('NO')
			ok = 1
			break
		print(x, y)
		ok = 1
		break
if ok == 0:
	print('NO')


r = int(input())
x = 1
c = 0
if r == 1:
	print('NO')
else:
	while r - 1 > x ** 2:
		if (r - 1 - x ** 2) % x == 0:
			if ((r - 1 - x ** 2) // x - 1) % 2 == 0:
				y = ((r - 1 - x ** 2) // x - 1) // 2
				if y > 0:
					print(x, y)
					c = 1
					break
		x += 1
	if c != 1:
		print('NO')


n = int(input())
if n % 2 == 1:
	if n <= 3:
		print('NO')
	else:
		print('1 ' + str((n - 3) // 2))
else:
	print('NO')


import math
import sys
n = int(input())
for i in range(1, int(math.sqrt(n))):
	if (n - 1) % i == 0:
		out = int((n - 1) / i)
		out = out - 1
		if out > 0:
			out = out - i
			if out % 2 == 0:
				out = int(out / 2)
				if out > 0:
					print(i, end=' ')
					print(out, end='')
					sys.exit()
print('NO')


r = int(input())
flag = False
for x in range(1, int(r ** 0.5) + 1):
	y = (r - x ** 2 - x - 1) / (2 * x)
	if y <= 0:
		break
	if y == int(y):
		flag = True
		print(x, int(y))
		break
if not flag:
	print('NO')


n = int(input())
for i in range(1, 10 ** 12 + 1):
	n = n - 1 - i - i * i
	p = n // (2 * i)
	if p >= 1 and n % (2 * i) == 0:
		print(i, p)
		break
	else:
		print('NO')
		break


def divisores(n):
	resp = [1]
	i = 2
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				resp.append(i)
			else:
				resp.append(i)
				resp.append(n / i)
		else:
			resp.append(n)
			break
		i += 1
	return resp
r = int(input())
a = r - 1
div = divisores(a)
resp = 'NO'
for e in div:
	y = a / e - (e + 1)
	y /= 2
	eq = e ** 2 + 2 * e * y + e + 1
	if eq == r and y % 1 == 0 and (y > 0):
		resp = '%d %d' % (e, y)
		break
print(resp)


n = int(input()) - 1
for val in range(1, 10 ** 6):
	x = n
	Bool = False
	(A, B) = (val, 0)
	if x % val == 0 and x > 0:
		x = x // val
		x -= val + 1
		if x % 2 == 0 and x > 0:
			B = x // 2
			Bool = True
			print(A, B)
			break
if Bool == False:
	print('NO')


import math
r = int(input())
k = r - 1
root = int(math.sqrt(k))
ok = False
for x in range(1, root + 2):
	if k % x == 0:
		temp = k // x - x - 1
		if temp > 0 and temp % 2 == 0:
			ok = True
			y = temp // 2
			print(x, y)
			break
if not ok:
	print('NO')


import math
number = int(input())
found = False
for i in range(1, int(math.sqrt(number))):
	if number - i * i - 1 - i >= 0:
		y = (number - i * i - i - 1) / (2 * i)
		if y.is_integer():
			print(str(i) + ' ' + str(int(y)))
			found = True
			break
if found is False:
	print('NO')


n = int(input())
e = 0
for i in range(1, 10 ** 7):
	a = ((n - 1) / i - i - 1) / 2
	if a > 0 and int(a) == a:
		print(i, int(a))
		e = 1
		break
if e == 0:
	print('NO')


t = int(input())
if (t - 1 - 1 - 1) % 2 == 0 and t - 1 - pow(1, 2) - 1 > 0:
	print(1, (t - 1 - pow(1, 2) - 1) // 2)
else:
	print('NO')


from math import sqrt

def canHash(n):
	for i in range(1, int(sqrt(n)) + 1):
		if (n - 1) % i == 0:
			if ((n - 1) / i - i - 1) % 2 == 0 and (n - 1) / i - i - 1 > 0:
				return ' '.join([str(i), str(int((n / i - i - 1) / 2))])
	return 'NO'
print(canHash(int(input())))


r = int(input())
if r % 2 == 1 and r > 3:
	print(f'1 {int((r - 3) / 2)}')
else:
	print('NO')


from math import sqrt, ceil
r = int(input())
func = lambda x: (r - 1 - x - x * x) / 2 / x
for x in range(1, ceil(sqrt(r)) + 1):
	y = func(x)
	if y > 0 and y == int(y):
		print(x, int(y))
		return
print('NO')


import math
r = int(input())
x = 0
y = 0
ok = False
if r >= 1:
	for i in range(1, math.floor(math.sqrt(r - 1)) + 1):
		if (r - 1) % i == 0:
			dif = (r - 1) / i
			if (dif - 1 - i) % 2 == 0:
				x = i
				y = int((dif - 1 - i) // 2)
				ok = True
				break
		if ok == True:
			break
	if ok == True and x * y != 0:
		print(x, ' ', y)
	else:
		print('NO')
else:
	print('NO')


x = int(input())
if x % 2 and x > 4:
	print(1, (x - 3) // 2)
else:
	print('NO')


from __future__ import print_function
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
	return

def main():
	r = int(input())
	R = r - 1
	if R % 2 != 0:
		print('NO')
		return
	for p_small in range(1, R // 2 + 1):
		if R % p_small == 0:
			y = (R // p_small - (p_small + 1)) // 2
			if y > 0:
				print(p_small, y)
				return
	print('NO')
	return
main()


h = int(input())
if h % 2 == 0:
	print('NO')
	exit()
if h < 5:
	print('NO')
	exit()
else:
	print(1, h // 2 - 1)


import math
n = int(input())
x = math.floor(math.sqrt(n))
p = 0
for i in range(1, x):
	if (n - 1 - i ** 2 - i) % (2 * i) == 0:
		print(i, (n - 1 - i ** 2 - i) // (2 * i))
		p = 1
		break
if not p:
	print('NO')


n = int(input())
if n % 2 == 0:
	print('NO')
elif n < 5:
	print('NO')
else:
	print(1, (n - 3) // 2)


import sys
r = int(input())
for x in range(1, 10 ** 6 + 1):
	g = r - x * x - x - 1
	if g > 0 and g % (2 * x) == 0:
		print(x, g // (2 * x))
		sys.exit()
print('NO')


r = int(input())
if r == 1:
	print('NO')
	exit()
for i in range(1, int(r ** 0.5)):
	if (r - 1 - i - i ** 2) % (2 * i) == 0:
		print(i, (r - 1 - i - i ** 2) // (2 * i))
		break
else:
	print('NO')


r = int(input())
if r == 1:
	print('NO')
elif r % 2 == 0:
	print('NO')
else:
	p = r - 4
	p += 1
	if p > 0:
		print(1, p // 2)
	else:
		print('NO')


import math
n = int(input())
if n % 2 == 0:
	print('NO')
elif n == 1 or n == 3:
	print('NO')
else:
	x = 1
	y = (n - 1) // 2 - 1
	print(x, y, end=' ')


import sys

def H(x, y):
	r = x * x + 2 * x * y + x + 1
	return r

def main():
	input = sys.stdin.readline()
	r = int(input)
	x = 1
	q = r - 3
	while q > 0:
		if q % (2 * x) == 0:
			y = q // (2 * x)
			print(x, y)
			break
		else:
			x += 1
			q = r - 1 - x - x * x
	if q <= 0:
		print('NO')
main()


t = int(input())
k = t // 2 - 1
x = 1
y = k
sum = pow(x, 2) + 2 * x * y + x + 1
if sum == t and t >= 5:
	print(1, k)
else:
	print('NO')


import sys
import math
import itertools
import collections

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

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

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

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

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

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

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 wr(arr):
	return ' '.join(map(str, arr))

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

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

def ddl():
	return collections.defaultdict(list)
r = ii()
for i in range(1, int(math.sqrt(r)) + 1):
	if (r - 1) % i == 0 and ((r - 1) // i - i - 1) % 2 == 0 and (((r - 1) // i - i - 1) // 2 > 0):
		exit(print(i, ((r - 1) // i - i - 1) // 2))
print('NO')


r = int(input())
if r >= 5:
	if r % 2 == 0:
		print('NO')
	else:
		y = int((r - 3) / 2)
		print(1, '', y)
else:
	print('NO')


r = int(input())
if r % 2 == 0:
	print('NO')
else:
	for x in range(1, 1000001, 2):
		if (r - 1) // 2 % x == 0:
			y = (r - 1) // (2 * x) - (x + 1) // 2
			if y > 0:
				print(x, y)
				exit()
	print('NO')


r = int(input())
ok = True
x = 1
y = (r - x * x - x - 1) / 2 / x
while y >= 1:
	if y == int(y):
		print(x, int(y))
		ok = False
		break
	x += 1
	y = (r - x * x - x - 1) / 2 / x
if ok:
	print('NO')


r = int(input())
if r < 5:
	print('NO')
elif r % 2 == 1:
	print(1, (r - 3) // 2)
else:
	print('NO')


from sys import stdin, stdout

def main():
	(read, write, i, st, pr) = (stdin.readline, stdout.write, int, str, print)
	n = i(read())
	val = other(n)
	if not val:
		write('NO\n')
	else:
		pr(val[0], val[1])

def other(n):
	if n % 2 == 0 or (n - 3) // 2 <= 0:
		return 0
	return (1, (n - 3) // 2)
main()


import math
import sys, string, bisect, heapq
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
if n % 2 == 0 or n <= 3:
	print('NO')
else:
	print(1, (n - 3) // 2)


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR, insort as INSORT
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write
L = list
M = map

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def checkPath(source, destination, g):
	visited = [0] * 101
	q = Q()
	q.append(source)
	visited[source] = 1
	while q:
		node = q.popleft()
		if node == destination:
			return 1
		for v in g[node]:
			if not visited[v]:
				q.append(v)
				visited[v] = 1
	return 0

def makeSegments(s, n):
	seg = []
	(i, j) = (0, 0)
	while i < n and j < n:
		if s[i] == s[j]:
			j += 1
		else:
			seg.append((i, j - 1))
			i = j
	seg.append((i, j - 1))
	return seg

def main():
	r = int(INPUT())
	for x in range(1, 100000 + 1):
		check = (r - x - 1 - x ** 2) // (2 * x)
		if x ** 2 + 2 * x * check + x + 1 == r and check > 0:
			PRINT('%d %d' % (x, check))
			break
	else:
		PRINT('NO\n')
		return
main()


ans = int(input())
flag = 0
if ans > 1000000000000:
	print('NO')
elif ans > 3:
	x = 1
	y = (ans - 3) // 2
	if x ** 2 + 2 * x * y + x + 1 == ans:
		print(str(x) + ' ' + str(y))
		flag = 1
if flag == 0:
	print('NO')


import math
r = int(input())
found = False
for x in range(1, int(math.sqrt(r)) + 1):
	y = ((r - 1) / x - x - 1) / 2
	if y == int(y) and x > 0 and (y > 0):
		print(x, int(y))
		found = True
		break
if not found:
	print('NO')


r = int(input())
if r % 2 != 0 and r > 3:
	print(1, (r - 3) // 2)
else:
	print('NO')


r = int(input())
from math import sqrt

def ans(r):
	for i in range(1, int(sqrt(r))):
		val = r - (i + 1) ** 2
		if val >= 0 and val % i == 0:
			an = val // i + 1
			if an % 2 == 0:
				print(i, an // 2)
				return True
	return False
if not ans(r):
	print('NO')


n = int(input())
if n % 2 == 0:
	print('NO')
else:
	n -= 1
	x = 1
	y = n // 2 - 1
	if x <= y:
		print(x, y)
	else:
		print('NO')


r = int(input())
if r < 1:
	print('NO')
elif r == 1:
	print('NO')
else:
	x = 1
	while 1:
		y = (r - 1 - x - x ** 2) / (2 * x)
		if y <= 0:
			print('NO')
			break
		if y // 1 == y:
			print(min(x, int(y)), max(x, int(y)))
			break
		x += 1


import math
r = int(input())
flag = 0
ans = []
for j in range(1, int(1000000.0) + 1):
	val = j ** 2 + j + 1
	y = (r - val) / (2 * j)
	if y == math.ceil(y) and y > 0:
		ans = [j, int(y)]
		flag = 1
		break
if flag == 1:
	print(*ans, sep=' ')
else:
	print('NO')


from math import ceil
r = int(input())
(x, y) = (1, 1)
while y > 0:
	y = (r - x * x - x - 1) / (2 * x)
	if float(y) == ceil(y):
		break
	x += 1
print(x, int(y)) if float(y) == ceil(y) and y > 0 else print('NO')


n = int(input())
limit = int(n ** 0.5)
found = False
if n <= 4:
	print('NO')
else:
	x = 1
	while x < limit + 1:
		y = (n - (x ** 2 + x + 1)) / 2
		if y == int(y):
			found = True
			break
		x *= 2
	if found:
		print(x, int(y))
	else:
		print('NO')


h = int(input())
if h % 2 == 0:
	print('NO')
	return
if h < 5:
	print('NO')
	return
else:
	print(1, h // 2 - 1)


r = int(input())

def fe(x):
	return x * x + x + 1
f = -1
for i in range(1, int(r ** 0.5)):
	y = r - fe(i)
	if y % (2 * i) == 0:
		print(i, y // (2 * i))
		f = 0
		break
if f:
	print('NO')


import math
n = int(input())
x = math.sqrt(n) // 1
c = 0
if n % 2 == 1 and n >= 5:
	r1 = 1
	r2 = (n - 4) // 2 + 1
	c += 1
elif n % 2 == 0 and n > 5:
	for i in range(1, int(x)):
		if (n - pow(i + 1, 2)) / i - (n - pow(i + 1, 2)) // i == 0 and (n - pow(i + 1, 2)) // i % 2 == 1:
			r1 = i
			r2 = (n - pow(i + 1, 2)) // i // 2 + 1
			c += 1
			break
elif n < 5:
	c = 0
if c == 0:
	print('NO')
else:
	print(r1, r2)


r = int(input())
if not r % 2:
	print('NO')
else:
	x = 1
	y = (r - 3) // 2
	if y <= 0:
		print('NO')
	else:
		print(x, y)


import math

def solve(r):
	i = 1
	while i * i + i + 1 <= r:
		res = i * i + i + 1
		y = (r - res) / (2 * i)
		if y == int(y) and y > 0:
			print(i, int(y))
			return
		i += 1
	print('NO')
r = int(input())
if r % 2 == 0:
	print('NO')
else:
	solve(r)


n = int(input())
f = 0
for i in range(1, 1000001):
	a = n - i * i - i - 1
	b = 2 * i
	if a % b == 0 and a > 0 and (b > 0):
		f = 1
		print(i, ' ', a // b)
		break
if f == 0:
	print('NO')


def f(n):
	return ['NO'] if n % 2 == 0 or n < 5 else [1, (n - 3) // 2]
n = int(input())
print(*f(n))


def calculate(n):
	if n < 5 or n % 2 == 0:
		return 'NO'
	else:
		y = int((n - 3) / 2)
		return '1 ' + str(y)
print(calculate(int(input())))


entrada = int(input())
saida = '1'
if entrada % 2 != 0 and entrada > 3:
	entrada = entrada - 3
	print(saida, int(entrada / 2))
else:
	print('NO')


import math
n = int(input())
x = math.sqrt(n) // 1
c = 0
if n % 2 == 1 and n >= 5:
	r1 = 1
	r2 = (n - 4) // 2 + 1
	c += 1
elif n % 2 == 0 and n > 5:
	c = 0
elif n < 5:
	c = 0
if c == 0:
	print('NO')
else:
	print(r1, r2)


import math
r = int(input())

def calc_solution(x):
	return (x ** 2 + x - r + 1) / (-2 * x)
x = 1
y = calc_solution(x)
while y - int(y) != 0 and y >= 1:
	x += 1
	y = calc_solution(y)
if y >= 1:
	print(x, int(y))
else:
	print('NO')


n = int(input())
r = int(n ** 0.5) + 1
if n % 2 == 0:
	print('NO')
else:
	(a1, a2) = (0, 0)
	for i in range(1, r):
		p = i ** 2
		if (n - i - 1 - p) % (2 * i) == 0 and n - i - 1 - i ** 2 > 0:
			a1 = (n - i - 1 - i ** 2) / (2 * i)
			a2 = i
			break
	l = []
	l.append(int(a1))
	l.append(int(a2))
	l.sort()
	if a1 == 0 or a2 == 0:
		print('NO')
	else:
		print(*l)


def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def factors(n):
	super = [1]
	for i in prime_factors(n):
		super.extend([j * i for j in super])
	return list(sorted(set(super)))
n = int(input())
n -= 1
OK = False
for i in factors(n):
	if n // i - i > 0 and (n // i - i) % 2 == 1 and (i > 0) and ((n // i - i) // 2 > 0):
		print('{} {}'.format(i, (n // i - i) // 2))
		OK = True
		break
if not OK:
	print('NO')


r = int(input())
if r % 2 == 0:
	print('NO')
else:
	k = (r - 1) // 2 - 1
	if k > 0:
		print(1, k)
	else:
		print('NO')


n = int(input())
if n & 1 and n > 4:
	print('1 ' + str((n - 3) // 2))
else:
	print('NO')


r = int(input())
ans = []
if r == 1:
	print('NO')
	exit()
for i in range(1, r):
	if (r - 1) % i == 0:
		x = i
		ans.append(x)
		quo = (r - 1) // x
		y = quo - x - 1
		if y == 0:
			print('NO')
			exit()
		elif y % 2 == 0:
			y = y // 2
			ans.append(y)
			break
		else:
			print('NO')
			exit()
print(*ans)


from sys import setcheckinterval, stdin
setcheckinterval(1000)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
r = iin()
if r > 4 and r % 2:
	print(1, (r - 1) // 2 - 1)
else:
	print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
r = inp()
if r % 2 != 0 and r > 3:
	y = int((r - 3) / 2)
	print(1, y)
else:
	print('NO')


import math
r = int(input())
paresDivisores = []
for i in range(1, int(math.sqrt(r - 1)) + 1):
	if (r - 1) % i == 0:
		paresDivisores.append([i, (r - 1) // i])
res = 'NO'
for i in paresDivisores:
	x = i[1] - i[0] - 1
	if x != 0 and x % 2 == 0:
		res = str(i[0]) + ' ' + str(x // 2)
		break
print(res)


import math

def check(x, y):
	n21 = (y - 1 - x) / 2
	n22 = (x - 1 - y) / 2
	if n21 == int(n21):
		return (1, n21)
	if n22 == int(n22):
		return 2
	return ('No', 'No')

def findfac(n):
	n = n - 1
	for i in range(1, int(math.sqrt(n))):
		if n % i == 0:
			f1 = i
			f2 = n // i
			(c, ans) = check(f1, f2)
			if c == 1:
				print(f1, int(ans))
				return
			elif c == 2:
				print(f2, int(ans))
				return
	print('NO')
	return
n = int(input())
findfac(n)


n = int(input())
print(['NO', '1 ' + str(n // 2 - 1)][n & 1 & (n > 3)])


import sys
from collections import defaultdict
n = int(input())
if n % 2 == 0:
	print('NO')
elif n == 1 or n == 3:
	print('NO')
else:
	y = (n - 2) // 2
	print('1', y)


r = int(input())
if r & 1:
	t = (r - 3) // 2
	if t > 0:
		print(1, (r - 3) // 2)
	else:
		print('NO')
else:
	print('NO')


r = int(input())
if r < 5 or r % 2 == 0:
	print('NO')
else:
	print(1, end=' ')
	print(int((r - 3) / 2))


def function(n):
	if n % 2 == 0:
		return 'NO'
	if int((n - 3) / 2) > 0:
		return f'{1} {int((n - 3) / 2)}'
	return 'NO'
n = int(input())
print(function(n))


N = int(input())
num = N - 1
if num <= 3 or num % 2 == 1:
	print('NO')
	quit()
x = 1
y = (num - 2) // 2
print(x, y)


r = int(input())
a = []
b = []
r = r - 1
c = int((-1 + pow(1 + 4 * r, 0.5)) // 2)
for i in range(1, c + 1):
	if (r - i - i * i) % (2 * i) == 0 and r > i + i * i:
		a.append((r - i - i * i) // (2 * i))
		b.append(i)
		break
if len(a) == 1:
	print(b[0], a[0])
else:
	print('NO')


r = int(input())

def factorise(n):
	factors = []
	guess = 3
	while guess < n:
		exponent = 1
		while n % guess == 0:
			factors.append(guess ** exponent)
			n //= guess
			factors.append(n)
			exponent += 1
		guess += 2
	return sorted(factors)
if r % 2 == 1:
	x = 1
	y = (r - 3) // 2
	if y > 0:
		print(x, y)
	else:
		print('NO')
else:
	print('NO')


import functools
import math
import sys
from collections import defaultdict
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def solve(r):
	if r == 1:
		return 'NO'
	x = 1
	while x * x < r:
		if r - x * x - 1 - x != 0 and (r - x * x - 1 - x) % (2 * x) == 0:
			return f'{x} {(r - x * x - 1 - x) // (2 * x)}'
		x += 1
	return 'NO'

def main():
	r = ri()
	print(solve(r))
main()


import sys
r = int(sys.stdin.readline().strip())
a = 1
while True:
	if a * (a + 3) > r:
		sys.stdout.write('NO\n')
		break
	if (r - 1) % a == 0:
		b = (r - 1) // a
		if (b - a) % 2 == 1:
			sys.stdout.write('{0} {1}\n'.format(a, (b - a - 1) // 2))
			break
	a += 1


n = int(input())
if n % 2 == 0:
	print('NO')
else:
	n -= 1
	n -= 2
	jam = int(n // 2)
	if jam > 0:
		print(1, jam)
	else:
		print('NO')


n = int(input())
print(['NO', '1 %d' % (n // 2 - 1)][n & 1 & (n > 3)])


r = int(input())
if r == 1:
	print('NO')
elif r % 2 != 0:
	x = 1
	y = (r - 3) // 2
	if x >= 1 and y >= 1:
		print(x, y)
	else:
		print('NO')
else:
	print('NO')


n = int(input())
a = int(((4 * n - 3) ** 0.5 - 1 - 0.5) // 2)
for i in range(1, a + 1):
	b = n - i * i - i - 1
	if b % (2 * i) == 0:
		print(i, int(b / (2 * i)))
		exit(0)
print('NO')


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

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

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

def li():
	return [int(i) for i in 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
r = ii()
if r % 2 == 0:
	print('NO')
else:
	y = (r - 3) // 2
	if y > 0:
		print(1, y)
	else:
		print('NO')


n = int(input())
if 1 + 2 * ((n - 3) // 2) + 1 + 1 == n and n > 3:
	print(1, (n - 3) // 2)
else:
	print('NO')


import sys
from collections import Counter
import itertools
from math import floor, ceil

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

def dinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rt(x1, x2, y3):
	print(0.5 * (x2 + x1))

def main():
	y = int(input())
	i = 1
	t = 0
	r = 1
	if y % 2 == 1 and y >= 5:
		print(1, (y - 3) // 2)
	else:
		print('NO')
main()


r = int(input())
x = 0
y = 0
for i in range(1, int(r ** 0.5) + 1):
	y = r - (i * i + i + 1)
	if y % (2 * i) == 0 and y > 0:
		y = y // (2 * i)
		x = i
		break
if x == 0 or y == 0:
	print('NO')
else:
	print(x, y)


n = int(input())
if n == 1:
	print('NO')
	exit()
for i in range(1, 1000001):
	if (n - pow(i, 2) - i - 1) % (2 * i) == 0 and (n - pow(i, 2) - i - 1) // (2 * i) > 0:
		print(i, (n - pow(i, 2) - i - 1) // (2 * i))
		exit()
print('NO')


import sys
r = int(sys.stdin.readline())
if r % 2 == 0 or r < 5:
	print('NO')
else:
	r -= 1
	print(1, (r - 2) // 2)


r = int(input())
q = r - 1
x = 1
while x * x <= q:
	if q % x == 0:
		if (q - x - x * x) % (2 * x) == 0:
			y = (q - x - x * x) // (2 * x)
			if y > 0:
				print(x, y)
				exit()
	x += 1
print('NO')


def main():
	r = int(input())
	if r == 1 or r == 0:
		print('NO')
		return 0
	for x in range(1, int(r ** 0.5 + 1)):
		a = r - x * (x + 1) - 1
		b = 2 * x
		if a % b == 0 and a // b > 0:
			print(x, a // b)
			return 0
	print('NO')
main()


import sys
import math
import bisect

def solve(n):
	for x in range(1, math.floor(math.sqrt(n)) + 1):
		tmp = n - x ** 2 - x - 1
		if tmp % (2 * x) == 0:
			y = tmp // (2 * x)
			if y > 0:
				return (x, y)
	return None

def main():
	n = int(input())
	ans = solve(n)
	if ans:
		print('%d %d' % (ans[0], ans[1]))
	else:
		print('NO')
main()


from sys import stdin
from math import sqrt, ceil
input = stdin.readline
r = int(input())
yy = int(sqrt(r))
for x in range(1, yy):
	y = (r - x ** 2 - x - 1) / (2 * x)
	if ceil(y) == y:
		print(x, int(y))
		exit()
print('NO')


codigo = int(input())
aux = False
if codigo % 2 == 0:
	aux = True
else:
	chave = (codigo - 3) // 2
	if chave > 0:
		print(1, chave)
	else:
		aux = True
if aux:
	print('NO')


x = int(input())
if x % 2 == 0 or x == 1 or x == 3:
	print('NO')
	exit()
else:
	print(1, (x - 3) // 2)


import math

def habijabi(x):
	return x * x + x + 1

def ok(a, b, c):
	x = (a - b) % (2 * c)
	return x
r = int(input(''))
flag = 1
for i in range(1, int(math.sqrt(r)) + 1):
	det = habijabi(i)
	if det < r:
		if ok(r, det, i) == 0:
			print(i, int((r - det) / (2 * i)))
			flag = 0
			break
if flag:
	print('NO')


r = int(input())
for x in range(1, 10 ** 6):
	if (r - (x ** 2 + x + 1)) % (x << 1) == 0:
		y = (r - (x ** 2 + x + 1)) // (x << 1)
		if y > 0:
			print(x, y)
			break
else:
	print('NO')


from math import *
import time
t1 = time.time()
r = int(input())
v = int(sqrt(r)) + 1
for i in range(1, v + 1):
	val = r - (i * i + i + 1)
	v1 = 2 * i
	if val <= 0:
		print('NO')
		break
	elif val % v1 == 0:
		print(i, val // v1)
		break


r = int(input())
c = 0
n = r // 2
if r % 2 == 0:
	print('NO')
else:
	z = (r - 3) // 2
	if z > 0:
		print(1, z)
	else:
		print('NO')


import math
r = int(input())
k = r - 1
raiz = int(math.sqrt(k))
ok = 0
for x in range(1, raiz + 2):
	if k % x == 0:
		t = k / x - x - 1
		if t > 0 and t % 2 == 0:
			ok = 1
			y = int(t / 2)
			print(x, y)
			break
if ok == 0:
	print('NO')


import math
r = int(input())
(k, root, ok) = (r - 1, int(math.sqrt(r - 1)), False)
for i in range(1, root + 1):
	if k % i == 0:
		t = k // i - i - 1
		if t > 0 and t % 2 == 0:
			ok = True
			y = t // 2
			print(f'{i} {y}')
			break
if not ok:
	print('NO')


r = int(input())
if r % 2 == 0:
	print('NO')
else:
	(x, y) = (0, 0)
	r = r - 1
	co = 0
	n = int(r / 2)
	for i in range(1, n):
		if r % i == 0:
			x = i
			t = r / x - x - 1
			if t % 2 == 0:
				y = int(t / 2)
				co = 1
				break
	if co == 1:
		print(x, y)
	else:
		print('NO')


n = int(input())
if n < 4:
	print('NO')
else:
	R = n - 3
	if R % 2 != 0:
		print('NO')
	else:
		print('1', R // 2)


r = int(input())
i = 1
flag = 0
while i <= int(r ** 0.5):
	y = (r - i - i * i - 1) / (2 * i)
	if y == int(y) and y > 0:
		print(i, int(y))
		flag = 1
		break
	else:
		flag = 0
	i += 1
if flag == 0:
	print('NO')


r = int(input())
ans = 'NO'
for i in range(1, 3 * int(r ** 0.5)):
	d = r - 1 - i - i ** 2
	if d < 1:
		break
	elif d % (i * 2) == 0:
		ans = (i, d // (i * 2))
		break
if ans == 'NO':
	print(ans)
else:
	print(*ans)


r = int(input())
x = 1
while x * x < r:
	d = r - x * x - x - 1
	if d >= x * 2 and 0 == d % (x * 2):
		print(x, d // (x * 2))
		break
	x += 1
else:
	print('NO')


a = int(input())
if a % 2 and a > 3:
	print(1, (a - 3) // 2)
else:
	print('NO')


from math import sqrt
n = int(input())
if n % 2 == 0:
	print('NO')
	exit()
mi = 10000000000
n -= 1
b = 0
for i in range(1, int(sqrt(n))):
	if n % i == 0:
		y = (n - i - i ** 2) / (2 * i)
		if y == int(y):
			if i < mi:
				mi = i
				b = int(y)
if mi == 10000000000:
	print('NO')
	exit()
print(mi, b)


a = int(input())
b = int((a - 3) / 2)
if a & 1 and b > 0:
	print('{} {}'.format(1, b))
else:
	print('NO')


n = int(input())
i = 1
while i * i < n:
	l = n - i * i - i - 1
	if l > 0 and l % (2 * i) == 0:
		print(i, l // (2 * i))
		break
	i += 1
else:
	print('NO')


n = int(input())
if n % 2 == 0 or n <= 3:
	print('NO')
	exit()
print(1, (n - 3) // 2)


import math
r = int(input())
flag = False
u_limit = math.ceil((-1 + (4 * r - 3) ** 0.5) / 2)
for x in range(1, u_limit):
	y = (r - (x ** 2 + x + 1)) / (2 * x)
	if y == round(y):
		print(x, end=' ')
		print(round(y))
		flag = True
		break
if flag == False:
	print('NO')


r = int(input())
if r % 2 == 0 or r < 5:
	print('NO')
else:
	Y = int((r - 3) / 2)
	X = 1
	print(X, Y)


r = int(input())
if r % 2:
	if r == 1 or r == 3:
		print('NO')
	else:
		print('1', (r - 3) // 2)
else:
	print('NO')


from math import sqrt
r = int(input())
a = r - 1
raiz = int(sqrt(a))
existe = False
for x in range(1, raiz + 2):
	if a % x == 0:
		t = a / x - x - 1
		if t > 0 and t % 2 == 0:
			existe = True
			y = int(t / 2)
			print(x, y)
			break
if not existe:
	print('NO')


import math
n = int(input())
n = n - 1
x = 1
while x < math.sqrt(n):
	if n % x == 0:
		if n / x - x - 1 > 0 and (n / x - x - 1) % 2 == 0:
			print(x, ' ', int((n / x - x - 1) / 2))
			exit()
	x += 1
print('NO')


from math import sqrt

def get_int():
	from sys import stdin
	return int(stdin.readline().replace('\n', ''))

def is_even(n):
	return n % 2 == 0

def heidi_hash(r):
	k = r - 1
	rt = int(sqrt(k))
	for x in range(1, rt + 2):
		if k % x == 0:
			temp = k / x - x - 1
			if temp > 0 and is_even(temp):
				return (x, int(temp / 2))
	return 'NO'
r = get_int()
res = heidi_hash(r)
print(res[0], res[1]) if type(res) != type('') else print(res)


r = int(input())
if r > 3 and r % 2 == 1:
	print('1 {}'.format(int((r - 3) // 2)))
else:
	print('NO')


r = int(input())
for x in range(1, 1000000):
	if r > (x + 1) * (x + 1) and (r - (x + 1) * (x + 1)) % x == 0:
		t = (r - (x + 1) * (x + 1)) // x
		if t >= 1 and t % 2 != 0:
			print(x, (t + 1) // 2)
			exit()
print('NO')


from math import *
r = int(input())
r -= 1
e = False
xx = 0
yy = 0
for i in range(1, int(sqrt(r)) + 1):
	i1 = i
	r1 = r
	if r1 % i1 == 0:
		r1 = r1 / i1
		if r1 - i1 - 1 > 0 and (r1 - i1 - 1) % 2 == 0:
			xx = i1
			yy = (r1 - i1 - 1) // 2
			e = True
			break
if not e:
	print('NO')
else:
	print(xx, int(yy))


from math import sqrt
r = int(input())
ok = 0
for x in range(1, int(sqrt(r))):
	y = r - 1 - x - x * x
	y /= 2 * x
	if y == int(y):
		ok = 1
		print(x, ' ', int(y))
		break
if ok == 0:
	print('NO')


from math import *
r = int(input())
point = True
for x in range(1, int(sqrt(r)) + 1):
	y = (r - x ** 2 - x - 1) / 2 / x
	if int(y) == y and y > 0:
		print(x, int(y))
		point = False
		break
if point:
	print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

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

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

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
max_x = ceil(sqrt(n))
for x in range(1, max_x + 1):
	H = n - x * x - x - 1
	if H > 0 and H % 2 == 0:
		H //= 2
		if H % x == 0:
			print(x, H // x)
			exit()
print('NO')


def resp(k):
	raiz = int(k ** 0.5) + 2
	for x in range(1, raiz):
		if k % x == 0:
			dy = k / x - x - 1
			if dy > 0 and dy % 2 == 0:
				print(x, int(dy / 2))
				return
	print('NO')
r = int(input())
resp(r - 1)


r = int(input())
x = 0
res = ''
loop = True
while loop:
	x += 1
	y = (r - x ** 2 - x - 1) / (2 * x)
	if y <= 0:
		loop = False
		res = 'NO'
		break
	if y == int(y):
		loop = False
		res = '%d %d' % (x, y)
print(res)


n = int(input())
n -= 1
f = 0
ss = int(n ** 0.5)
ss += 1
for i in range(1, ss):
	if n % i == 0:
		x = i
		a = n // x
		a = n - x - 1
		y = a // 2
		a = a / 2
		if a == y and y > 0:
			f = 1
			break
if f:
	print(x, y)
else:
	print('NO')


from math import sqrt
r = int(input())
simp = r - 1
raiz = int(sqrt(simp))
ok = 0
for x in range(1, raiz + 2):
	if simp % x == 0:
		dobro = simp // x - x - 1
		if dobro > 0 and dobro % 2 == 0:
			ok = 1
			y = dobro // 2
			print(x, y)
			break
if ok == 0:
	print('NO')


import math

def funcao(r):
	if r % 2 == 0 or r == 1 or r == 3:
		return [-1, -1]
	limite = (math.sqrt(4 * r - 3) + 1) // 2
	x = 1
	while x < limite:
		y = (r - (x ** 2 + x + 1)) // 2
		return [x, y]
		x += 1
	return [-1, -1]
r = int(input())
res = funcao(r)
if res[0] == -1:
	print('NO')
else:
	print(*res)


def H(x, r):
	r -= x
	r -= x * x
	r -= 1
	if r < 0:
		return (False, False, 0)
	if r % (x * 2) == 0:
		return (True, True, r // (x * 2))
	return (False, True, 1)
r = int(input())
if r == 1:
	print('NO')
else:
	x = 1
	fl = False
	for i in range(r):
		(a, b, y) = H(x, r)
		if a != False and y > 0:
			fl = True
			break
		elif b == False:
			break
		x += 1
	if fl:
		print(x, y)
	else:
		print('NO')


r = int(input())
y = 0
x = 1
cnt = 0
while True:
	y = (r - 1 - x - x * x) / (2 * x)
	s = int(y)
	if y <= 0:
		break
	if y == s:
		cnt = 1
		break
	else:
		x += 1
if cnt == 1:
	print(x, s)
else:
	print('NO')


import sys
import os
from io import IOBase, BytesIO

def main():
	r = int(input())
	x = 1
	while True:
		curr = r - (x ** 2 + x + 1)
		if curr <= 0:
			break
		if curr // (2 * x) == curr / (2 * x):
			print(x, curr // (2 * x))
			return
		x += 1
	print('NO')
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):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			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))

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

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

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


from sys import stdin
import math
INF = float('inf')

def main():
	n = int(stdin.readline().strip()) - 1
	t = int(math.sqrt(n))
	t = t // 2
	count = 1
	ans = INF
	while count <= t:
		x = n - count - count * count
		r = 2 * count
		if x % r == 0:
			print(count, x // r)
			return
		count += 1
	print('NO')
main()


from sys import stdin, stdout

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	r = rsingle_int()
	if r % 2 == 0:
		print('NO')
	elif r == 1 or r == 3:
		print('NO')
	else:
		y = int((r - 3) / 2)
		print('{} {}'.format(1, y))
main()


r = int(input())
if r % 2 == 0:
	print('NO')
elif r == 1:
	print('NO')
elif r == 3:
	print('NO')
else:
	print(1, end=' ')
	print((r - 3) // 2)


from sys import *
from math import *
from sys import stdin, stdout
from collections import *
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
n = int(input())
if n - 3 >= 2 and (n - 3) % 2 == 0:
	print(1, (n - 3) // 2)
else:
	print('NO')


from math import ceil
r = int(input())
for i in range(1, 10 ** 6 + 1):
	y = (r - i * i - i - 1) / 2
	if ceil(y) > y or y <= 0:
		continue
	print(i, int(y))
	exit()
print('NO')


n = int(input())
if n % 2 == 0 or n < 5:
	print('NO')
else:
	d = n - 1
	print(1, d // 2 - 1)


n = int(input())
if n & 1 and n >= 5:
	print(1, (n - 5) // 2 + 1)
else:
	print('NO')