Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction $\frac{a}{b}$ is called proper iff its numerator is smaller than its denominator (a < b) and that the fraction is called irreducible if its numerator and its denominator are coprime (they do not have positive common divisors except 1).

During his free time, Petya thinks about proper irreducible fractions and converts them to decimals using the calculator. One day he mistakenly pressed addition button ( + ) instead of division button (÷) and got sum of numerator and denominator that was equal to n instead of the expected decimal notation. 

Petya wanted to restore the original fraction, but soon he realized that it might not be done uniquely. That's why he decided to determine maximum possible proper irreducible fraction $\frac{a}{b}$ such that sum of its numerator and denominator equals n. Help Petya deal with this problem.

 


-----Input-----

In the only line of input there is an integer n (3 ≤ n ≤ 1000), the sum of numerator and denominator of the fraction.


-----Output-----

Output two space-separated positive integers a and b, numerator and denominator of the maximum possible proper irreducible fraction satisfying the given sum.


-----Examples-----
Input
3

Output
1 2

Input
4

Output
1 3

Input
12

Output
5 7

Source: codeforces | Difficulty: EASY
Tags: Complete search

Mathematics

Constructive algorithms


Solutions:
n = int(input())
if 3 <= n <= 1000:
	if n % 2 == 1:
		print(int((n - 1) / 2), int((n + 1) / 2))
	elif n % 4 == 2:
		print(int(n / 2 - 2), int(n / 2 + 2))
	elif n % 4 == 0:
		print(int(n / 2 - 1), int(n / 2 + 1))


def is_irr(a, b):
	bb = True
	for i in range(2, min(a, b) + 1):
		if a % i == 0 and b % i == 0:
			bb = False
			break
	return bb
n = int(input())
for i in range(n // 2, 0, -1):
	num = i
	div = n - i
	if is_irr(num, div):
		print(num, div)
		break


from math import gcd
n = int(input())
i = n // 2
for a in range(i + 1, 0, -1):
	if gcd(a, n - a) == 1 and a < n - a:
		print(a, n - a)
		break


def gcd(a, b):
	while b > 0:
		a %= b
		(a, b) = (b, a)
	return a
n = int(input())
if n % 2 == 1:
	(a, b) = (n // 2, n // 2 + 1)
else:
	(a, b) = (n // 2, n // 2)
	while gcd(a, b) != 1:
		a -= 1
		b += 1
print(a, b)


n = int(input())
if n % 2 == 1:
	print(int(n / 2), int(n / 2) + 1)
elif (n // 2 - 1) % 2 == 1 and (n // 2 + 1) % 2 == 1:
	print(n // 2 - 1, n // 2 + 1)
else:
	print(n // 2 - 2, n // 2 + 2)


from math import gcd
number = int(input())
if number % 2 != 0:
	a = number // 2
	b = a + 1
else:
	(a, b) = (number // 2, number // 2)
while gcd(a, b) != 1:
	a -= 1
	b += 1
print(a, b)


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
n = int(input())
(a, b) = (1, n - 1)
(ma, mb) = (a, b)
while a < b:
	if gcd(a, b) == 1:
		(ma, mb) = (a, b)
	a += 1
	b -= 1
print(ma, mb)


import math
import fractions
n = int(input())
ans = fractions.Fraction(1, n)
for i in range(1, n // 2 + 1):
	if math.gcd(i, n - i) == 1:
		d = fractions.Fraction(i, n - i)
		if d > ans:
			ans = d
print(d.numerator, d.denominator)


n = int(input())
d = int(n / 2)
if n % 2 == 1:
	print(d, d + 1)
elif d % 2 == 0:
	print(d - 1, d + 1)
else:
	print(d - 2, d + 2)


N = int(input())
if N % 2 == 0:
	if N // 2 % 2 == 0:
		print(N // 2 - 1, N // 2 + 1)
	else:
		print(N // 2 - 2, N // 2 + 2)
else:
	print((N + 1) // 2 - 1, (N + 1) // 2)


def NOD(a, b):
	while a > 0 and b > 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
n = int(input())
a = 1
b = n - 1
maximal = []
while b > a:
	if NOD(a, b) == 1:
		maximal = [a, b]
	b = b - 1
	a = a + 1
print(maximal[0], maximal[1])


import math
n = int(input())
for num in range(1, n):
	if 2 * num > n and math.gcd(n - num, num) == 1:
		print(n - num, num)
		break


n = int(input())
if n % 2 == 0:
	if n // 2 % 2 == 0:
		b = n // 2 + 1
		a = n // 2 - 1
	else:
		b = n // 2 + 2
		a = n // 2 - 2
else:
	b = n // 2 + 1
	a = n // 2
print(a, b)


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

def isProper(nu, de):
	return nu < de

def isIrreducible(nu, de):
	return gcd(nu, de) == 1
num = int(input())
nu = 0
de = 0
for a in range(1, num):
	if isProper(a, num - a) and isIrreducible(a, num - a):
		nu = a
		de = num - a
print('{0} {1}'.format(nu, de))


from math import gcd

def solve(n):
	maxi = 0
	v = 0
	for i in range(1, n):
		if i < n - i and gcd(i, n - i) == 1:
			maxi = max(maxi, i / (n - i))
			v = (i, n - i)
	return v

def main():
	n = int(input())
	print(*solve(n))
main()


n = int(input())
m = 0
if n % 2 == 0:
	(a, b) = (n // 2 - 1, n // 2 + 1)
else:
	(a, b) = (n // 2, n // 2 + 1)
while m != 1:
	for i in range(1, b + 1):
		if a % i == 0 and b % i == 0:
			m = m + 1
	if m == 1:
		print(a, b)
	else:
		(a, b) = (a - 1, b + 1)
		m = 0


q = int(input(''))
a = q // 2
b = q - a
if q == 3:
	print('1 2')
elif q % 2 != 0:
	print(a, b, end=' ')
elif a % 2 == 0 and b % 2 == 0:
	print(a - 1, b + 1, end=' ')
else:
	print(a - 2, b + 2, end=' ')


def test_1():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	if n % 2 == 0:
		if n / 2 % 2 == 0:
			aa = (n / 2 - 1, n / 2 + 1)
		else:
			aa = (n / 2 - 2, n / 2 + 2)
	else:
		aa = (n / 2, n / 2 + 1)
	print(' '.join(map(str, map(int, aa))))
test_1()


from fractions import gcd
n = int(input())
(a, b) = (n // 2, n // 2 + n % 2)
while gcd(a, b) != 1:
	b -= 1
	a += 1
print(*[[b, a], [a, b]][n % 2])


n = int(input())
if n % 2 == 0:
	if n // 2 % 2 != 0:
		print(n // 2 - 2, n // 2 + 2)
	else:
		print(n // 2 - 1, n // 2 + 1)
else:
	print(n // 2, n // 2 + 1)


from fractions import gcd
n = input()
n = int(n)
if n % 2 == 0:
	a = n / 2 - 1
	b = n / 2 + 1
else:
	a = (n - 1) / 2
	b = (n + 1) / 2
while gcd(a, b) > 1:
	a = a - 1
	b = b + 1
print(int(a), int(b))


import sys
from math import *

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a
n = mint()
(ba, bb) = (0, n)
for i in range(1, n):
	if i >= n - i:
		break
	if gcd(i, n - i) == 1 and ba * (n - i) < i * bb:
		ba = i
		bb = n - i
print(ba, bb)


a = input().strip()
d = int(a)
if d >= 3 and d <= 1000:
	if d % 2 == 0:
		b = d // 2 - 1
		c = d - b
	else:
		b = d // 2
		c = d - b
	if b % 2 == 0 and c % 2 == 0:
		b = b - 1
		c = c + 1
	print(str(b) + ' ' + str(c))


import math
n = int(input())
for i in range(n // 2, 0, -1):
	if math.gcd(i, n - i) == 1:
		print(i, n - i)
		break


n = int(input())
if n % 2 == 1:
	print((n - 1) // 2, (n + 1) // 2)
elif n % 4 == 0:
	print(n // 2 - 1, n // 2 + 1)
else:
	print(n // 2 - 2, n // 2 + 2)


n = int(input())
o = n % 2
a = (n - o) // 2
b = n - a
if a == b:
	a = a - 1
	b = b + 1
m1 = 1
m2 = 10000

def NOD(a, b):
	res = 0
	(x, y) = (a, b)
	while res == 0:
		if b % a == 0:
			res = 1
			nod = a
		else:
			b = b % a
			if a > b:
				(a, b) = (b, a)
	if nod == 1:
		return [x, y]
	else:
		return [-1, -1]
arr = [[-1 for i in range(2)] for i in range(1000)]
i = 0
while b != n:
	arr[i] = NOD(a, b)
	a -= 1
	b += 1
	i += 1
for i in range(len(arr)):
	(a, b) = (arr[i][0], arr[i][1])
	if a != -1 or b != -1:
		c1 = m1 * b
		d1 = a * m2
		if d1 >= c1:
			m1 = a
			m2 = b
print(m1, m2)


n = int(input())

def f(a, b):
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	return a + b
a = n // 2
b = n - n // 2
while f(a, b) != 1:
	a -= 1
	b += 1
print(a, b)


n = int(input())
gcd = lambda a, b: a if b == 0 else gcd(b, a % b)
for a in range(n - 1, 0, -1):
	if gcd(a, n - a) == 1 and a < n - a:
		print(a, n - a)
		break


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
(a, b) = (n // 2, n // 2 + n % 2)
while gcd(a, b) > 1:
	a -= 1
	b += 1
print(a, b)


a = int(input())
if a % 2 != 0:
	b = int(a / 2)
	print(b, end=' ')
	print(b + 1)
elif int(a / 2) % 2 == 0:
	c = int(a / 2)
	print(c - 1, end=' ')
	print(c + 1)
else:
	d = int(a / 2)
	print(d - 2, end=' ')
	print(d + 2)


n = int(input())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
ans = (0, 0)
for a in range(1, n + 1):
	for b in range(a + 1, n + 1):
		if a + b == n and gcd(a, b) == 1:
			ans = (a, b)
print(ans[0], ans[1])


import math
a = int(input())
if a % 2 == 0:
	b = a / 2
	c = a / 2
else:
	b = math.floor(a / 2)
	c = math.floor(a / 2) + 1
while 1:
	b1 = b
	c1 = c
	while c1 != 0:
		d = b1 % c1
		b1 = c1
		c1 = d
	if b1 == 1:
		break
	b -= 1
	c += 1
print(int(b), int(c))


import sys

def main():
	n = int(sys.stdin.read().strip())
	t = n // 2
	if n % 2:
		return (t, t + 1)
	return (t - 1 - t % 2, t + 1 + t % 2)
print(*main())


from math import gcd as bltin_gcd

def coprime2(a, b):
	return bltin_gcd(a, b) == 1
n = int(input())
de = n // 2 - (n + 1) % 2
nom = n // 2 + 1
while not coprime2(de, nom):
	de -= 1
	nom += 1
print(de, nom)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
for i in range(1, n):
	if i > n - i and gcd(i, n - i) == 1:
		print(n - i, i)
		break


from math import sqrt

def divs(x):
	divs = []
	for r in range(2, int(sqrt(x)) + 1):
		if x % r == 0:
			divs.append(r)
	divs.append(x)
	return divs
n = int(input())
for r in range(int(n / 2), n):
	if (n - r) % r != 0:
		if (n - r) / r < 1:
			if set(divs(n - r)).isdisjoint(divs(r)):
				print(str(n - r) + ' ' + str(r))
				break


from fractions import gcd
n = int(input())
for a in range(n // 2, -1, -1):
	b = n - a
	if gcd(a, b) == 1:
		print(a, b)
		break


a = int(input())
if a / 2 == a // 2:
	if (a - 2) / 4 == (a - 2) // 4:
		print(str(a // 2 - 2) + ' ' + str(a // 2 + 2))
	else:
		print(str(a // 2 - 1) + ' ' + str(a // 2 + 1))
else:
	print(str(a // 2) + ' ' + str(a // 2 + 1))


import sys
input = sys.stdin.readline
from fractions import gcd

def main():
	a = int(input())
	b = []
	for i in range(1, a + 1):
		if gcd(i, a - i) == 1 and i < a - i:
			b.append([i / (a - i), [i, a - i]])
	b.sort()
	print(b[-1][1][0], b[-1][1][1])
main()


def main():
	n = int(input())
	if n % 2 == 1:
		a = n // 2
	elif n % 4 == 0:
		a = n // 2 - 1
	else:
		a = n // 2 - 2
	print(a, n - a)
main()


import math
import os
import random
import re
from sys import stdin, stdout
from collections import Counter

def si():
	return str(input())

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

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

def li():
	return list(mi())
n = ii()
for i in range(1, n // 2 + 1):
	for j in range(n // 2, n):
		if math.gcd(i, j) == 1 and i + j == n:
			p = i
			q = j
			break
print(p, q)


from fractions import gcd
n = int(input())
maxi = 0
for i in range(1, n // 2 + 1, 1):
	if gcd(n - i, i) == 1:
		maxi = i
print(str(maxi) + ' ' + str(n - maxi))


from math import gcd
a = int(input())
s = a // 2
while s > 0:
	if gcd(s, a - s) == 1:
		print(s, a - s)
		break
	s = s - 1


def gdc(a, b):
	if b == 0:
		return a
	return gdc(b, a % b)
n = int(input())
a = n // 2
b = n - a
while gdc(a, b) != 1:
	a = a - 1
	b = b + 1
print(a, b)


m = int(input())

def mcd(m, n):
	while n > 0:
		aux = m % n
		m = n
		n = aux
	return m
n = m // 2
while n > 0:
	if mcd(n, m - n) == 1:
		print(n, m - n)
		break
	n -= 1


n = int(input())
r = n // 2 + 1
l = n - r
if r % 2 == 0 and r - l == 2:
	l -= 1
	r += 1
print(l, r)


x = eval(input())
if x % 2 == 1:
	y = x // 2
	print(y, y + 1)
elif x % 4 == 0:
	print(x // 2 - 1, x // 2 + 1)
else:
	print(x // 2 - 2, x // 2 + 2)


n = int(input())
x = n // 2
if x % 2 == 0 and n % 2 == 0:
	print(x - 1, x + 1)
elif x % 2 == 0 and n % 2 == 1:
	print(x, x + 1)
elif x % 2 == 1 and n % 2 == 1:
	print(x, x + 1)
elif x % 2 == 1 and n % 2 == 0:
	print(x - 2, x + 2)


import os
import sys
from math import gcd

def is_coprime(a, b):
	return gcd(a, b) == 1

def find_fraction(n):
	for i in range(n // 2, 1, -1):
		if is_coprime(i, n - i) and i != n - i:
			return '{} {}'.format(i, n - i)
	return '1 {}'.format(n - 1)
t = int(input())
result = find_fraction(t)
print(result)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
num = n // 2 + n % 2 - 1
den = n - (n // 2 + n % 2 - 1)
while gcd(den, num) != 1:
	num -= 1
	den += 1
print(num, den)


x = int(input())
from math import gcd
j = x // 2
while 1:
	if gcd(j, x - j) == 1:
		print(*sorted([j, x - j]))
		break
	else:
		j -= 1


A = int(input())
arr = range(1, int(A / 2) + 1)
arr2 = range(int(A / 2) + 1, A)
res = ''
for (a, i) in zip(arr, reversed(arr2)):
	final = False
	for x in range(len(arr)):
		if (a % (x + 2) == 0 and i % (x + 2) == 0) and i + a == A:
			final = True
	if not final:
		res = str(a) + ' ' + str(i)
	final = False
print(res)


a = int(input())
chisl = 1
znam = a - 1
Max = 0
flag = True
Maxchisl = 0
Maxznam = 0
for i in range(a):
	for z in range(2, a // 2):
		if chisl % z == 0 and znam % z == 0:
			flag = False
	if chisl < znam and flag != False:
		if chisl / znam > Max:
			Max = chisl / znam
			Maxchisl = chisl
			Maxznam = znam
	if chisl < znam:
		chisl += 1
		znam -= 1
	flag = True
print(Maxchisl, Maxznam)


import math
flag = 0
n = int(input())
x = 0
y = 0
for i in range(1, n):
	for j in range(i + 1, n):
		if i + j == n and math.gcd(i, j) == 1:
			x = i
			y = j
			flag = 1
			break
if flag >= 1:
	print(x, y)


from math import gcd
n = int(input())
res = []
mid = n // 2
for i in range(mid, 0, -1):
	if gcd(i, n - i) == 1:
		print(i, n - i)
		break


n = int(input())
s = n / 2

def nod(a, b):
	while a != b:
		if a > b:
			a = a - b
		else:
			b = b - a
	return a
if s % 1 != 0:
	a = s // 1
	b = a + 1
else:
	a = s // 1 - 1
	b = s // 1 + 1
while True:
	if nod(a, b) != 1:
		a -= 1
		b += 1
	else:
		break
print(int(a), int(b))


from math import gcd
n = int(input())
(max_i, max_j) = (1, 2)
for i in range(1, 1000):
	if i == n:
		break
	for j in range(i + 1, 1000):
		if i + j == n and gcd(i, j) == 1:
			(max_i, max_j) = (i, j)
print(max_i, ' ', max_j)


import math
a = int(input())
b = a // 2
c = a - a // 2
while math.gcd(b, c) != 1:
	b = b - 1
	c = c + 1
print(b, c)


def is_irreducible(num1, num2):
	for j in range(2, num1 + 1):
		if num1 % j == 0 and num2 % j == 0:
			return False
	return True
n = int(input())
result = ''
for i in range(1, n):
	num1 = i
	num2 = n - i
	if num1 > num2:
		break
	if is_irreducible(num1, num2):
		result = str(num1) + ' ' + str(num2)
print(result)


import math
n = int(input())
num = int(n / 2)
while num > 0:
	den = n - num
	if math.gcd(den, num) == 1:
		print(num, den)
		break
	num -= 1


n = int(input())

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
if n % 2:
	print(n // 2, n // 2 + 1)
else:
	for i in range(int(n / 2 + 1), n):
		if gcd(n - i, i) == 1:
			print(n - i, i)
			break


n = int(input())

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
ans = None
for i in range(n):
	if i >= n - i:
		break
	if gcd(i, n - i) == 1:
		ans = [i, n - i]
print(ans[0], ans[1])


def simp(a, b):
	for i in range(2, min(a, b) + 1):
		if a % i == 0 and b % i == 0:
			return False
	return True
n = int(input())
for i in range(1, n):
	if i != 1 and simp(i, n - i) and (i > n // 2):
		print(min(n - i, i), max(n - i, i))
		break
else:
	print(1, n - 1)


import math
n = int(input())
a = []
if n == 3:
	print(1, 2)
if n == 4:
	print(1, 3)
if n > 4:
	for i in range(1, 1000):
		for j in range(1, 1000):
			if i < j:
				if i + j == n:
					if math.gcd(i, j) == 1:
						x = i
						y = j
	print(x, y)


from fractions import gcd
import math
n = int(input())
a = 0
b = 0
x = int(n / 2) + 1
for i in range(1, x):
	if gcd(i, n - i) == 1:
		a = i
		b = n - i
print(a, b)


import math

def is_coprime(x, y):
	return math.gcd(x, y) == 1

def isPrime(x):
	isPrime = True
	if x == 2:
		return True
	for i in range(2, x):
		if x != 2 and x % i == 0:
			isPrime = False
			break
	return isPrime
n = int(input())
result = {0}
brekar = False
for prime in reversed(range(n)):
	for prime1 in reversed(range(n)):
		if prime + prime1 == n and prime < prime1 and is_coprime(prime, prime1):
			result.pop()
			result.add(prime)
			result.add(prime1)
			brekar = True
			break
	if brekar:
		break
final = list(result)
final.sort()
print(final[0], final[1])


n = int(input())
for i in range(n, 0, -1):
	flag = True
	if i < n - i:
		for j in range(2, i + 1):
			if i % j == 0 and (n - i) % j == 0:
				flag = False
				break
		if flag:
			print(i, n - i)
			break


import math
n = int(input())
a = n // 2
while math.gcd(a, n - a) != 1:
	a -= 1
print(a, n - a)


n = int(input())
x = n // 2
l = [0, 0]
if n & 1 == 0:
	if x & 1 != 0:
		print(x - 2, x + 2)
	else:
		print(x - 1, x + 1)
else:
	print(x, x + 1)


n = int(input())
from fractions import gcd
a = int(n / 2)
while True:
	if gcd(a, n - a) == 1:
		break
	else:
		a -= 1
print(a, end=' ')
print(n - a)


from math import gcd
n = int(input())

def irr(a, b):
	if gcd(a, b) == 1:
		return True
	else:
		return False
for i in range(n // 2 + 1, n):
	if irr(i, n - i):
		print(n - i, i)
		break


import math
n = int(input())
if n % 2 == 0:
	a = n // 2 - 1
	b = n // 2 + 1
else:
	a = n // 2
	b = n // 2 + 1
flag = 0
while flag == 0:
	if math.gcd(a, b) == 1:
		print(a, b)
		flag = 1
	else:
		a = a - 1
		b = b + 1


def getD(num):
	arr = []
	if num % 2 != 0:
		temp = int((num + 1) / 2)
	else:
		temp = int(num / 2) + 1
	for i in range(2, temp):
		if num % i == 0 and i not in arr:
			arr.append(i)
	return arr

def mos(n1, n2):
	n1arr = getD(n1)
	n2arr = getD(n2)
	if len(n1arr) >= len(n2arr):
		x = n2arr
		d = n1arr
		l = len(x)
	else:
		x = n1arr
		d = n2arr
		l = len(x)
	for i in range(l):
		if x[i] in d:
			return False
	return True
x = int(input())
if x % 2 == 0:
	fz = int(x / 2)
	fm = int(x / 2)
else:
	fz = int(x / 2)
	fm = int(x / 2) + 1
for i in range(1, x):
	if fm % fz != 0 and mos(fz, fm):
		print(fz, fm)
		break
	elif fz == 1:
		print(fz, fm)
		break
	fz = fz - 1
	fm = fm + 1


n = int(input())
a = n // 2 + n % 2 - 1
i = 2
while i <= a:
	if a % i == 0 and (n - a) % i == 0:
		a -= 1
		i = 2
	else:
		i += 1
print(a, n - a)


n = int(input())
for i in range(1, n, 1):
	b = i
	a = n - i
	b1 = i
	a2 = n - i
	while a > 0 and b > 0:
		if b > a:
			b = b % a
		else:
			a = a % b
	if a + b == 1 and b1 > 0 and (a2 > 0) and (a2 < b1):
		print(a2, ' ', b1)
		break


import math
n = int(input())
h = n // 2
h += 1
l = n - h
while math.gcd(h, l) != 1:
	h += 1
	l -= 1
print(l, h)


from math import gcd
n = int(input())
if n % 2:
	print(n // 2, n // 2 + 1)
else:
	i = n // 2 - 1
	k = n - i
	while gcd(i, k) != 1:
		i -= 1
		k += 1
	print(i, k)


n = int(input())
if n % 2 == 1:
	print(n // 2, n // 2 + 1)
	exit()
if n // 2 % 2 - 1 == 0:
	print(n // 2 - 2, n // 2 + 2)
	exit()
print(n // 2 - 1, n // 2 + 1)


import math

def gcd(a, b):
	while b != 0:
		t = a
		a = b
		b = t % b
	return a

def isCoprime(a, b):
	return gcd(a, b) == 1
n = int(input())
if n % 2 == 0:
	a = int(n / 2) - 1
	b = int(n / 2) + 1
else:
	a = int(math.floor(n / 2))
	b = int(math.ceil(n / 2))
while a > 0 and b < n:
	if isCoprime(a, b):
		print(str(a) + ' ' + str(b))
		break
	a -= 1
	b += 1


n = int(input())
a = n // 2
if n / 2 % 2 == 1:
	print(a - 2, a + 2)
elif n & 1:
	print(a, a + 1)
else:
	print(~-a, -~a)


import sys, math

def arrayInput(TYPE):
	return [TYPE(x) for x in input().split()]

def CF():
	n = int(input())
	l = 1
	r = n - 1
	while l < r:
		if l + r == n:
			if math.gcd(l, r) == 1:
				mxl = l
				mxr = r
			l += 1
			r -= 1
		elif l + r > n:
			r -= 1
		else:
			l += 1
	print(mxl, mxr)
CF()


n = int(input())
(a, b) = (0, 1)
for i in range(1, n // 2 + 1):
	(x, y) = (i, n - i)
	d = 1
	while x != 0 and y != 0:
		if x > y:
			x %= y
		else:
			y %= x
	if x != 0:
		d = x
	else:
		d = y
	if d == 1 and i / (n - i) > a / b:
		a = i
		b = n - i
print(a, b)


from operator import itemgetter
n = int(input())
num = n // 2
num2 = 0
if n % 4 == 2:
	num2 = num + 2
	num -= 2
elif n % 2 == 0:
	num2 = num + 1
	num -= 1
else:
	num2 = num + 1
print(num, num2)


n = int(input())
lista = [i for i in range((n + 1) // 2, 0, -1) if i < n - i]
(a, b) = (0, 0)

def div(a, b):
	for i in range(2, a + 1):
		if a % i == 0 and b % i == 0:
			return True
	return False
for i in range(len(lista)):
	(a, b) = (lista[i], n - lista[i])
	if div(a, b) == False:
		break
print(a, b)


import sys
l = sys.stdin.readline()
if int(l) / 2 == int(l) // 2:
	if (int(l) // 2 - 1) % 2 == 0:
		i = int(l) // 2 - 2
	else:
		i = int(l) // 2 - 1
else:
	i = int(l) // 2
j = int(l) - i
print(i, j)


summ = int(input())
if summ % 2 == 0:
	if summ / 2 % 2 == 0:
		b = int(summ / 2 + 1)
		a = int(summ / 2 - 1)
	else:
		b = int(summ / 2 + 2)
		a = int(summ / 2 - 2)
else:
	summ += 1
	b = int(summ / 2)
	a = int(summ / 2 - 1)
print(a, b)


from math import gcd
s = int(input())
ans = -1
get = []
for i in range(1, s):
	if gcd(i, s - i) == 1 and i < s - i and (i / (s - i) > ans):
		ans = i / (s - i)
		get = [i, s - i]
print(get[0], get[1])


n = int(input())
if n % 2 == 1:
	N = n // 2
	D = n - N
else:
	N = n // 2 - 1
	while N % 2 == 0:
		N = N - 1
	D = n - N
print(N, D)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
m = n // 2
if n % 2 == 0:
	p = m - 1
	q = m + 1
	while gcd(p, q) != 1:
		p -= 1
		q += 1
	print(p, q)
else:
	p = m
	q = m + 1
	while gcd(p, q) != 1:
		p -= 1
		q += 1
	print(p, q)


import math as m
n = int(input())
l = n / 2
if n % 2 != 0:
	print(n // 2, m.ceil(n / 2))
elif l % 2 == 0:
	print(int(n // 2) - 1, n // 2 + 1)
else:
	print(n // 2 - 2, n // 2 + 2)


import math
n = int(input())
(a, b) = (math.floor(n / 2), math.ceil(n / 2))
if a == b:
	a -= 1
	b += 1
	if a % 2 == 0:
		a -= 1
		b += 1
print(a, b)


def findAll(num):
	a = 1
	b = num - 1
	res = []
	while a != b and b != a - 1:
		res.append((a, b))
		a += 1
		b -= 1
	return res

def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
num = int(input())
if num == 3:
	print('1 2')
else:
	all = findAll(num)
	for i in range(len(all) - 1, -1, -1):
		(a, b) = all[i]
		if i == 0:
			print(str(a) + ' ' + str(b))
			break
		if computeGCD(a, b) == 1:
			print(str(a) + ' ' + str(b))
			break


n = eval(input())
if n == 3:
	a = 1
	b = 2
else:
	a = n // 2
	b = n - a
	if a % 2 == 0 and b % 2 == 0:
		a -= 1
		b = n - a
	elif a % b == 0:
		a -= 2
		b = n - a
print(a, b)


n = int(input())
ax = -1
bx = -1
flag = 1
mx = 0
for i in range(1, int(n / 2) + 1):
	a = i
	b = n - i
	flag = 1
	if a >= b:
		break
	for k in range(2, a + 1):
		if a % k == 0 and b % k == 0:
			flag = 0
	if flag == 1:
		if a / b > mx:
			mx = a / b
			ax = a
			bx = b
print('{} {}'.format(ax, bx))


n = int(input())
if n % 2 == 1:
	pembilang = n // 2
	penyebut = n - pembilang
else:
	pembilang = n // 2 - 1
	while pembilang % 2 == 0:
		pembilang -= 1
	penyebut = n - pembilang
print(pembilang, penyebut)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
for i in range(1, n + 1):
	for j in range(i + 1, n + 1):
		if i is not j:
			if gcd(i, j) == 1 and i + j == n:
				xi = i
				xj = j
print(xi, xj)


n = int(input())
if n % 2:
	print(str(n // 2) + ' ' + str(n - n // 2))
elif (n // 2 - 1) % 2 == 0 and (n // 2 + 1) % 2 == 0:
	print(str(n // 2 - 2) + ' ' + str(n // 2 + 2))
else:
	print(str(n // 2 - 1) + ' ' + str(n // 2 + 1))


from math import gcd
n = int(input())
ans = (1, n - 1)
for a in range(1, n // 2 + 1):
	b = n - a
	if gcd(a, b) == 1:
		ans = (a, b)
print(*ans)


import math

def fun(y, a, b):
	for j in range(2, y):
		if a % j == 0 and b % j == 0 or a == b:
			return True
	return False
n = int(input())
k = math.ceil(n / 2)
y = k
m = n - k
u = 0
for i in range(k):
	if fun(n, k, m) == False:
		if u == 0:
			print(m, k)
			break
		else:
			print(k, m)
			break
	else:
		m += 1
		k -= 1
		u += 3


from math import gcd as g
n = int(input())
ans1 = 0
ans2 = 0
for i in range(1, n // 2 + 1):
	a = i
	b = n - i
	if a < b and g(a, b) == 1:
		ans1 = a
		ans2 = b
print(ans1, ans2)


import math
n = int(input())
m = 0
x = 0
y = 0
for i in range(1, n, 1):
	b = n - i
	if math.gcd(i, b) == 1 and i / b > m and (i / b < 1):
		x = i
		y = b
		m = x / y
print(x, y)


def consist(numb):
	solutions = [[i, numb - i] for i in range(1, int(numb / 2) + 1)]
	return solutions

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

def prime(solutions):
	results = []
	for solution in solutions:
		if solution[0] < solution[1] and gcd(solution[0], solution[1]) == 1:
			results.append(solution)
	return results
input = int(input())
solutions = prime(consist(input))
print(solutions[len(solutions) - 1][0], solutions[len(solutions) - 1][1])


suma = int(input())
if suma % 2 == 0:
	a = int(suma / 2 + 1)
	b = int(suma / 2 - 1)
else:
	a = int((suma + 1) // 2)
	b = int(suma / 2)
while True:
	if a % 2 == 0 and b % 2 == 0:
		a += 1
		b = b - 1
	elif a % 3 == 0 and b % 3 == 0:
		a += 1
		b = b - 1
	elif a % 5 == 0 and b % 5 == 0:
		a += 1
		b = b - 1
	elif a % 7 == 0 and b % 7 == 0:
		a += 1
		b = b - 1
	elif a % 11 == 0 and b % 11 == 0:
		a += 1
		b = b - 1
	else:
		break
print(str(b) + ' ' + str(a))


import math
x = int(input())
n = x // 2
d = x - x // 2
while True:
	if math.gcd(n, d) != 1:
		n -= 1
		d += 1
	else:
		print(n, d)
		break


n = int(input())
if n % 2 == 0:
	r = n // 2
else:
	r = n // 2 + 1
for i in range(1, r):
	a = i
	b = n - i
	f = 0
	for j in range(2, min(a, b) + 1):
		if a % j == 0 and b % j == 0:
			f = 1
	if f == 0:
		a1 = a
		b1 = b
print(a1, b1)


N = int(input())
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503]
for a in range(N // 2, 0, -1):
	b = N - a
	for p in primes:
		if a % p == 0 and b % p == 0:
			break
	else:
		print(a, b)
		break


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
gosa = 1.0 / 10 ** 10
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	n = I()
	a = n // 2
	b = n - a
	while fractions.gcd(a, b) > 1:
		a -= 1
		b += 1
	return '{} {}'.format(a, b)
print(main())


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
n = int(input())
if n & 1:
	print(n // 2, n // 2 + 1)
else:
	for m in range(n // 2, 0, -1):
		if math.gcd(m, n - m) == 1:
			print(m, n - m)
			break


from math import gcd
n = int(input())
m = n // 2 if n % 2 > 0 else n // 2 - 1
for a in range(m, 1, -1):
	b = n - a
	if gcd(a, b) == 1:
		print(str(a) + ' ' + str(b))
		exit()
print('1 ' + str(n - 1))


from math import gcd
n = int(input())
bound = n // 2 if n % 2 == 1 else n // 2 - 1
for i in range(bound, 0, -1):
	if gcd(i, n - i) == 1:
		(a, b) = (i, n - i)
		break
print(a, b)


from math import *
n = int(input())
max1 = 0
for i in range(1, n):
	if i / (n - i) > max1 and i / (n - i) < 1 and (gcd(i, n - i) == 1):
		max1 = i / (n - i)
		(a, b) = (i, n - i)
print(a, b)


n = int(input())

def easyest(a, b):
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	if a + b == 1:
		return True
	else:
		return False
x = 0
for j in range(n // 2, n):
	if easyest(n - j, j):
		x = j
		break
print(min(x, n - x), max(x, n - x))


from fractions import gcd
sum = input()
sum = int(sum)
div = sum / 2
i = 1
gcdFlag = True
a = 0
b = 0
while gcdFlag:
	a = int(div - i)
	b = int(div + i)
	if sum % 2 != 0:
		a += 1
	if gcd(a, b) <= 1:
		gcdFlag = False
	else:
		i += 1
print(a, ' ', b)


import math

def splitting(x):
	anb = list()
	for i in range(1, x // 2 + 1):
		anb.append([i, x - i])
	return anb

def findMaxFraction(fracList):
	maxFraction = list()
	for i in fracList:
		if math.gcd(i[0], i[1]) == 1:
			maxFraction = i
	return maxFraction
n = int(input())
simpleFraction = findMaxFraction(splitting(n))
print(simpleFraction[0], simpleFraction[1])


from math import gcd
n = int(input())
for i in range(n):
	if n - i < i and gcd(n - i, i) == 1:
		print(n - i, i)
		exit()


def hcf(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
if n % 2 == 0:
	a = n // 2 - 1
	b = n // 2 + 1
else:
	a = n // 2
	b = a + 1
while True:
	if hcf(a, b) == 1:
		print(a, b)
		break
	else:
		a -= 1
		b += 1


s = int(input())
fa = 0
fb = 0
for a in range(1, s // 2 + 1):
	b = s - a
	for i in range(2, a + 1):
		if a / i == a // i and b / i == b // i:
			a = 1
			break
	if a > fa and a != b:
		fa = a
		fb = b
print(str(fa) + ' ' + str(fb))


import math

def f1(n):
	return ((n - 1) // 2, (n + 2) // 2)

def f2(n):
	ans = (0, 1)
	for i in range(n // 2 + 1, n):
		j = n - i
		if math.gcd(i, j) == 1 and j / i > ans[0] / ans[1]:
			ans = (j, i)
	return ans
n = int(input())
print(*f2(n))


x = int(input())
if x % 2 == 0 and x / 2 % 2 == 0:
	a = int(x / 2) - 1
elif x % 2 == 0 and x / 2 % 2 == 1:
	a = int(x / 2) - 2
else:
	a = int(x / 2)
print(f'{a} {x - a}')


from math import ceil
from math import gcd as bltin_gcd

def coprime2(a, b):
	return bltin_gcd(a, b) == 1
arr = []
arr1 = []
a = int(input())
for i in range(a):
	if coprime2(i, a - i) == True:
		arr.append(i)
		arr1.append(a - i)
if len(arr) > 1 and len(arr) % 2 == 0:
	print(arr[int(len(arr) / 2) - 1], arr1[int(len(arr1) / 2) - 1])
else:
	print(arr[math.ceil(len(arr) / 2)], arr1[math.ceil(len(arr1) / 2)])


def cal(a, b):
	for i in range(2, min(a, b) + 1):
		if a % i == 0 and b % i == 0:
			return False
	return True
n = int(input())
if n % 2:
	a = (n - 1) // 2
	b = (n + 1) // 2
else:
	a = n // 2 - 1
	b = n // 2 + 1
while a > 0:
	if cal(a, b):
		print(a, b)
		break
	a -= 1
	b += 1


num = int(input())
if num >= 3 and num <= 1000:
	if num / 2 == num // 2:
		a = int(num / 2 - 1)
		b = int(num - a)
		while a >= 1:
			w = 2
			while w < b:
				if a / w == a // w and b / w == b // w:
					a = a - 1
					b = b + 1
					break
				w = w + 1
			if w == b:
				print(str(a) + ' ' + str(b))
				break
	else:
		a = int(num // 2)
		b = int(num - a)
		while a >= 1:
			w = 2
			while w < b:
				if a / w == a // w and b / w == b // w:
					a = a - 1
					b = b + 1
					break
				w = w + 1
			if w == b:
				print(str(a) + ' ' + str(b))
				break


n = int(input())

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
ans = 1
i = 1
while i < n - i:
	a = i
	b = n - i
	if gcd(a, b) == 1:
		ans = i
	i += 1
print(ans, n - ans)


from math import gcd
n = int(input())
(m, a, b) = (-1, 0, 0)
for i in range(2, n):
	j = n - i
	if i < j:
		continue
	if gcd(j, i) == 1:
		o = j / i
		if m < o:
			(m, a, b) = (o, j, i)
print(a, b)


n = int(input())
a = n // 2
b = n // 2 + 1
if n % 2 == 0:
	if n % 4 == 0:
		print(a - 1, b, sep=' ')
	else:
		a = n // 2 - 2
		b = n // 2 + 2
		print(a, b, sep=' ')
else:
	print(a, b, sep=' ')


import sys
from math import gcd as bltin_gcd

def coprime2(a, b):
	return bltin_gcd(a, b) == 1
input_data = sys.stdin.readline().strip()
number = int(input_data)
accepted = list()
for i in range(1, int(number / 2) + 1):
	j = number - i
	if coprime2(i, j):
		accepted.append((i, j))
s = sorted(accepted, key=lambda x: x[0] / x[1])
print(s[-1][0], s[-1][1])


n = int(input())

def gcd(big: int, small: int) -> int:
	tmp = 1
	while tmp > 0:
		tmp = big % small
		(big, small) = (small, tmp)
	return big
for i in range(n // 2 + 1, 0, -1):
	for j in range(i + 1, n):
		if gcd(j, i) != 1:
			continue
		if i + j == n:
			print(i, j)
			exit(0)


n = int(input())
for a in range(n // 2, 0, -1):
	j = n - a
	i = a
	while i != 0 and j != 0:
		if i > j:
			i = i % j
		else:
			j = j % i
	nod = i + j
	if nod == 1:
		print(a, n - a)
		break


from math import gcd
n = int(input())
(a, b) = (1, n - 1)
for c in range(1, n):
	if gcd(c, n - c) == 1 and c < n - c:
		(a, b) = (c, n - c)
print(a, b)


def mcd(A, B):
	resto = A % B
	while resto > 0:
		resto = A % B
		A = B
		B = resto
	return A
n = int(input())
mayor = 0
numerador = 1
denominador = 2
while numerador < n and numerador < denominador:
	denominador = n - numerador
	if mcd(numerador, denominador) == 1:
		if numerador / denominador > mayor:
			mayor = numerador / denominador
			nu = numerador
			de = denominador
	numerador = numerador + 1
print(nu, de)


from sys import stdout
from random import randint
from math import *
import re
n = int(input())
mx = 0
mx = mxb = 0
for a in range(1, (n + 1) // 2):
	b = n - a
	t = gcd(a, b)
	if t == 1 and mx < a / b:
		mx = a / b
		mxa = a
		mxb = b
print(mxa, mxb)


from fractions import gcd
m = -1
a = -1
b = 1
n = int(input())
for i in range(n // 2, -1, -1):
	if gcd(i, n - i) == 1 and i != n - i:
		if i / (n - i) > m:
			m = i / (n - i)
			a = i
			b = n - i
print(a, b)


gcd = lambda a, b: gcd(b, a % b) if b else a
n = int(input())
for (a, b) in zip(range((n - 1) // 2, 0, -1), range((n + 2) // 2, n)):
	if gcd(a, b) == 1:
		print(a, b)
		break


import math
import collections
import bisect
import heapq
import time
import random
import itertools
N = int(input())

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if a % b == 0:
		return b
	return gcd(b, a % b)
for a in range(N // 2, -1, -1):
	b = N - a
	if gcd(b, a) == 1:
		print(a, b)
		exit(0)


from math import gcd
n = int(input())
if n % 2 == 0:
	a = n // 2 - 1
	b = n // 2 + 1
else:
	a = (n - 1) // 2
	b = (n + 1) // 2
while True:
	if gcd(a, b) == 1:
		print(a, b)
		exit()
	else:
		a -= 1
		b += 1


import math
n = int(input())
a = n // 2
b = n - n // 2
while a > 0:
	if math.gcd(a, b) == 1:
		print(a, b)
		exit()
	a -= 1
	b += 1


import sys
import os
import math
import re
n = int(input())
a = n // 2
b = n - a
while math.gcd(a, b) != 1:
	a -= 1
	b += 1
print(a, b)


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

def main():
	n = int(input())
	res = (0, 1)
	for i in range(1, n):
		(a, b) = (i, n - i)
		if b <= a:
			break
		g = gcd(a, b)
		if g != 1:
			continue
		if a * res[1] > b * res[0]:
			res = (a, b)
	print(res[0], res[1])
main()


def solve(n):
	if n % 2 != 0:
		first = n // 2
		second = n - first
	else:
		res = n // 2
		com = res % 2 + 1
		first = res - com
		second = res + com
	return (first, second)
n = int(input())
(a, b) = solve(n)
print(a, b)


from math import gcd
n = int(input())
fracs = []
for a in range(1, n):
	b = n - a
	if gcd(a, b) == 1 and a < b:
		fracs.append([a, b])
max_a = None
max_b = None
max_frac = -1
for frac in fracs:
	value = frac[0] / frac[1]
	if value > max_frac:
		max_frac = value
		max_a = frac[0]
		max_b = frac[1]
print(max_a, max_b)


def isCoprime(a, b):
	num = gcd(a, b)
	if num != 1:
		return False
	else:
		return True

def gcd(a, b):
	if b == 0:
		return a
	else:
		r = a % b
		return gcd(b, r)
total = int(input())
result = []
a = 1
b = total - a
while a + b == total and a < b:
	if isCoprime(a, b):
		result.append((a, b))
	a += 1
	b = total - a
for i in result:
	num = 0
	maxFracttion = 0
	recent = i[0] / i[1]
	if recent > num:
		num = recent
		maxFraction = i
print(maxFraction[0], maxFraction[1])


def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)
n = int(input())
if n % 2 == 0:
	t = int(n / 2)
	i = 1
	while i < t:
		if gcd(t - i, t + i) == 1:
			print(t - i, t + i)
			break
		i += 1
else:
	t = int(n / 2)
	i = 1
	j = 0
	while t + i < n:
		if gcd(t - j, t + i) == 1:
			print(t + 1 - i, t + i)
			break
		i += 1
		j += 1


from fractions import gcd
n = int(input())
a = n // 2 + n % 2 - 1
b = n // 2 + 1
if (n - 2) % 4 == 0:
	a -= 1
	b += 1
print(a, b)


from math import gcd

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

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

def minp():
	return map(int, input().split(' '))
ls = []
n = inp()
for i in range(n // 2 + 1):
	k = n - i
	if gcd(k, i) == 1:
		ls.append(max(k, i))
ls = sorted(ls)
print(n - ls[0], end=' ')
print(ls[0])


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

def getirr(num):
	if num % 2 == 0:
		a = num // 2
		b = num // 2
	else:
		a = num // 2
		b = num // 2 + 1
	while GCD(a, b) != 1:
		a -= 1
		b += 1
	return str(a) + ' ' + str(b)
while True:
	try:
		case = input()
		temp = int(case)
		print(getirr(temp))
	except EOFError:
		break


n = int(input())
zn = (n + 1) // 2
ch = n - zn
if n % 2 == 0:
	zn += 1
	ch -= 1
if zn % 2 == 0 and ch % 2 == 0:
	zn += 1
	ch -= 1
print(ch, zn)


n = int(input())

def gcd(x, y):
	p = max(x, y)
	q = min(x, y)
	r = p % q
	while r > 0:
		p = q
		q = r
		r = p % q
	return q
a = n // 2
b = n - a
while gcd(a, b) > 1:
	a -= 1
	b += 1
print(a, b)


n = int(input())
m = 0
l = []
for i in range(1, n // 2 + 1):
	for j in range(1, n):
		x = 0
		d = []
		if i + j == n and i < j and (i / j > m):
			for a in range(2, i + 1):
				if i % a == 0:
					d.append(a)
			for a in d:
				if j % a == 0:
					x = 1
			if x == 1:
				continue
			else:
				m = i / j
				l = [i, j]
print(*l)


import math
n = int(input())
if n % 2 == 0:
	l = n / 2
else:
	l = (n + 1) / 2
max_value = 0
a1 = 0
b1 = 0
for i in range(int(l)):
	a = i
	b = n - i
	if math.gcd(a, b) != 1:
		continue
	elif a / b > max_value:
		max_value = a / b
		a1 = a
		b1 = b
print(a1, b1)


def Check(t1, t2):
	for j in range(2, min(t1, t2) + 1):
		if t1 % j == 0 and t2 % j == 0:
			return False
	return True
n = int(input())
if n % 2 == 1:
	print(n // 2, n // 2 + 1)
	exit()
else:
	for i in range(n // 2 + 1, n + 1):
		if Check(i, n - i) == True:
			print(n - i, i)
			exit()


import math
ps = [2]

def prim():

	def isPrime(n):
		for p in ps:
			if n % p is 0:
				return False
			if p >= math.sqrt(n + 1):
				return True
	for i in range(3, 1000):
		if isPrime(i):
			ps.append(i)

def irreducible(a, b):
	for p in ps:
		if a % p == 0 and b % p == 0:
			return False
		if p >= min(a, b):
			return True
n = int(input())
prim()
last_i = 0
for i in range((n + 1) // 2):
	if irreducible(i, n - i):
		last_i = i
print(last_i, n - last_i)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst = []
if n % 2 == 0:
	Upto = n // 2
else:
	Upto = n // 2 + 1
for i in range(1, Upto):
	if i < n - i and math.gcd(i, n - i) == 1:
		lst.append([i, n - i, i / (n - i)])
lst.sort(key=lambda x: x[2])
print(lst[-1][0], lst[-1][1])


from sys import stdin, stdout
import math
n = int(stdin.readline().rstrip())
if n % 2 == 0:
	n1 = n // 2
else:
	n1 = n // 2
foundGCD = False
for i in range(n1, 1, -1):
	n2 = n - i
	if math.gcd(i, n2) == 1:
		foundGCD = True
		print(str(i) + ' ' + str(n2))
		break
if not foundGCD:
	print(str(1) + ' ' + str(n - 1))


def pgcd(a, b):
	p = 1
	for i in range(2, min(a + 1, b + 1)):
		if a % i == 0 and b % i == 0:
			p = i
	return p
n = int(input())
(m, j) = (0, 0)
for i in range(1, n // 2 + 1):
	if pgcd(i, n - i) == 1:
		m = max(m, i / (n - i))
		j = i
print(j, n - j)


num = int(input())
a = num // 2
if a * 2 == num:
	a = a - 1
	while a // 2 == a / 2:
		a = a - 1
b = num - a
print(str(a) + ' ' + str(b))


a = int(input())
thesum = 0
if a % 2 == 0:
	firstnumber = int(a / 2)
	secondnumber = int(a / 2)
elif a % 2 == 1:
	firstnumber = int((a - 1) / 2)
	secondnumber = int((a + 1) / 2)
killnumber = 0
primenumber = 2
rocketnumber = 0
while rocketnumber == 0:
	while killnumber == 0 and primenumber <= firstnumber:
		if firstnumber % primenumber == 0 and secondnumber % primenumber == 0:
			killnumber = 1
		else:
			primenumber = primenumber + 1
	if killnumber == 1:
		firstnumber = firstnumber - 1
		secondnumber = secondnumber + 1
		primenumber = 2
		killnumber = 0
	else:
		rocketnumber = 1
print(str(firstnumber) + ' ' + str(secondnumber))


from math import gcd
n = int(input())
n2 = n // 2
for x in range(n2, 0, -1):
	y = n - x
	if gcd(x, y) == 1:
		print('%s %s' % (x, y))
		break


while True:
	try:
		n = int(input())
		if n % 2 == 0:
			n = n / 2
			tp = n % 2
			if tp == 0:
				print('{} {}'.format(int(n - 1), int(n + 1)))
			else:
				print('{} {}'.format(int(n - 2), int(n + 2)))
		else:
			print('{} {}'.format(int(n / 2), int(n / 2 + 1)))
	except:
		break


import math
n = int(input())
half = 0
if n % 2 == 0:
	half = n // 2 - 1
else:
	half = n // 2
r = True
while half > 1:
	r = False
	if math.gcd(half, n - half) == 1 and r == False:
		print(half, n - half)
		break
	else:
		r = True
	half -= 1
if r == True:
	print(half, n - half)


import math
n = int(input())
answer = 0
numerator = 0
denominator = 0
for a in range(1, 1001):
	for b in range(a + 1, 1001):
		if a + b == n:
			if math.gcd(a, b) == 1:
				if a / b > answer:
					answer = a / b
					numerator = a
					denominator = b
print(numerator, denominator)


import math
n = int(input())
m = -10
for i in range(1, n + 1):
	if i < n - i and math.gcd(i, n - i) == 1:
		m = max(m, i)
print(str(m) + ' ' + str(n - m))


n = int(input())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
max = 1
for i in range(1, n // 2 + 1):
	if gcd(i, n - i) == 1:
		max = i
print(max, n - max)


from sys import stdin, stdout

def GCD(a, b):
	if not b:
		return a
	else:
		return GCD(b, a % b)
n = int(stdin.readline())
ans = []
for i in range(n - 1, 1, -1):
	if i > n - i and GCD(n - i, i) == 1:
		ans.append((n - i, i))
ans = max(ans, key=lambda x: x[0] / x[1])
stdout.write(str(ans[0]) + ' ' + str(ans[1]))


n = int(input())
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
for i in range(n // 2, 0, -1):
	good = True
	a = i
	b = n - i
	if a >= b:
		continue
	for p in primes:
		if a % p == 0 and b % p == 0:
			good = False
			break
	if good:
		print(a, b)
		exit()


t = int(input())
if t % 2:
	print(t // 2, t // 2 + 1)
elif t // 2 % 2 == 0:
	print(t // 2 - 1, t // 2 + 1)
else:
	print(t // 2 - 2, t // 2 + 2)


def gcd(a, b):
	if b < a:
		return gcd(b, a)
	if b % a == 0:
		return a
	return gcd(b % a, a)
total = int(input())
num = total // 2
den = total - num
while True:
	if gcd(num, den) == 1:
		print(num, den)
		break
	num -= 1
	den += 1


from math import *
n = int(input())
if n % 4 == 0:
	print(n // 2 - 1, n // 2 + 1)
elif n % 4 == 2:
	print(n // 2 - 2, n // 2 + 2)
else:
	print(n // 2, n // 2 + 1)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

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

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

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

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

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

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

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	for i in range(n // 2, 0, -1):
		if math.gcd(i, n - i) == 1:
			print(*sorted([i, n - i]))
			break
for _ in range(1):
	solve()


def coprime(a, b):
	for i in range(2, max(a, b)):
		if a % i == 0 and b % i == 0:
			return False
	return True
n = int(input().strip())
a = None
b = None
z = None
for i in range(1, n):
	for j in range(i + 1, n):
		if i + j != n:
			continue
		k = i / j
		if z != None and k < z:
			continue
		if not coprime(i, j):
			continue
		a = i
		b = j
		z = k
print('{} {}'.format(a, b))


n = int(input())

def find_dev(a: int) -> set:
	ans = set()
	for i in range(2, a + 1):
		while a != 1 and a % i == 0:
			a = a / i
			ans.add(i)
	return ans

def is_common_devisor(a: int, b: int) -> bool:
	s1 = find_dev(a)
	s2 = find_dev(b)
	return len(s1.intersection(s2)) > 0

def solve(n: int):
	for i in range(n - 1, 0, -1):
		for j in range(n, 0, -1):
			if i < j and i + j == n and (not is_common_devisor(i, j)):
				return (i, j)
ans = solve(n)
print(f'{ans[0]} {ans[1]}')


import fractions
n = int(input())
for i in range(n // 2, 0, -1):
	g = int(fractions.gcd(i, n - i))
	if g == 1:
		print(i, ' ', n - i)
		break


x = eval(input())
a = 0
b = 0
if x % 2 == 0:
	a = x // 2 - 1
	b = x // 2 + 1
else:
	a = (x + 1) // 2 - 1
	b = (x + 1) // 2
if a % 2 == 0 and b % 2 == 0:
	a -= 1
	b += 1
print(a, b)


def gcd(a, b):
	if a == 0 or b == 0:
		return 0
	elif a == b:
		return a
	elif a > b:
		return gcd(a - b, b)
	else:
		return gcd(a, b - a)
n = int(input())
flag = 0
for i in range(n):
	for j in range(n):
		if j >= i:
			continue
		elif i + j == n and gcd(i, j) == 1:
			print('{} {}'.format(j, i))
			flag = 1
			break
	if flag == 1:
		break


from math import gcd as g
n = int(input())
m = 0
for i in range(1, n):
	if i / (n - i) < 1 and g(i, n - i) == 1 and (i / (n - i) > m):
		m = i / (n - i)
		(a, b) = (i, n - i)
print(a, b)


import math
n = int(input())
ans = max([i for i in range(1, (n + 1) // 2) if math.gcd(i, n - i) == 1])
print(ans, n - ans)


n = int(input())
(a, b) = (1, 1000)

def nod(a, b):
	while a != b:
		if a > b:
			a -= b
		else:
			b -= a
	return a
for i in range(1, n):
	j = n - i
	if j <= i:
		break
	if nod(i, j) != 1:
		continue
	a1 = i * b
	a2 = a * j
	if a1 > a2:
		(a, b) = (i, j)
print(a, b)


import math
n = int(input())
j = n // 2
if n % 2 != 0:
	print(j, n - j)
else:
	x = 1
	while n - x > x:
		if math.gcd(x, n - x) == 1:
			c1 = x
			c2 = n - x
		x += 1
	print(c1, c2)


n = int(input())
numerator = 0
denominator = 0
if n % 2 == 0:
	numerator = n // 2
	denominator = n // 2
	if numerator % 2 == 0:
		numerator -= 1
		denominator += 1
	else:
		numerator -= 2
		denominator += 2
	print(*(numerator, denominator), sep=' ')
else:
	numerator = n // 2
	denominator = n // 2
	denominator += 1
	print(*(numerator, denominator), sep=' ')


def nod(a, b):
	if b == 0:
		return a
	else:
		return nod(b, a % b)
n = int(input())
m = 0
a = 0
b = 0
for i in range(1, n // 2 + 1):
	if nod(n - i, i) == 1:
		m = max(m, nod(n - i, i))
		(a, b) = (i, n - i)
print(a, b)


x = int(input())
if x % 4 == 0:
	print(x // 2 - 1, x // 2 + 1)
elif x % 4 == 2:
	print(x // 2 - 2, x // 2 + 2)
else:
	print((x - 1) // 2, (x + 1) // 2)


n = int(input())
b = n - 1
a = 1
while b > a:
	a += 1
	b -= 1
	if b == a:
		b -= 1
		a += 1
if b % 2 == 0 and a % 2 == 0:
	a += 1
	b -= 1
print('{} {}'.format(b, a))


X = int(input())
Half = int(X / 2)
if X % 2 != 0:
	print(Half, Half + 1)
	exit()
print(str(Half - 1) + ' ' + str(Half + 1) if Half % 2 == 0 else str(Half - 2) + ' ' + str(Half + 2))


total = int(input())

def coprimes(total):
	half = total // 2
	if total % 2 == 0:
		if total % 4 != 0:
			return (half - 2, half + 2)
		return (half - 1, half + 1)
	half += 1
	return (half - 1, half)
(prime_1, prime_2) = coprimes(total)
print(prime_1, prime_2)


def gcd(x, y):
	while y:
		x %= y
		(x, y) = (y, x)
	return x
n = int(input())
mx_a = 1
mx_b = n - 1
for i in range(2, n // 2 + 1):
	a = i
	b = n - a
	if b <= a:
		continue
	g = gcd(a, b)
	if g != 1:
		continue
	if a * mx_b > b * mx_a:
		(mx_a, mx_b) = (a, b)
print(mx_a, mx_b)


x = int(input())
if x % 2 == 1:
	print(int((x - 1) / 2), int((x + 1) / 2))
if x % 2 == 0:
	t = x // 2
	if t % 2 == 1:
		print(t - 2, t + 2)
	if t % 2 == 0:
		print(t - 1, t + 1)


def eas(u, d):
	if u == 1:
		return True
	i = 2
	while (u // i + d // i) * i != u + d:
		if i == u:
			return True
		i += 1
	return False
n = int(input())
a = n // 2
b = n - a
while True:
	if eas(a, b):
		print(str(a) + '  ' + str(b))
		break
	a -= 1
	b += 1


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

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

def map_string():
	return input().split()
from fractions import gcd
n = int(input())
a = n // 2
b = n - a
while gcd(a, b) != 1:
	a -= 1
	b += 1
print(a, b)


num = int(input())
d = num // 2
if not num % 2:
	if not d % 2:
		a = d - 1
		b = d + 1
	else:
		a = d - 2
		b = d + 2
else:
	a = d
	b = num - d
print(a, b)


def red(m, n):
	while n:
		(m, n) = (n, m % n)
	return m

def main():
	x = int(input())
	m = int((x - 1) / 2)
	n = int(x - m)
	while red(m, n) != 1:
		m = m - 1
		n = x - m
	print(m, n)
main()


n = int(input())
if n % 2 == 1:
	a = n // 2
	b = a + 1
	print(a, b)
else:
	if (n / 2 - 1) % 2 == 0:
		a = n / 2 - 2
		b = a + 4
	else:
		a = n / 2 - 1
		b = a + 2
	m = 2
	while m < a // 3:
		if a % m == 0 and b % m == 0:
			if a == 1:
				break
			else:
				a -= 2
				b -= 2
				m = 2
		m += 1
	print(int(a), int(b))


from fractions import gcd
n = int(input())
for denom in range(n // 2 - 1, n):
	numer = n - denom
	if numer < denom and gcd(numer, denom) == 1:
		print(numer, denom)
		break


def gdc(a, b):
	if b == 0:
		return a
	else:
		return gdc(b, a % b)
n = int(input())
maxA = 1
maxB = 1
a = 1
while a < n:
	b = 1
	while b < n:
		divisorComum = gdc(a, b)
		if a + b == n and divisorComum == 1 and (a < b):
			maxA = a
			maxB = b
		b = b + 1
	a = a + 1
print(maxA, maxB)


n = int(input())
if n % 2 == 1:
	k = (n + 1) // 2
	print(k - 1, end=' ')
	print(k)
else:
	k = n // 2
	if k % 2 == 0:
		print(k - 1, end=' ')
		print(k + 1)
	else:
		print(k - 2, end=' ')
		print(k + 2)


n = int(input())
tmp = []
if n % 2 == 0:
	if n // 2 % 2 == 0:
		tmp = [n // 2 - 1, n // 2 + 1]
	else:
		tmp = [n // 2 - 2, n // 2 + 2]
else:
	tmp = [n // 2, n // 2 + 1]
print(' '.join(map(str, tmp)))


import fractions
n = int(input())
l = []
m = []
for i in range(1, n // 2 + 1):
	if fractions.gcd(i, n - i) == 1:
		l.append([i, n - i])
		m.append(i / (n - i))
print(l[m.index(max(m))][0], end=' ')
print(l[m.index(max(m))][1])


import math
n = int(input())
a = n // 2
b = n - a
while True:
	if math.gcd(a, b) == 1 and a + b == n:
		print(a, b)
		break
	else:
		a -= 1
		b += 1


def init_ab(n):
	if n % 2 == 0:
		(a, b) = (n // 2 - 1, n // 2 + 1)
	else:
		(a, b) = (n // 2, n // 2 + 1)
	return proper(a, b)

def proper(x, y):
	if findout(x, y):
		print(x, y)
		return None
	return proper(x - 1, y + 1)

def findout(x, y):
	for i in primes:
		if x / i % 1 == 0.0 and y / i % 1 == 0.0:
			return False
		if i > min(x, y):
			break
	return True
primes = [2]
for i in range(2, 1001):
	count = 0
	for d in range(2, i):
		if i / d % 1 == 0:
			count = 0
			break
		else:
			count = 1
	if count:
		primes.append(i)
init_ab(int(input()))


s = int(input())
if s % 4 == 0:
	print(s // 2 - 1, s // 2 + 1)
elif s % 2 == 0:
	print(s // 2 - 2, s // 2 + 2)
else:
	print(s // 2, s // 2 + 1)


a = int(input())
b = 0
if a % 2 != 0:
	b = a // 2
	if b % 2 == 0 and b % (a - b) == 0:
		b = b - 1
else:
	b = a / 2 - 1
	if b % 2 == 0:
		b = b - 1
c = a - b
print(int(b), int(c))


s = int(input())
n = 1
k = s - n
max_n = 0
max_k = 1
while k > n:
	a = k
	b = n
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	gcd = a + b
	if gcd == 1:
		if n / k > max_n / max_k:
			max_n = n
			max_k = k
	n += 1
	k -= 1
print(max_n, max_k)


from math import *
n = int(input())
arr = []
for i in range(ceil(n / 2) - 1, -1, -1):
	if gcd(i, n - i) == 1:
		print(i, n - i)
		break


a = int(input())
if a & 1:
	print(a // 2, a - a // 2)
elif a % 4 == 0:
	print(a // 2 - 1, a - a // 2 + 1)
else:
	print(a // 2 - 2, a - a // 2 + 2)


import math

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

def max_irr(n):
	mid = math.ceil(n / 2)
	a = mid - 1
	b = n - a
	while a > 0:
		if gcd(a, b) == 1:
			print(a, b)
			return
		a -= 1
		b = n - a

def runner():
	n = input()
	n = int(n)
	max_irr(n)
runner()


import math
n = int(input())
i = 1
while True:
	if math.gcd(n // 2 + i, n - (n // 2 + i)) == 1:
		answer = [n // 2 + i, n - (n // 2 + i)]
		break
	else:
		i += 1
print(*answer[::-1])


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


n = int(input())
if n % 2 == 0:
	a = int(n / 2) - 1
	b = int(n / 2) + 1
elif n % 2 == 1:
	a = int(n // 2)
	b = int(n // 2) + 1
while True:
	listaA = []
	listaB = []
	cont = 1
	while cont <= a // 2:
		if a % cont == 0:
			listaA.append(cont)
		cont += 1
	listaA.append(a)
	cont = 1
	while cont <= b // 2:
		if b % cont == 0:
			listaB.append(cont)
		cont += 1
	listaA.append(b)
	for i in range(1, len(listaA)):
		if listaA[i] not in listaB:
			print(a, b)
			exit()
		else:
			a -= 1
			b += 1
			break


from functools import reduce
import sys
n = int(input())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(pow(n, 0.5) + 1)) if n % i == 0)))
a = n // 2
b = n - a
while a > 0:
	fa = factors(a)
	fb = factors(b)
	if len(factors(a).intersection(factors(b))) == 1:
		print(a, b)
		sys.exit()
	a -= 1
	b += 1


import math
n = int(input())
num = n // 2
den = n - num
while math.gcd(num, den) != 1:
	num = num - 1
	den = den + 1
print(num, den)


n = int(input())
(a, b) = (1, 1)
f = []
g = []
import math
for a in range(n):
	for b in range(n):
		if a < b and a + b == n:
			if math.gcd(a, b) > 1:
				continue
			f.append(a / b)
			g.append(str(a) + ' ' + str(b))
t = f.index(max(f))
print(g[t])


import math

def fraction(n):
	for i in range(n // 2, 0, -1):
		if math.gcd(i, n - i) == 1:
			return (i, n - i)
n = int(input())
result = fraction(n)
print(*result)


n = int(input())
if n % 2 == 1:
	numerator = n // 2
	denominator = n - numerator
else:
	numerator = n // 2 - 1
	while numerator % 2 == 0:
		numerator -= 1
	denominator = n - numerator
print(numerator, denominator)


import math
n = int(input())
m = n // 2
while math.gcd(n - m, m) - 1:
	m -= 1
print(m, n - m)


import math
n = int(input())
result = ''
for i in range(1, n // 2 + 1):
	if math.gcd(i, n - i) == 1:
		result = str(i) + ' ' + str(n - i)
print(result)


import math

def __gcd(a, b):
	if b == 0:
		return a
	return __gcd(b, a % b)
n = int(input())
lim = math.ceil(n / 2)
frac = 0
ans = 0
for i in range(1, lim):
	if __gcd(i, n - i) == 1:
		if i / (n - i) > frac:
			frac = i / (n - i)
			ans = i
print('%d %d' % (ans, n - ans))


from fractions import gcd
n = int(input())
if n % 2 == 0:
	znam = n // 2 - 1
	chisl = n // 2 + 1
else:
	znam = n // 2
	chisl = n // 2 + 1
while gcd(znam, chisl) != 1:
	znam -= 1
	chisl += 1
print(znam, chisl)


def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
resa = 1
resb = n - 1
for a in range(1, n // 2 + 1):
	b = n - a
	g = gcd(b, a)
	if g == 1:
		if resa * b < a * resb:
			(resa, resb) = (a, b)
print(' '.join(map(str, [resa, resb])))


def hcf(a, b):
	if a == 1 and b == 1:
		return False
	i = 1
	h = min(a, b)
	while i <= h:
		if a % i == 0 and b % i == 0:
			l = i
			if l != 1:
				break
		i = i + 1
	if l == 1:
		return True
	else:
		return False
n = int(input())
k = n // 2
a = k
b = n - k
while True:
	if hcf(a, b):
		print(a, b)
		break
	else:
		a = a - 1
		b = b + 1


def nod(d, f):
	(d, f) = (max(d, f), min(d, f))
	while d % f != 0:
		d %= f
		(d, f) = (f, d)
	return f
n = int(input())
if n % 2 == 1:
	print(n // 2, n // 2 + 1)
else:
	f = n // 2
	for a in range(f, 0, -1):
		if nod(a, n - a) == 1:
			print(a, n - a)
			exit()


n = int(input())
nn = int(n / 2)
if n % 2 == 1:
	print(nn, nn + 1)
else:
	x = 1 + nn % 2
	print(nn - x, nn + x)


def run():
	n = int(input())
	if (n - 2) % 4 == 0:
		a = n // 2 - 2
		b = n - a
		print(a, b)
		return
	if n % 2 == 0:
		a = n // 2 - 1
		b = n - a
		print(a, b)
		return
	a = n // 2
	b = n - a
	print(a, b)
	return
run()


def simple(a, b):
	Min = min(a, b)
	for i in range(2, Min + 1):
		if a % i == 0 and b % i == 0:
			return False
			break
	else:
		return True
n = int(input())
up = 0
down = 1
sum = up + down
while True:
	if up + 1 == down:
		down += 1
		if up + down == n and (not simple(up, down)):
			while not simple(up, down):
				up -= 1
				down += 1
	elif simple(up + 1, down):
		up += 1
	elif simple(up, down + 1):
		down += 1
	sum = up + down
	if sum == n and simple(up, down):
		print(up, down)
		break


def Euclide(a, b):
	while a != 0 and b != 0:
		if a >= b:
			a = a % b
		else:
			b = b % a
	return a + b
n = int(input())
if n % 2 == 0:
	a = n // 2 - 1
	b = n // 2 + 1
	while a != 0:
		if Euclide(a, b) == 1:
			print(a, b)
			break
		a -= 1
		b += 1
else:
	a = n // 2
	b = n // 2 + 1
	while a != 0:
		if Euclide(a, b) == 1:
			print(a, b)
			break
		a -= 1
		b += 1


n = int(input())
sep = n // 2
other = n - sep
if sep < other:
	print(sep, other)
else:
	sep -= 1
	other += 1
	if sep % 2 == 0 and other % 2 == 0:
		sep -= 1
		other += 1
	print(sep, other)


n = int(input(''))

def _gcd(a, b):
	if a == 0:
		return b
	return _gcd(b % a, a)
max = -1
for i in range(1, n // 2 + 1):
	if _gcd(i, n - i) == 1:
		if i / (n - i) > max:
			max = i / (n - i)
			x = i
			y = n - i
print(x, y)


from math import gcd
n = int(input())
for (a, b) in zip(range((n - 1) // 2, 0, -1), range((n + 2) // 2, n)):
	if gcd(a, b) == 1:
		print(a, b)
		break


n = int(input())
x = n // 2
if n % 2 == 0:
	if (x - 1) % 2 == 1:
		print(str(x - 1) + ' ' + str(x + 1))
	else:
		print(str(x - 2) + ' ' + str(x + 2))
else:
	print(str(x) + ' ' + str(n - x))


def coprime(n, m):
	cp = 1
	for i in range(1, min(n, m) + 1):
		if n % i == 0 and m % i == 0:
			cp = i
	return cp
a = int(input())
d = 1
if a % 2 == 0:
	b = a // 2 - 1
	c = a - b
	v = coprime(b, c)
	while d:
		if v != 1:
			b = b - 1
			c = c + 1
			v = coprime(b, c)
		else:
			d = 0
else:
	b = (a + 1) // 2 - 1
	c = a - b
	v = coprime(b, c)
	while d:
		if v != 1:
			b = b - 1
			c = c + 1
			v = coprime(b, c)
		else:
			d = 0
print(b, c)


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


import sys

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
a = int(n / 2)
b = max(a, n - a)
while True:
	if b > a and gcd(a, b) == 1:
		break
	if a == 1:
		break
	b += 1
	a -= 1
print('{0} {1}'.format(a, b))


def ev(a, b):
	while a > 0 and b > 0:
		if a >= b:
			a %= b
		else:
			b %= a
	return max(a, b)
n = int(input())
for i in range(n // 2, 0, -1):
	a = i
	b = n - i
	if ev(a, b) == 1:
		break
print(a, b)


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

def solve(n):
	a = 0
	b = 0
	for i in range(1, n):
		for j in range(i, n):
			if i + j == n and gcd(i, j) == 1 and (i > a):
				a = i
				b = j
	print(a, b)

def main():
	n = int(input())
	solve(n)
main()


from sys import stdin

def main():

	def gcd(a, b):
		while a % b != 0:
			(a, b) = (b, a % b)
		return b
	input = stdin.readline
	n = int(input())
	maxi = 0
	for a in range(1, n + 1):
		b = n - a
		if b > a and a / b > maxi and (gcd(a, b) == 1):
			maxi = a / b
			(mA, mB) = (a, b)
	print(mA, mB)
main()


import math
n = int(input())
if n % 2 == 1:
	a = math.floor(n / 2)
	b = math.ceil(n / 2)
elif n % 4 == 0:
	(a, b) = (math.floor(n / 2) - 1, math.ceil(n / 2) + 1)
else:
	(a, b) = (math.floor(n / 2) - 2, math.ceil(n / 2) + 2)
print(a, b)


from math import *
n = int(input())
if n % 2 == 1:
	print((n - 1) // 2, (n - 1) // 2 + 1)
else:
	r = n // 2
	for i in reversed(range(1, r)):
		if gcd(i, n - i) == 1:
			print(i, n - i)
			exit(0)


y = int(input())
n = y // 2
if y % 2 == 1:
	print(n, n + 1)
else:
	a = n - 1
	b = n + 1
	while a % 2 == 0 and b % 2 == 0:
		a -= 1
		b += 1
	print(a, b)


def prim(a, b):
	global f
	if a == 1:
		f = True
	elif b == 1:
		f = True
	elif a == b:
		f = False
	elif a > b:
		prim(a - b, b)
	else:
		prim(b - a, a)
n = int(input())
am = 0
bm = 1
for a in range(1, n // 2 + 1):
	b = n - a
	prim(a, b)
	if a < b and f:
		if a / b > am / bm:
			am = a
			bm = b
print(am, bm)


def main():
	n = int(input())
	for a in range((n + 1) // 2 - 1, 0, -1):
		b = n - a
		if check(a, b):
			print(a, b)
			return

def check(a, b):
	for i in range(2, min(a, b) + 1):
		if a % i == 0 and b % i == 0:
			return False
	return True
main()


n = int(input())
k = 0
for i in range(1, n // 2 + 1):
	c = 1
	a = i
	b = n - i
	for q in range(2, a + 1):
		if a % q == 0 and b % q == 0:
			c = 0
			break
	if c == 1:
		k = a
print(k, n - k)


n = int(input())
res = []

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for up in range(1005):
	for down in range(1, 1005):
		if up < down and up + down == n:
			if gcd(up, down) == 1:
				res.append((up / down, up, down))
res = sorted(res)
print(res[-1][1], res[-1][2])


from sys import stdin as fin
import fractions
n = int(fin.readline())
(maxv, maxa, maxb) = (0, 0, 0)
for a in range(n // 2, 0, -1):
	b = n - a
	if fractions.gcd(a, b) == 1 and a / b > maxv:
		(maxv, maxa, maxb) = (a / b, a, b)
print(maxa, maxb)


from fractions import gcd, Fraction
n = int(input())
p = Fraction(0)
for i in range(n + 1):
	if n - i <= i:
		break
	if gcd(i, n - i) == 1:
		p = max(p, Fraction(i, n - i))
(a, b) = str(p).split('/')
print(a, b)


n = int(input())
i = 1
j = n - 1
mxi = -1
mxj = 1001
while i < j:
	for d in range(2, i + 1):
		if j % d == 0 and i % d == 0:
			break
	else:
		if i > mxi and j < mxj:
			mxi = i
			mxj = j
	i += 1
	j -= 1
print(mxi, mxj)


def gcd(a, b):
	i = 1
	while i <= a and i <= b:
		if a % i == 0 and b % i == 0:
			ans = i
		i += 1
	return ans
n = int(input())
c = 0
for i in range(n // 2, 0, -1):
	if gcd(i, n - i) == 1:
		print(i, n - i)
		break


import math
n = int(input())
for i in reversed(range(1, n - 1)):
	if n - i > i:
		a = i
		b = n - i
		if math.gcd(a, b) == 1:
			print(a, b)
			break


import math
n = int(input())
x = math.ceil(n / 2) - 1
if x % 2 == 0 and n % 2 == 0:
	x -= 1
print(x, n - x)


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

def drob(number):
	(n1, n2) = (-1, -1)
	for i in range(1, number):
		j = number - i
		if j < i and gcd(j, i) == 1:
			n1 = j
			n2 = i
			break
	return (n1, n2)
print(*drob(int(input())))


from math import gcd
n = int(input())
(a, b) = (0, n)
answer = ()
while b - a > 1:
	b -= 1
	a += 1
	if gcd(a, b) == 1:
		answer = (a, b)
print(*answer)


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
s = int(input())
ans = 1
for i in range(2, s // 2 + 1):
	if gcd(s - i, i) == 1:
		ans = i
print(ans, s - ans)


import math
n = int(input())
d = n // 2
c = n - d
while math.gcd(c, d) != 1:
	c += 1
	d -= 1
print(d, c)


import math
n = int(input())
if n % 2 == 0:
	half = n // 2
	den = half + 1
	num = half - 1
else:
	half = n // 2
	den = half + 1
	num = half
temp = True
while temp:
	if math.gcd(den, num) == 1:
		temp = False
	else:
		num -= 1
		den += 1
print(num, den)


n = int(input())

def gcd(a, b):
	if b > a:
		(a, b) = (b, a)
	if b == 0:
		return a
	if b == 1:
		return 1
	return gcd(b, a % b)
count = 0
for num in range(n // 2, 0, -1):
	if gcd(num, n - num) == 1:
		print(num, n - num)
		break


import math
n = int(input())
mx = 0
a = b = 0
if n % 2 == 0:
	x = n // 2 - 1
	y = n // 2 + 1
else:
	x = n // 2
	y = n // 2 + 1
while x > 0:
	if math.gcd(x, y) != 1:
		x -= 1
		y += 1
		continue
	if x / y > mx:
		mx = x / y
		a = x
		b = y
	x -= 1
	y += 1
print(a, b)


no = int(input())
n = no // 2
d = no - n

def hcf(a, b):
	while True:
		rem = a % b
		if rem == 0:
			return b
		else:
			a = b
			b = rem
while True:
	if hcf(n, d) == 1:
		print(n, d)
		break
	else:
		n -= 1
		d += 1


total = int(input())
index = 2
if total % 2 == 1:
	average = (total + 1) // 2
elif total % 2 == 0:
	average = total // 2
a = average - 1
b = total - a
while index < 10:
	if a % index == 0 and b % index == 0:
		a = a - 1
		b = b + 1
	else:
		break
	index += 1
print(a)
print(b)


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


n = int(input())
wyn = 0

def fajnie(a, b):
	while a != b:
		if a < b:
			b -= a
		else:
			a -= b
	return min(a, b)
for x in range(1, n // 2 + 1):
	y = n - x
	if fajnie(x, y) == 1:
		wyn = x
print(wyn, n - wyn)


import itertools
from collections import defaultdict
from math import gcd

def main():
	n = int(input())
	m = 0
	for i in range(n):
		if i >= n - i:
			break
		if gcd(i, n - i) == 1 and i > m:
			m = i
	print(m, n - m)
main()


n = int(input())
z = n // 2 + n % 2
c = n // 2
for i in range(n // 2):
	if c == z:
		z += 1
		c -= 1
		continue
	for j in range(2, c + 1):
		if c % j == 0 and z % j == 0:
			break
	else:
		print(c, z)
		break
	z += 1
	c -= 1


a = int(input())
b = a // 2
c = a - b
i = 2
while i <= b:
	if b / i % 1 == 0 and c / i % 1 == 0:
		b = b - 1
		c = c + 1
		i = 2
	else:
		i = i + 1
	if b <= 0:
		break
if b <= 0:
	print('1 ' + str(a - 1))
else:
	print(str(b) + ' ' + str(c))


import math
a = int(input())
for x in range(a // 2, 0, -1):
	if math.gcd(x, a - x) == 1:
		print(x, a - x)
		break


import math
n = int(input())
if n % 2 != 0:
	a = 1
	while a < math.floor(n / 2):
		a += 1
	b = n - a
	print(f'{a}  {b}')
else:
	a = 1
	while a < math.floor(n / 2) - 1:
		a += 1
	b = n - a
	if a % 2 == 0 and b % 2 == 0:
		a = a - 1
		b = b + 1
	print(f'{a}  {b}')


n = int(input())
l = [-1, 0, -1, 1]
u = (n // 4 << 1) + l[n % 4]
print(u, n - u)


n = int(input())
b = 0
if n % 2 == 0:
	for i in range(1, n // 2):
		a = n - i
		goon = True
		for j in range(2, i + 1):
			if a % j == 0 and i % j == 0:
				goon = False
				break
		if goon:
			if i / a > b:
				b = i / a
				c = i
				d = a
else:
	for i in range(1, n // 2 + 1):
		a = n - i
		goon = True
		for j in range(2, i + 1):
			if a % j == 0 and i % j == 0:
				goon = False
				break
		if goon:
			if i / a > b:
				b = i / a
				c = i
				d = a
print(c, d)


def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return gcd(a, b)
n = int(input())
max1 = 0
ans = []
for i in range(n):
	a = i
	b = n - i
	if gcd(a, b) == 1 and a < b and (a / b > max1):
		max1 = a / b
		ans = [a, b]
print(ans[0], ans[1])


import math

def gcd(a, b):
	if a == 0 and b == 0:
		return 0
	elif a == b:
		return a
	elif a > b:
		return gcd(a - b, b)
	else:
		return gcd(b - a, a)
inp = int(input())
c = int(math.ceil(inp / 2) - 1)
d = inp - c
while True:
	if gcd(c, d) == 1:
		print(c, d)
		break
	c = c - 1
	d = d + 1


import math
x = int(input())
(l, r) = (x // 2, x - x // 2)
while math.gcd(l, r) != 1:
	l -= 1
	r += 1
print(l, end=' ')
print(r)


import math
n = int(input())
best = 0
best_a_b = None
for a in range(int(n / 2), 0, -1):
	b = n - a
	if a == b or a > b:
		continue
	is_proper = True
	for divider in range(2, max(3, math.ceil(a / 2))):
		if a % divider == 0 and b % divider == 0:
			is_proper = False
	if is_proper:
		print(a, b)
		break


n = int(input())
m = n // 2
switcher = {0: [m - 1, m + 1], 1: [m, m + 1], 2: [m - 2, m + 2], 3: [m, m + 1]}
ans = switcher.get(n % 4)
print(ans[0], ans[1])


from math import gcd
n = int(input())
best = (1, n)
for m in range(1, n // 2 + 1):
	n -= 1
	if gcd(m, n) == 1 and m / n > best[0] / best[1]:
		best = (m, n)
print(best[0], best[1])


n = int(input())
x = n // 2
if n % 2 == 1:
	print(x, x + 1)
elif x % 2 == 1:
	print(x - 2, x + 2)
else:
	print(x - 1, x + 1)


n = int(input())
d = n // 2
print(*[(d - 1, d + 1), (d, d + 1), (d - 2, d + 2), (d, d + 1)][n % 4])


from math import gcd
n = int(input())
if n % 2 == 0:
	k = n // 2 - 1
	m = n // 2 + 1
	while k * m / gcd(k, m) != k * m:
		k -= 1
		m += 1
	print(str(k) + ' ' + str(m))
else:
	print(str(n // 2) + ' ' + str(n // 2 + 1))


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
if n % 2 == 0:
	limit = int(n / 2 - 1)
else:
	limit = int(n / 2)
max = 0
num = 0
den = 0
for i in range(1, limit + 1):
	if gcd(i, n - i) == 1:
		if i / (n - i) > max:
			max = i / (n - i)
			num = i
			den = n - i
print(num, den)


import sys
from fractions import gcd

def main():
	n = int(input())
	a = n // 2
	if n % 2 == 0:
		a -= 1
	b = n - a
	while gcd(a, b) > 1:
		a -= 1
		b += 1
	print(a, b)
main()


import math
n = int(input())
(a, b) = (n // 2, n - n // 2)
while math.gcd(a, b) != 1:
	a -= 1
	b += 1
print(a, b, sep=' ')


def hcf(a, b):
	while b != 0:
		r = a % b
		a = b
		b = r
	return a
n = int(input(''))
ans = -1.0
for i in range(1, n, 1):
	for j in range(i + 1, n, 1):
		if i + j == n:
			if hcf(i, j) == 1:
				frac = i * 1.0 / (j * 1.0)
				if frac > ans:
					ans = frac
					f = i
					s = j
print(f, s)


n = int(input())

def corprime(a, b):
	for i in range(2, a + 1):
		if a % i == 0 and b % i == 0:
			return False
	return True
t = 1
if n % 2 == 0:
	t = n // 2
else:
	t = n // 2 + 1
a = 1
b = 1
for i in range(1, t):
	if corprime(i, n - i):
		a = i
		b = n - i
print(a, b)


def hcf(a, b):
	if b == 0:
		return a
	return hcf(b, a % b)
n = int(input())
for i in range(n // 2 + 1, 0, -1):
	if hcf(i, n - i) == 1:
		print(min(i, n - i), max(i, n - i))
		break


from math import ceil, floor
a = int(input())
if a % 2 == 0 and a // 2 % 2 == 0:
	print(a // 2 - 1, a // 2 + 1)
elif a % 2 == 0 and a // 2 % 2 != 0:
	print(a // 2 - 2, a // 2 + 2)
else:
	print(floor(a / 2), ceil(a / 2))


def mdc(a, b):
	if b == 0:
		return a
	return mdc(b, a % b)
n = int(input())
a = n // 2
b = n - a
while mdc(a, b) != 1:
	a -= 1
	b += 1
print(str(a) + ' ' + str(b))
exit(0)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
den = 0
num = 0
if n % 2 == 0:
	for i in range(1, n // 2):
		t = i
		p = n - i
		if gcd(p, t) == 1:
			if t > num:
				num = t
				den = p
else:
	for i in range(1, n // 2 + 1):
		t = i
		p = n - i
		if gcd(p, t) == 1:
			if t > num:
				num = t
				den = p
print(num, den)


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

def A(n=12):
	for a in range(n // 2, 0, -1):
		b = n - a
		if gcd(a, b) == 1:
			break
	print(a, b)
n = int(input())
A(int(n))


from math import gcd
n = int(input())
curr_opt_a = 1
for a in range(n - 1, 0, -1):
	b = n - a
	if a >= b:
		continue
	if gcd(a, b) == 1:
		curr_opt_a = max(curr_opt_a, a)
print(curr_opt_a, n - curr_opt_a)


from math import gcd
n = int(input())
res = resI = 0
for i in range(1, n):
	j = n - i
	if i >= j:
		break
	if gcd(i, j) == 1 and res < i / j:
		res = i / j
		resI = i
print(resI, n - resI)


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

def coPrime(a, b):
	if gcd(a, b) == 1:
		return True
	else:
		return False
n = int(input())
i = 1
j = n - 1
while i < j:
	if coPrime(i, j):
		x = i
		y = j
	i += 1
	j -= 1
print(f'{x} {y}')


from math import gcd as bltin_gcd

def coprime(a, b):
	return bltin_gcd(a, b) == 1

def II():
	return int(SI())

def SI():
	return input()
N = II()
pairs = []
for a in range(int(N / 2) + 1):
	b = N - a
	if coprime(a, b):
		pairs.append((a, b))
(a, b) = pairs[-1]
print(a, b)


def fun(a, b):
	x = min(a, b)
	for i in range(2, x + 1):
		if a % i == 0 and b % i == 0:
			return False
	return True
n = int(input())
a = n // 2
b = n - a
while a != 0:
	if fun(a, b):
		break
	a -= 1
	b += 1
print(a, b)


n = int(input())

def calcula_divisores(n):
	divisores = []
	i = 2
	while i < n:
		if n % i == 0:
			divisores.append(i)
		i += 1
	return divisores
if n % 2 != 0:
	nume = n // 2
	deno = n // 2 + 1
elif n % 2 == 0:
	nume = n // 2 - 1
	deno = n // 2 + 1
while True:
	b = False
	div_nume = calcula_divisores(nume)
	div_deno = calcula_divisores(deno)
	if len(div_deno) == 0 and deno not in div_nume or (len(div_nume) == 0 and nume not in div_deno):
		break
	for i in range(len(div_nume)):
		div = div_nume[i]
		if div in div_deno:
			break
		if i == len(div_nume) - 1 and div not in div_deno:
			b = True
	if b:
		break
	nume -= 1
	deno += 1
print(nume, deno)


n = int(input())
a = n // 2
if n == 3:
	print(1, 2)
elif n % 2 == 0:
	if a % 2 != 0:
		print(a - 2, a + 2)
	else:
		print(a - 1, a + 1)
else:
	print(a, a + 1)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

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

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

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

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

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	a = n // 2
	b = n - a
	while math.gcd(a, b) != 1:
		a -= 1
		b += 1
	print(a, b)
for _ in range(1):
	solve()


import itertools

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

def fraction_find(n):
	a = [range(1, n + 1)] * 2
	c = list(itertools.product(*a))
	b = list()
	for elem in c:
		if elem[0] + elem[1] == n and elem[0] < elem[1] and (gcd(elem[0], elem[1]) == 1):
			b.append(elem)
	return max(b, key=lambda item: item[0])
m = int(input())
print(*fraction_find(m))


n = int(input())
if n % 2 == 0:
	(a, b) = (n // 2, n // 2)
else:
	(a, b) = (n // 2, n // 2 + 1)
for i in range(10):
	if a == 1:
		print(a, b)
		break
	l = [i for i in range(1, a + 1) if a % i == 0]
	s = [i for i in range(1, b + 1) if b % i == 0]
	if len(set(l + s)) == len(l) + len(s) - 1:
		print(a, b)
		break
	else:
		(a, b) = (a - 1, b + 1)


def main():
	N = int(input())
	b = N // 2 + 1
	a = N - b
	if not a % 2 and (not b % 2):
		b += 1
		a -= 1
	print(a, b)
main()


from math import *
import fractions
n = int(input())
half = floor(n / 2)
den = half + 1
num = n - den
while True:
	if fractions.gcd(num, den) == 1:
		break
	else:
		den = den + 1
		num = num - 1
print(num, den)


n = int(input())
if n % 2 == 0:
	satu = n // 2 - 1
	dua = n // 2 + 1
	status = False
	while status == False:
		if satu == 1:
			break
		for i in range(satu, 1, -1):
			if satu % i == 0 and dua % i == 0:
				status = False
				satu -= 1
				dua += 1
			elif i == 2:
				status = True
else:
	satu = n // 2
	dua = n // 2 + 1
	status = False
	while status == False:
		if satu == 1:
			break
		for i in range(satu, 1, -1):
			if satu % i == 0 and dua % i == 0:
				status = False
				satu -= 1
				dua += 1
			elif i == 2:
				status = True
print(satu, dua)


num = int(input())

def gcd(x, y):
	hcf = 1
	if x > y:
		smaller = y
	else:
		smaller = x
	for i in range(1, smaller + 1):
		if x % i == 0 and y % i == 0:
			hcf = i
	return hcf
i1 = 1
while i1 <= num // 2:
	a = i1
	b = num - i1
	if gcd(a, b) == 1:
		s = i1
	i1 += 1
if s != 0:
	print(s, num - s)


def fact(num1, num2):
	if num2 == 0:
		return num1
	return fact(num2, num1 % num2)
results = []
num = int(input())
num1 = 0
num2 = num - num1
while num1 < num2:
	if fact(num2, num1) == 1:
		results.append(num1)
	num1 += 1
	num2 -= 1
result = results[len(results) - 1]
print(result, num - result)


n = int(input())
m = n // 2 + 1
b = n - 1
a = 1
c = a
d = b
r = 0
while b != m:
	r = 1
	c = c + 1
	d = d - 1
	i = 0
	n = 0
	while i != c:
		i += 1
		if i == 1:
			n = 0
		elif c % i == 0 and d % i == 0:
			n = 1
	if n == 1:
		y = c - 1
		z = d + 1
	else:
		y = c
		z = d
	b = b - 1
if r == 0:
	y = c
	z = b
	d
print(y, z)


import fractions
n = int(input())
for a in range((n - 1) // 2, 0, -1):
	b = n - a
	if fractions.gcd(a, b) == 1:
		print('%d %d' % (a, b))
		break


def common_divisor(a, b):
	for x in range(2, a + 1):
		if a % x == 0 and b % x == 0:
			return True
	return False
n = int(input())
a = int(n / 2)
b = n - a
while a % b == 0 or common_divisor(a, b):
	(a, b) = (a - 1, b + 1)
print(a, b)


n = int(input())
z = n // 2
if n & 1:
	k = n // 2
	j = n // 2 + 1
	print(k, j)
elif z & 1:
	print(z - 2, z + 2)
else:
	print(z - 1, z + 1)


user_input = int(input())

def GCD(c, d):
	if d == 0:
		return c
	else:
		return GCD(d, c % d)
first_part = []

def hahaha(local_input):
	for i in range(int(local_input / 2), 0, -1):
		for j in range(int(local_input / 2), local_input):
			if i + j == local_input and i != j and (GCD(i, j) == 1):
				return [i, j]
result = hahaha(user_input)
print(result[0], result[1])


from fractions import gcd
t = int(input())
if t % 2:
	l = t // 2
	r = t // 2 + 1
else:
	l = t // 2 - 1
	r = t // 2 + 1
	while gcd(l, r) != 1:
		l -= 1
		r += 1
print(l, r)


import math
n = int(input())
a = 0
b = 0
if n % 2 == 0:
	a = n // 2 - 1
	b = n // 2 + 1
else:
	a = n // 2
	b = n - a
while a >= 1 and b < n:
	if math.gcd(a, b) == 1:
		print(a, b, sep=' ')
		break
	a = a - 1
	b = b + 1


def checkCoPrime(nomi, denomi):
	for i in range(2, denomi):
		while nomi % i == 0 and denomi % i == 0:
			return 0
	return 1
sumN = int(input())
maxNomi = sumN // 2
storeNomi = 0
storeDenomi = 0
for i in range(1, maxNomi + 1):
	denomi = sumN - i
	if denomi <= i:
		break
	elif i == 1:
		storeNomi = i
		storeDenomi = denomi
	elif checkCoPrime(i, denomi) == 1:
		if i / denomi > storeNomi / storeDenomi:
			storeNomi = i
			storeDenomi = denomi
		else:
			continue
string = str(storeNomi) + ' ' + str(storeDenomi)
print(string)


def f(x, y):
	l = 1
	p = min(x, y)
	for n in range(1, p + 1):
		if x % n == 0 and y % n == 0:
			l = n
	return l
x = int(input())
n = x // 2
while 1:
	if f(n, x - n) == 1:
		print('{} {}'.format(n, x - n))
		break
	else:
		n -= 1


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
a = n // 2
b = n - n // 2
while True:
	if gcd(b, a) == 1:
		break
	a -= 1
	b += 1
print(a, b)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)
n = int(input())
for i in range(int(n / 2), 0, -1):
	a = i
	b = n - a
	if a < b and gcd(a, b) == 1:
		print(str(a) + ' ' + str(b))
		break


from math import ceil
n = int(input())
for j in range(ceil(n / 2) - 1, 0, -1):
	flag = 0
	b = n - j
	a = j
	for i in range(2, a + 1):
		if a % i == 0 and b % i == 0:
			flag = 1
			break
	if flag == 0:
		break
print(a, b)


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	for i in range(1, n):
		if i < n - i and math.gcd(i, n - i) == 1:
			ans = [i, n - i]
	print('%d %d' % (ans[0], ans[1]))
main()


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
n = int(input())
for x in range(int((n + 1) / 2) - 1, 0, -1):
	if gcd(x, n - x) == 1:
		print(x, n - x)
		break


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

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

def F():
	return float(sys.stdin.readline())

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

def S():
	return input()

def main():
	n = I()
	a = b = -1
	for x in range(1, n + 1):
		y = n - x
		if x >= y:
			break
		f = False
		for i in range(2, x + 1):
			if x % i == 0 and y % i == 0:
				f = True
		if not f:
			a = x
			b = y
	print(a, b)
main()


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(max(a, b) % min(a, b), min(a, b))
n = int(input())
a = int(n / 2)
while True:
	b = n - a
	if gcd(a, b) == 1:
		print(str(a) + ' ' + str(b))
		break
	elif a == 0:
		break
	else:
		a -= 1


from math import gcd
n = int(input())
(num, den) = (1, n - 1)
(ans_n, ans_d) = (num, den)
for _ in range(n - 2):
	ans_n += 1
	ans_d -= 1
	if ans_n >= ans_d:
		break
	if gcd(ans_n, ans_d) == 1:
		(num, den) = (ans_n, ans_d)
print(num, den)


import math
x = int(input())
half = x / 2.0
y = math.floor(half)
z = math.ceil(half)
if y == z:
	y = y - 1
	z = z + 1
if y % 2 == 0 and z % 2 == 0:
	y = y - 1
	z = z + 1
print(y, z)


import math
import re

def ria():
	return [int(i) for i in input().split()]
n = ria()[0]
for b in range(int(math.ceil(n / 2)), n):
	a = n - b
	if a == b:
		continue
	if math.gcd(a, b) == 1:
		print(a, b)
		exit(0)


n = int(input())
x = int(n / 2)
if n % 2 != 0:
	print(str(x) + ' ' + str(x + 1))
elif n % 4 == 0:
	print(str(x - 1) + ' ' + str(x + 1))
else:
	print(str(x - 2) + ' ' + str(x + 2))


import math

def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x
n = int(input())
if n & 1:
	x = n // 2
else:
	x = n // 2 - 1
y = n - x
while gcd(x, y) != 1:
	x = x - 1
	y = y + 1
print(str(x) + ' ' + str(y))


n = int(input())
i = 1
kt = 0
tu = 0
mau = 0
from math import *
prime = [1] * (n + 1)

def sang(n):
	prime[0] = 0
	prime[1] = 0
	for i in range(2, int(sqrt(n)) + 1):
		if prime[i] == 1:
			for j in range(i * i, n + 1, i):
				prime[j] = 0
while i < n - i:
	if gcd(i, n - i) == 1:
		kt = 1
		tu = i
		mau = n - i
	i += 1
print(tu, ' ', mau)


import math
n = int(input())
y = n // 2 + 1
x = n - y
if 3 <= n <= 1000:
	while math.gcd(x, y) != 1:
		(x, y) = (x - 1, y + 1)
	print(x, y)


import sys
givenNumber = sys.stdin.readline()
sumOFnumbers = int(givenNumber)
testIfEven = sumOFnumbers % 2
stillOkay = True
firstTrial = sumOFnumbers // 2
if testIfEven == 1:
	secfirstTrial = firstTrial + 1
	stillOkay = False
else:
	firstTrial = firstTrial - 1
	secfirstTrial = firstTrial + 2
	pass
while True:
	coprime = True
	if firstTrial - secfirstTrial < 0:
		for i in range(2, firstTrial + 1):
			if firstTrial % i == 0 and secfirstTrial % i == 0:
				coprime = False
			else:
				pass
	if coprime == True:
		break
	else:
		firstTrial = firstTrial - 1
		secfirstTrial = secfirstTrial + 1
print(firstTrial, ' ', secfirstTrial)


import math
x = int(input())
a = x // 2
b = x - a
while 1 == 1:
	if math.gcd(a, b) == 1:
		exit(print(a, b))
	else:
		a -= 1
		b += 1


def irr(a, b):
	for k in range(1, a + 1):
		if a % k == 0 and b % k == 0 and (k != 1):
			return False
	return True

def gener(n):
	l = []
	for i in range(1, n // 2):
		if irr(i, n - i):
			l.append([i, n - i])
	if n % 2 == 1:
		if irr(n // 2, n - n // 2):
			l.append([n // 2, n - n // 2])
	return l
n = int(input())
print(gener(n).pop()[0], gener(n).pop()[1])


num = int(input())
if num % 2 == 0:
	a = int(num // 2 - 1)
	b = int(num // 2 + 1)
	if a % 2 == 0:
		a -= 1
	if b % 2 == 0:
		b += 1
else:
	a = num // 2
	b = a + 1
print(a, b)


n = int(input())
a = n // 2
b = n - n // 2
if n % 4 == 0:
	a -= 1
	b += 1
elif n % 4 == 2:
	a -= 2
	b += 2
print(a, b)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
ans = -1
l = [1, n - 1]
for i in range(1, n // 2 + 1):
	a = i
	b = n - i
	if gcd(a, b) == 1:
		if a / b >= ans:
			ans = a / b
			l = [i, n - i]
print(*l)


from fractions import Fraction
n = int(input())
for i in range((n - 1) // 2, 0, -1):
	f = Fraction(i, n - i)
	if f.numerator == i and f.denominator == n - i:
		print(i, n - i)
		break


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

def coprime(a, b):
	return gcd(a, b) == 1

def main():
	n = int(input().strip())
	(a, b) = (0, 1)
	for i in range(1, n):
		for j in range(1, n):
			if i >= j:
				continue
			if gcd(i, j) == 1 and i + j == n and (a * j - b * i < 0):
				(a, b) = (i, j)
	print(a, b)
main()


def gcd(big, small):
	mod = big % small
	if mod == 0:
		return small
	return gcd(small, mod)

def find_fraction(total):
	for i in range(total // 2, 0, -1):
		if gcd(i, total - i) == 1:
			return str(i) + ' ' + str(total - i)
	return ''

def solution(inp1):
	return find_fraction(inp1)

def main():
	inp1 = input()
	result = solution(int(inp1))
	print(result)
main()


import math

def main():
	N = int(input())
	(a, b) = (N // 2, N - N // 2)
	while math.gcd(a, b) != 1:
		(a, b) = (a - 1, b + 1)
	print(a, b)
main()


n = int(input())
if n % 4 == 0:
	ans = [n // 2 - 1, n // 2 + 1]
elif n % 2 == 0:
	ans = [n // 2 - 2, n // 2 + 2]
else:
	ans = [n // 2, n // 2 + 1]
print(*ans, sep=' ')


import math

def isCoprime(a, b):
	if math.gcd(a, b) == 1:
		return True
	else:
		return False
x = int(input())
a = 1
b = x - a
m = 0
l = []
while a <= b:
	b = x - a
	if isCoprime(a, b):
		if a < b and a / b > m:
			m = a / b
			l = [a, b]
	a += 1
print(l[0], l[1], end=' ')


import math

def solution(x):
	s = int(x / 2)
	t = x - s
	while math.gcd(t, s) > 1:
		t += 1
		s -= 1
	return [s, t]

def printer(l1):
	return str(l1[0]) + ' ' + str(l1[1])

def answer():
	a = int(input())
	print(printer(solution(a)))
answer()


n = int(input())

def evk(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
m = 0
x = 0
y = 0
for i in range(1000):
	for j in range(i + 1, 1001):
		if i + j == n:
			if evk(i, j) == 1:
				if i / j > m:
					m = i / j
					x = i
					y = j
print(x, y)


from fractions import gcd
n = int(input())
ans = 0
for i in reversed(range(n // 2 + 1)):
	if gcd(i, n - i) == 1 and i < n - i:
		ans = i
		break
print(ans, n - ans)


import fractions
n = int(input())
if n % 2:
	print(n // 2, n - n // 2)
else:
	k = n // 2
	for i in range(k, 0, -1):
		if fractions.gcd(i, n - i) == 1:
			print(i, n - i)
			break


num = int(input())
ans1 = 0
ans2 = 0
if num % 2 == 0:
	ans1 = num // 2 - 1
	ans2 = num // 2 + 1
else:
	ans1 = num // 2
	ans2 = num // 2 + 1
while ans1 % 2 == 0 and ans2 % 2 == 0:
	ans1 -= 1
	ans2 += 1
print(str(ans1) + ' ' + str(ans2))


a = int(input())
d = a // 2 - (1 if not a % 2 else 0)
e = a - d
while d > 1:
	i = 2
	while i <= d:
		if d % i == 0 and e % i == 0:
			d -= 1
			e += 1
			break
		else:
			i += 1
	if i == d + 1:
		print(d, e)
		exit()
print(1, a - 1)


import math as m
a = int(input())
(x, y) = (0, 0)
if a % 2 == 0:
	(x, y) = (a // 2 - 1, a // 2 + 1)
else:
	(x, y) = (a // 2, a // 2 + 1)
while 1:
	if x + y == a and m.gcd(x, y) == 1 or x == 1:
		break
	else:
		x -= 1
		y += 1
print(x, y)


n = int(input())

def pat(func):

	def wrap(a, b):
		if func(a, b) == 1:
			return True
		else:
			return False
	return wrap

@pat
def dbd(a, b):
	if min(a, b) == 0:
		return max(a, b)
	elif min(a, b) == 1:
		return 1
	else:
		return dbd(max(a, b) % min(a, b), min(a, b))
i = 0
a = n - (n // 2 + 1)
b = n // 2 + 1
while dbd(b, a) != True:
	i += 1
	a -= i
	b += i
else:
	print(a, b)


from fractions import Fraction
n = int(input())
(numerator, denominator) = (1, n - 1)
(tmp_numerator, tmp_denominator) = (1, n - 1)
i = 1
while tmp_denominator - i:
	f = Fraction(numerator, denominator)
	tmp_f = Fraction(tmp_numerator, tmp_denominator)
	if tmp_f < 1 and tmp_denominator and (tmp_f > f) and (tmp_denominator == tmp_f.denominator) and (tmp_numerator == tmp_f.numerator):
		numerator = tmp_numerator
		denominator = tmp_denominator
	tmp_numerator += 1
	tmp_denominator -= 1
print(numerator, denominator)


n = int(input())
for numerator in reversed(range(1, n)):
	if numerator >= n - numerator:
		continue
	denominator = n - numerator
	v = int(numerator)
	i = 2
	good = True
	while v % i == 0:
		if v % i == 0 and denominator % i == 0:
			good = False
			break
		v //= i
	i = 3
	while i * i <= v:
		if v % i == 0:
			if denominator % i == 0:
				good = False
				break
			v //= i
		else:
			i += 2
	if v != 1 and denominator % v == 0:
		good = False
	if good:
		print(numerator, denominator)
		break


N = int(input())
if N % 4 == 0:
	print(N // 2 - 1, N // 2 + 1)
elif N % 4 == 2:
	print(N // 2 - 2, N // 2 + 2)
else:
	print(N // 2, N // 2 + 1)


t = int(input())
if t % 4 == 0:
	a = t / 2 - 1
	b = t / 2 + 1
elif t % 2 == 0:
	a = t / 2 - 2
	b = t / 2 + 2
else:
	a = t // 2
	b = t - a
print(str(int(a)) + ' ' + str(int(b)))


q = int(input())
w = 1
e = q - 1
while w + 1 < e - 1:
	w += 1
	e -= 1
for i in range(q):
	r = 0
	for i in range(2, q):
		if e % i == 0 and w % i == 0:
			r = 1
			break
	if r == 0:
		break
	else:
		w -= 1
		e += 1
print(w, e)


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

def maxIrreducibleFraction(n):
	nom = n // 2 if n % 2 != 0 else n // 2 - 1
	dem = n // 2 + 1
	while nom >= 1:
		if gcd(nom, dem) == 1:
			return (nom, dem)
		nom -= 1
		dem += 1
	return (nom, dem)
n = int(input())
print(*maxIrreducibleFraction(n))


def awal(n, m):
	if n < m:
		n += m
		m = n - m
		n = n - m
	if m == 0:
		return n
	if m == 1:
		return 1
	n -= m
	return awal(n, m)
n = int(input())
for i in range(int(n / 2), 0, -1):
	if awal(i, n - i) == 1:
		print(i, n - i)
		break