Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.

The path consists of $n$ consecutive tiles, numbered from $1$ to $n$. Ujan will paint each tile in some color. He will consider the path aesthetic if for any two different tiles with numbers $i$ and $j$, such that $|j - i|$ is a divisor of $n$ greater than $1$, they have the same color. Formally, the colors of two tiles with numbers $i$ and $j$ should be the same if $|i-j| > 1$ and $n \bmod |i-j| = 0$ (where $x \bmod y$ is the remainder when dividing $x$ by $y$).

Ujan wants to brighten up space. What is the maximum number of different colors that Ujan can use, so that the path is aesthetic?


-----Input-----

The first line of input contains a single integer $n$ ($1 \leq n \leq 10^{12}$), the length of the path.


-----Output-----

Output a single integer, the maximum possible number of colors that the path can be painted in.


-----Examples-----
Input
4

Output
2

Input
5

Output
5



-----Note-----

In the first sample, two colors is the maximum number. Tiles $1$ and $3$ should have the same color since $4 \bmod |3-1| = 0$. Also, tiles $2$ and $4$ should have the same color since $4 \bmod |4-2| = 0$.

In the second sample, all five colors can be used. [Image]

Difficulty: MEDIUM
Tags: Number theory

Mathematics

Constructive algorithms

Starter code:

Solutions:
import sys
input = sys.stdin.readline
x = int(input())
if x == 1:
	print(1)
	sys.exit()
import math
L = int(math.sqrt(x))
FACT = dict()
for i in range(2, L + 2):
	while x % i == 0:
		FACT[i] = FACT.get(i, 0) + 1
		x = x // i
if x != 1:
	FACT[x] = FACT.get(x, 0) + 1
if len(FACT) > 1:
	print(1)
else:
	print(list(FACT.keys())[0])


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

def solve(x):
	if x == 2 or x == 3 or x == 5:
		return x
	if x == 4:
		return 2
	primes = []
	root = int(x ** 0.5) + 5
	for i in range(2, root):
		if x % i == 0:
			primes.append(i)
			primes.append(x // i)
	if len(primes) == 0:
		return x
	g = primes[0]
	for p in primes:
		g = gcd(g, p)
	return g
n = int(input())
if n == 1:
	print(1)
else:
	print(solve(n))


import math

def factorize(n):
	count = 0
	while (n % 2 > 0) == False:
		n >>= 1
		count += 1
	ans = []
	if count > 0:
		ans.append(2)
	for i in range(3, int(math.sqrt(n)) + 1):
		count = 0
		while n % i == 0:
			count += 1
			n = int(n / i)
		if count > 0:
			ans.append(i)
		i += 2
	if n > 2:
		ans.append(n)
	return ans
n = int(input())
divs = factorize(n)
if len(divs) == 0:
	print(n)
elif len(divs) == 1:
	print(divs[0])
else:
	print('1')


import math

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

def isPower(num, base):
	if base == 1 and num != 1:
		return False
	if base == 1 and num == 1:
		return True
	if base == 0 and num != 1:
		return False
	power = int(math.log(num, base) + 0.5)
	return base ** power == num
n = int(input())
ans = 1
if isprime(n):
	ans = n
for i in range(2, int(n ** 0.5 + 1)):
	if isPower(n, i):
		if isprime(i):
			ans = i
print(ans)


import math

def lowestprime(a):
	for i in range(2, int(a ** 0.5) + 1):
		if not a % i:
			return i
	return a

def perfectnumber(a, i):
	while a != 1:
		if a < 1:
			return False
		a = a / i
	return True
a = int(input())
p = lowestprime(a)
if p == a:
	print(a)
elif perfectnumber(a, p):
	print(p)
else:
	print(1)


from math import floor, sqrt, gcd
n = int(input())
fact = []
for i in range(2, floor(sqrt(n)) + 1):
	if n % i == 0:
		if i == n % i:
			fact.append(i)
		else:
			fact.append(i)
			fact.append(n // i)
if fact == []:
	print(n)
else:
	g = gcd(0, fact[0])
	for i in range(1, len(fact)):
		g = gcd(g, fact[i])
	print(g)


from math import gcd as g
n = q = int(input())
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		q = g(g(q, i), n // i)
print(q)


def primfacs(n):
	i = 2
	primfac = []
	while i * i <= n:
		while n % i == 0:
			primfac.append(i)
			n = n / i
		i = i + 1
	if n > 1:
		primfac.append(n)
	return primfac
n = int(input())
if n == 1:
	print(1)
	exit()
l = list(set(primfacs(n)))
if len(l) > 1:
	print(1)
	exit()
else:
	print(l[0])
	exit()


import math
from collections import defaultdict

def primeFactors(n, record):
	ans = []
	while n % 2 == 0:
		if record[2] == 0:
			record[2] = 1
			ans.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			if record[i] == 0:
				ans.append(int(i))
				record[i] = 1
			n = n / i
	if n > 2:
		ans.append(n)
	return ans
n = int(input())
record = {}
record = defaultdict(lambda : 0, record)
ans = primeFactors(n, record)
if len(ans) == 1:
	print(ans[0])
else:
	print(1)


N = 1000000000000
N_SQRT = 1000000
is_prime = [True] * (N_SQRT + 1)
prime = []
is_prime[0] = False
is_prime[1] = False
for i in range(2, N_SQRT + 1):
	if is_prime[i]:
		prime.append(i)
		for j in range(i + i, N_SQRT + 1, i):
			is_prime[j] = False
n = int(input())
prime_factors = []
for i in prime:
	if n % i == 0:
		prime_factors.append(i)
		while n % i == 0:
			n = n // i
if n != 1:
	prime_factors.append(n)
if len(prime_factors) == 0:
	print(n)
elif len(prime_factors) == 1:
	print(prime_factors[0])
else:
	print(1)


from math import sqrt, ceil

def mindiv(n):
	if n == 1:
		return 1
	if n % 2 == 0:
		return 2
	if n % 3 == 0:
		return 3
	(div, inc) = (5, 2)
	while div < ceil(sqrt(n)) + 1:
		if n % div == 0:
			return div
		div += inc
		inc = 6 - inc
	return n
n = int(input())
m = mindiv(n)
while n % m == 0 and n > m:
	n = n / m
print(1 if n > m else m)


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
n = int(input())
if n == 1:
	print(1)
else:
	factors = prime_factors(n)
	if factors[0] != factors[-1]:
		print(1)
	else:
		print(factors[0])


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(n,) = gil()
p = []
if n & 1 == 0:
	p.append(2)
	while n % 2 == 0:
		n //= 2
for i in range(3, int(math.ceil(math.sqrt(n))) + 1, 2):
	if n % i == 0:
		p.append(i)
		while n % i == 0:
			n //= i
	if len(p) > 1:
		break
if n > 2:
	p.append(n)
if len(p) == 1:
	print(p[0])
else:
	print(1)


import sys
import math
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
ans = n
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		ans = math.gcd(ans, math.gcd(i, n // i))
print(ans)


import math
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))

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

def fact(n):
	s = []
	j = 2
	while j * j <= n:
		if n % j == 0:
			s += [j]
			while n % j == 0:
				n //= j
		j += 1
	if n > 1:
		s += [n]
	return s
n = I()
if prime(n):
	print(n)
else:
	s = fact(n)
	if len(s) == 1:
		print(s[0])
	else:
		print(1)


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n / i
	if n > 2:
		s.add(n)
	return s
n = int(input())
if n == 1:
	print(1)
elif isPrime(n):
	print(n)
else:
	ans = primeFactors(n)
	if len(ans) == 1:
		for i in ans:
			print(i)
	else:
		print(1)


import math
n = int(input())
a = set()
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		a.add(i)
		a.add(n // i)
s = n
for j in a:
	s = math.gcd(s, j)
print(s)


from functools import reduce

def primeFactor(N):
	(i, n, ret, d, sq) = (2, N, {}, 2, 99)
	while i <= sq:
		k = 0
		while n % i == 0:
			(n, k, ret[i]) = (n // i, k + 1, k + 1)
		if k > 0 or i == 97:
			sq = int(n ** (1 / 2) + 0.5)
		if i < 4:
			i = i * 2 - 1
		else:
			(i, d) = (i + d, d ^ 6)
	if n > 1:
		ret[n] = 1
	return ret

def divisors(N):
	pf = primeFactor(N)
	ret = [1]
	for p in pf:
		ret_prev = ret
		ret = []
		for i in range(pf[p] + 1):
			for r in ret_prev:
				ret.append(r * p ** i)
	return sorted(ret)

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

def gcd_mult(numbers):
	return reduce(gcd, numbers)
N = int(input())
dv = divisors(N)[1:-1]
if len(dv) == 0:
	print(N)
else:
	print(gcd_mult(dv))


import math
n = int(input())
x = 2
rem = 0
flag = True
while x <= math.sqrt(n):
	if n % x == 0:
		k = x
		c = 1
		while n > k:
			k *= x
			c += 1
		if n == k:
			print(x)
			flag = False
			break
		if n != k:
			print(1)
			flag = False
			break
	x += 1
if flag:
	print(n)


from sys import stdin, exit
n = int(stdin.readline())
nn = n
f = n
i = 2
while i * i <= n:
	while n % i == 0:
		n = n / i
		if f == nn:
			f = i
		elif f != i:
			print(1)
			exit()
	i = i + 1
if n == 1:
	print(f)
elif n == nn:
	print(f)
elif f != n:
	print(1)
	exit()


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
if n % 2 == 0:
	while n % 2 == 0:
		n //= 2
	if n == 1:
		print(2)
	else:
		print(1)
	exit()
for i in range(3, int(sqrt(n)) + 1, 2):
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		exit()
print(n)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

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

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

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

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def primeFactors(n):
	set1 = set()
	while n % 2 == 0:
		set1.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			set1.add(i)
			n = n / i
	if n > 2:
		set1.add(n)
	return set1
n = INT()
nums = primeFactors(n)
if len(nums) == 1:
	for el in nums:
		break
	if el == n:
		print(n)
	else:
		print(el)
else:
	print(1)


from sys import *
from math import *
from collections import *
n = int(stdin.readline())
a = []
for i in range(2, int(sqrt(n)) + 1):
	if n % i == 0:
		a.append(i)
		a.append(n // i)
b = []
if len(a) > 0:
	a.sort()
	b = [a[0]]
	for i in range(1, len(a)):
		if a[i] != a[i - 1]:
			b.append(a[i])
if len(b) > 1:
	x = b[0]
	f = 0
	for i in range(len(b)):
		if b[i] % x != 0:
			f = 1
			break
	if f == 1:
		print(1)
	else:
		print(n // b[len(b) - 1])
elif len(b) == 1:
	print(n // b[0])
else:
	print(n)


def primes(n):
	primfac = []
	d = 2
	while d * d <= n:
		while n % d == 0:
			primfac.append(d)
			n //= d
		d += 1
	if n > 1:
		primfac.append(n)
	return set(primfac)
n = int(input())
k = primes(n)
if n == 1:
	print(1)
elif len(k) == 1:
	print(next(iter(k)))
else:
	print(1)


import math

def factorize(n):
	temp = []
	count = 0
	while (n % 2 > 0) == False:
		n >>= 1
		count += 1
	if count > 0:
		temp.append(2)
	for i in range(3, int(math.sqrt(n)) + 1):
		count = 0
		while n % i == 0:
			count += 1
			n = int(n / i)
		if count > 0:
			temp.append(i)
		i += 2
	if n > 2:
		temp.append(n)
	return temp
n = int(input())
if n == 1:
	print(1)
else:
	x = factorize(n)
	if len(x) > 1:
		print(1)
	else:
		print(x[0])


def answer(n):
	count = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			count += 1
			copy = n
			while copy % i == 0:
				copy = copy // i
			if copy == 1:
				return i
			return 1
	return n
n = int(input())
print(answer(n))


import sys
import math

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

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

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

def factors(p):
	fac = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if p % i == 0:
			fac.append(i)
			fac.append(p // i)
	return fac
n = read_int()
f = factors(n)
if len(f) >= 1:
	ans = f[0]
	for i in f:
		ans = gcd(ans, i)
	print(ans)
else:
	print(n)


def isPrime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return 0
		i += 1
	return 1
j = 2
n = int(input())
p = []
while j * j < n:
	if n % j == 0:
		if isPrime(j):
			p.append(j)
		if isPrime(n // j):
			p.append(n // j)
	j += 1
if j * j == n:
	if isPrime(j):
		p.append(j)
if len(p) > 1:
	print(1)
elif len(p) == 1:
	print(p[0])
else:
	print(n)


from math import gcd
from functools import reduce

def factors(n):
	k = sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5 + 1)) if n % i == 0)))))
	return k[1:]
n = int(input())
if n == 1:
	print(1)
else:
	col = factors(n)
	ans = col[0]
	for i in col:
		ans = gcd(ans, i)
	print(ans)


import sys
import math
import itertools
import collections

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 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 int(str(n)[::-1])

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=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
k = ii()
if k == 1:
	print(1)
elif prime(k):
	print(k)
else:
	a = divs(k)
	p = 0
	ans = 0
	for n in a:
		if prime(n):
			p += 1
			ans = n
		if p == 2:
			exit(print(1))
	print(ans)


def mdc(a, b):
	if b == 0:
		return a
	return mdc(b, a % b)
n = int(input())
a = n
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		a = mdc(a, i)
		a = mdc(a, n // i)
print(a)


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

def f(n):
	ans = n
	x = primefactors(n)
	if len(x) == 1:
		return x[0]
	else:
		return 1
print(f(int(input())))


def gcd(a, b):
	while b > 0:
		c = a % b
		a = b
		b = c
	return a
n = int(input())
i = 2
divisors = list()
g = n
while i * i <= n:
	if n % i == 0:
		g = gcd(g, i)
		g = gcd(g, n // i)
	i += 1
print(g)


import math
factor = [1]

def primeFactors(n):
	while n % 2 == 0:
		factor.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factor.append(i)
			n = n // i
	if n > 2:
		factor.append(n)
n = int(input())
primeFactors(n)
if len(set(factor)) >= 3:
	print(1)
else:
	print(factor[-1])


from math import gcd

def Fenjie(n):
	k = {}
	if n == 1:
		return {1}
	a = 2
	while n >= 2:
		b = n % a
		if a * a > n:
			if n in k:
				k[n] += 1
			else:
				k[n] = 1
			break
		if b == 0:
			if a in k:
				k[a] += 1
			else:
				k[a] = 1
			n = n // a
		else:
			a += 1
	return k
n = int(input())
k = Fenjie(n)
ans = 0
for i in k:
	ans = gcd(ans, i)
print(ans)


import sys
from math import sqrt
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
t = n
s = set()
i = 2
while i * i <= n:
	if n % i == 0:
		s.add(i)
		while n % i == 0:
			n = n // i
	i += 1
if n != 1:
	s.add(n)
if len(s) >= 2 or t == 1:
	print(1)
else:
	print(s.pop())


def is_single_prime_factor(n):
	max_factor = int(1000000.0 + 1)
	factor_found = -1
	for i in range(2, max_factor):
		if n % i == 0:
			while n % i == 0 and n > 1:
				n //= i
			if n != 1:
				return 1
			return i
	return n
n = int(input())
print(is_single_prime_factor(n))

def test():
	assert is_single_prime_factor(4) == 2
	assert is_single_prime_factor(6) == 1
	assert is_single_prime_factor(971324893193) == 1


n = int(input())
import math
d = set()
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		d.add(i)
		d.add(n // i)
if not d:
	print(n)
else:
	c = n
	for i in d:
		c = math.gcd(c, i)
	print(c)


import math

def IsPrime(x):
	if x <= 2:
		return x == 2
	top = int(math.sqrt(x)) + 1
	for i in range(2, top):
		if x % i == 0:
			return False
	return True
val = int(input())
if val == 1:
	print('1')
elif IsPrime(val):
	print(val)
else:
	cnt = 0
	top = int(math.sqrt(val)) + 1
	for i in range(2, top):
		if val % i == 0:
			cnt += 1
			while val % i == 0:
				val /= i
			if val == 1:
				print(i)
			else:
				print('1')
			return


from math import gcd
n = int(input())
if n == 1:
	print(1)
	return
elif n == 2:
	print(2)
	return
else:
	d = 0
	for i in range(2, n):
		if i * i > n:
			break
		if n % i == 0:
			d = gcd(d, i)
			d = gcd(d, n // i)
if d:
	print(d)
else:
	print(n)


import functools

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

def prime_factors(n):
	if n == 1:
		return [1]
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			while n % i == 0:
				n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors
factors = prime_factors(int(input()))
print(functools.reduce(lambda r, i: gcd(r, i), factors[1:], factors[0]))


from collections import Counter, defaultdict, deque
import heapq as hq
from itertools import count, islice
from functools import reduce
import math
import sys

def primes(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
input = sys.stdin.readline
n = int(input())
if n == 1:
	print(1)
else:
	p = primes(n)
	print(reduce(math.gcd, p))


from math import inf as inf
from math import *
from collections import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	n = int(input())
	r = n
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			r = gcd(r, gcd(i, n // i))
	print(r)


num = int(input())
count = 0
cond = 0
for i in range(2, int(num ** 0.5) + 1):
	if num % i == 0:
		count += 1
		prim = i
		break
if count == 0:
	print(num)
else:
	for j in range(1, 40):
		if prim ** j == num:
			print(prim)
			cond += 1
			break
	if cond == 0:
		print(1)


import math

def primeFactors(n, a):
	while n % 2 == 0:
		a.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n / i
	if n > 2:
		a.append(n)
	return a
n = int(input())
if n == 1:
	print(1)
else:
	c = list()
	b = primeFactors(n, c)
	che = -1
	cho = -1
	for i in range(len(b)):
		if b[i] % 2 == 0:
			che = 1
		elif b[i] % 2 == 1:
			cho = 1
	ans = min(b)
	ans = int(ans)
	b = list(set(b))
	if len(b) > 1:
		print(1)
	else:
		print(b[0])


from math import sqrt, ceil, log, floor
n = int(input())
if n == 2:
	print(2)
	exit()
is_prime = True
m = 2
for i in range(2, int(ceil(sqrt(n))) + 1):
	if n % i == 0:
		is_prime = False
		m = i
		break
x = log(n, m)
if is_prime:
	print(n)
elif abs(ceil(x) - x) < 1e-10 or abs(floor(x) - x) < 1e-10:
	print(int(m))
else:
	print(1)


from math import gcd
n = int(input())
x = n
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		x = gcd(x, i)
		x = gcd(x, n // i)
print(x)


n = int(input())
import math
g = n
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		g = math.gcd(g, math.gcd(i, n // i))
print(g)


def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
a = []
b = []
n = int(input())
i = 2
while i * i <= n:
	if n % i == 0:
		a.append(i)
		b.append(n // i)
	i += 1
if len(a) == 0 and len(b) == 0:
	print(n)
else:
	t = a[0]
	for item in a + b:
		t = computeGCD(item, t)
		if t == 1:
			break
	print(t)


import sys

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

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

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

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
	from math import sqrt
	from collections import Counter
	d = Counter()
	for i in range(2, int(sqrt(num)) + 1):
		while num % i == 0:
			num //= i
			d[i] += 1
		if num == 1:
			break
	if num != 1:
		d[num] += 1
	return d
N = INT()
d = factorize(N)
if len(d) == 1:
	for k in d.keys():
		print(k)
else:
	print(1)


import math
n = int(input())
if n == 1:
	print('1')
else:
	smallestDivisor = n
	if n % 2 == 0:
		smallestDivisor = 2
	elif n % 3 == 0:
		smallestDivisor = 3
	else:
		for i in range(5, int(math.sqrt(n)) + 1, 2):
			if n % i == 0:
				smallestDivisor = i
				break
	while n % smallestDivisor == 0:
		n //= smallestDivisor
	print(str(smallestDivisor) if n == 1 else '1')


import math

def findDivisors(n):
	i = 1
	a = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				if i != 1 and i != n:
					a.append(i)
			elif i != 1 and i != n:
				a.append(i)
				a.append(n / i)
		i = i + 1
	return a
n = int(input())
a = []
a = findDivisors(n)
if len(a) == 0:
	print(n)
else:
	for i in range(len(a)):
		a[i] = int(a[i])
	g = int(a[0])
	for i in range(1, len(a)):
		g = math.gcd(g, int(a[i]))
	if g == 1:
		print(1)
	else:
		print(int(min(a)))


n = int(input())
check = 0
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		check = 1
		while n % i == 0:
			n /= i
		if n == 1:
			print(i)
			break
		else:
			print(1)
			break
if check == 0:
	print(n)


n = int(input())
f = []
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		while n % i == 0:
			n = n // i
		f.append(i)
if n > 1:
	f.append(n)
if len(f) == 1:
	print(f[0])
else:
	print(1)


n = int(input())
q = []
m = n
for i in range(2, 10 ** 7):
	if m % i == 0:
		q.append(i)
		while m % i == 0:
			m //= i
		if len(q) >= 2:
			break
if m != 1:
	q.append(m)
if len(q) >= 2:
	print(1)
elif len(q) == 1:
	print(q[0])
else:
	print(n)


import math

def primeFactors(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n // i
	if n > 2:
		a.append(n)
	return a
n = int(input())
if n == 1:
	print(1)
else:
	l = primeFactors(n)
	x = min(l)
	y = max(l)
	if x == y:
		print(x)
	else:
		print(1)


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n
s = set()
n = int(input())
if isPrime(n):
	print(n)
else:
	m = n
	while n % 2 == 0:
		s.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n / i
	if n > 2:
		s.add(n)
	l = len(s)
	if l > 1:
		print(1)
	else:
		print(smallestDivisor(m))


import math

def primeFactors(n):
	v = set()
	while n % 2 == 0:
		v.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			v.add(i)
			n = n / i
	if n > 2:
		v.add(n)
	return v
n = int(input())
s = primeFactors(n)
if len(s) == 1:
	for i in s:
		print(i)
else:
	print(1)


import sys
try:
	fin = open('in')
except:
	fin = sys.stdin
n = int(fin.readline())
p = []
i = 2
while i * i <= n:
	if n % i == 0:
		p.append(i)
		while n % i == 0:
			n //= i
	i += 1
if n > 1:
	p.append(n)
if len(p) == 1:
	print(p[0])
else:
	print(1)


n = int(input())
i = 2
l = []
while i * i <= n:
	if n % i == 0:
		l.append(i)
		while n % i == 0:
			n = n // i
	i += 1
if n != 1:
	l.append(n)
if len(l) > 1:
	print(1)
elif len(l) == 1:
	print(l[0])
elif n == 1:
	print(1)


n = int(input())
res = n
result = []
from math import gcd
for i in range(2, min(n, int(n ** 0.5) + 3)):
	if n % i == 0:
		res = gcd(i, res)
		res = gcd(n // i, res)
print(res)


import math
n = int(input())
ans = 0
f = 0
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		f = 1
		ans = math.gcd(ans, i)
		ans = math.gcd(ans, n // i)
if f:
	print(ans)
else:
	print(n)


def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans
n = int(input())
k = Factor(n)
if n == 1:
	print(1)
	exit()
if len(k) == 1:
	print(n)
elif len(set(k)) == 1:
	print(min(k))
else:
	print(1)


def divisors(n):
	div = []
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			div.append(i)
			if i * i != n:
				div.append(n // i)
	return sorted(div)
from functools import reduce
from math import gcd
n = int(input())
div = divisors(n)
if len(div):
	print(reduce(gcd, div))
else:
	print(n)


t = int(input())
contador = 0
divisor = 0
avance = 2
n = 0
valor = 1
while avance <= int(t ** 0.5) and contador == 0:
	if t % avance == 0:
		contador += 1
		divisor = avance
		n = 0
		while avance ** n < t:
			n += 1
		if avance ** n == t:
			valor = avance
	avance += 1
if contador == 0:
	print(t)
else:
	print(valor)


import sys
ip = lambda : sys.stdin.readline().rstrip()
n = int(ip())

def f(n):
	ans = True
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ans = False
			break
	return ans
if n <= 2:
	print(n)
else:
	val = -1
	ct = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and f(i):
			if val == -1:
				val = i
			ct += 1
	if ct >= 2:
		print(1)
	elif ct == 1:
		while n % val == 0:
			n //= val
		if n == 1:
			print(val)
		else:
			print(1)
	else:
		print(n)


p = []

def factorize(N):
	root = int(N ** 0.5) + 1
	for i in range(2, root):
		if N % i == 0:
			while N % i == 0:
				N /= i
			p.append(i)
			if len(p) > 1:
				break
	if N > 1:
		p.append(N)
N = int(input())
if N == 1:
	print(N)
else:
	factorize(N)
	if len(p) > 1:
		print(1)
	else:
		print(p[0])


n = int(input())
xx = n
li = []
if n % 2 == 0:
	li.append(2)
	while n % 2 == 0:
		n //= 2
for i in range(3, int(n ** (1 / 2)) + 1, 2):
	if n % i == 0:
		li.append(i)
		while n % i == 0:
			n //= i
if n > 2:
	li.append(n)
if xx == 1:
	print(1)
elif len(li) > 1:
	print(1)
elif len(li) == 1:
	print(li[0])


from sys import stdin
import math
n = int(stdin.readline())
if n < 3:
	k = n
else:
	d = 0
	g = n
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			d += 1
			g = math.gcd(g, i)
			if i * i != n:
				d += 1
				g = math.gcd(g, n // i)
	if d == 0:
		k = n
	else:
		k = g
print(k)


import math

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def isPower(div, n):
	if n == 1:
		return True
	ans = int(math.log(n, div))
	if pow(div, ans) == n or pow(div, ans + 1) == n:
		return True
	else:
		False
num = int(input().strip())
small = smallestDivisor(num)
if isPower(small, num):
	print(small)
else:
	print(1)


n = int(input())
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		exit(0)
print(n)


from math import sqrt
n = int(input())
cou = 0
nn = n
ind = 1
if n % 2 == 0:
	cou += 1
	ind = 2
while n % 2 == 0:
	n = n // 2
for i in range(3, int(sqrt(n)) + 1, 2):
	if n % i == 0:
		ind = i
		cou += 1
	if cou > 1:
		break
	while n % i == 0:
		n = n // i
if n > 1 and n != nn:
	cou += 1
if cou == 0:
	print(n)
elif cou == 1:
	print(ind)
else:
	print(1)


def divisors(n):
	l = []
	if not n % 2:
		l.append(2)
		while not n % 2:
			n //= 2
	i = 3
	while i * i <= n:
		if not n % i:
			l.append(i)
		while not n % i:
			n //= i
		i += 2
	if n > 2:
		l.append(n)
	return l
n = int(input())
x = divisors(n)
if len(x) == 1:
	print(x[0])
else:
	print(1)


import sys

def isprime(n):
	if n % 2 == 0:
		if n & n - 1 == 0:
			return 2
		else:
			return 1
	if n % 3 == 0:
		n //= 3
		while n >= 1:
			if n % 3 == 0:
				n //= 3
			elif n == 1:
				return 3
			else:
				return 1
	i = 5
	while i * i <= n:
		if n % i == 0:
			n //= i
			while n >= 1:
				if n % i == 0:
					n //= i
				elif n == 1:
					return i
				else:
					return 1
		if n % (i + 2) == 0:
			n //= i + 2
			while n >= 1:
				if n % (i + 2) == 0:
					n //= i + 2
				elif n == 1:
					return i + 2
				else:
					return 1
		i += 6
	return n

def answer(n):
	if n == 1:
		return 1
	if n == 2:
		return 2
	if n == 3:
		return 3
	return isprime(n)

def main():
	n = int(sys.stdin.readline())
	print(answer(n))
	return
main()


def prime_factors(n):
	if n == 1:
		return [1]
	d = 2
	prime_factors = []
	while d * d <= n and len(prime_factors) < 2:
		if n % d == 0:
			prime_factors.append(d)
			while n % d == 0:
				n = n // d
		d += 1
	if n > 1:
		prime_factors.append(n)
	return prime_factors

def solve():
	n = int(input())
	pfactors = prime_factors(n)
	if len(pfactors) > 1:
		print(1)
	else:
		print(pfactors[0])
solve()


import math
n = int(input())

def divisorGenerator(n):
	large_divisors = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			yield i
			if i * i != n:
				large_divisors.append(n / i)
	for divisor in reversed(large_divisors):
		yield int(divisor)
result = n
divs = list(divisorGenerator(n))
if len(divs) > 0:
	for i in divs:
		result = math.gcd(result, i)
print(result)


n = int(input())

def isPrime(val):
	if val < 2:
		return 0
	n = int(val ** 0.5) + 1
	for i in range(2, n):
		if val % i == 0:
			return 0
	return 1

def titlePaint(n):
	if n < 2 or isPrime(n):
		print(n)
		return 0
	n1 = int(n ** 0.5) * 2
	dic = dict()
	for i in range(2, n1):
		while n % i == 0:
			if i not in dic:
				dic[i] = 1
			else:
				dic[i] += 1
			n /= i
	dic1 = sorted(dic.items(), key=lambda x: x[1])
	if dic1[0][1] == 1:
		print(1)
		return 0
	if not dic:
		print(1)
		return 0
	if len(dic) == 1:
		print(dic1[0][0])
		return 0
	else:
		print(1)
		return 0
titlePaint(n)


import math
l = set()

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

def pf(k):
	if k % 2 == 0:
		l.add(2)
		while k % 2 == 0:
			k //= 2
			if k != 1:
				l.add(k)
	for t in range(3, int(math.sqrt(n)) + 2, 2):
		if k % t == 0:
			l.add(t)
			while k % t == 0:
				k //= t
				if k != 1:
					l.add(k)
	if k > 2:
		l.add(n)
n = int(input())
if n == 1:
	print(1)
else:
	pf(n)
	l = list(l)
	ans = l[0]
	for i in l:
		ans = math.gcd(ans, i)
	print(ans)


import sys
import itertools
import math
import collections
from collections import Counter

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[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 ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

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

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

def 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
n = ii()
pr = sieve(10 ** 6 + 1)
c = []
if n == 1:
	exit(print(1))
if prime(n):
	exit(print(n))
prime = 0
for i in pr:
	if n % i == 0:
		prime = i
while n % prime == 0:
	n = n // prime
print(1) if n != 1 else print(prime)


n = int(input())
count = 1
divisor = n
for i in range(2, n + 1):
	if i * i > n:
		break
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		exit(0)
print(n)


from math import gcd
N = int(input())
ats = 0
i = 1
while i * i <= N:
	if N % i == 0:
		if i != 1:
			ats = gcd(ats, i)
		ats = gcd(ats, N // i)
	i += 1
print(ats)


import math
n = int(input())
ans = 1
if n % 2 == 0:
	while n > 1:
		if n % 2 == 1:
			break
		n /= 2
	if n == 1:
		ans = 2
else:
	m = math.floor(math.sqrt(n))
	check = 0
	for i in range(3, m + 1, 2):
		if n % i == 0:
			n /= i
			check = 1
			while n > 1:
				if n % i > 0:
					break
				n /= i
			if n == 1:
				ans = i
			break
	if check == 0:
		ans = n
print(ans)


n = int(input())
n1 = n
s = set()
for i in range(2, int(n1 ** 0.5) + 1):
	while n1 % i == 0:
		n1 = n1 // i
		s.add(i)
if n1 > 1:
	s.add(n1)
if len(s) == 1:
	s = list(s)
	s.sort()
	print(s[0])
else:
	print(1)


import math
n = int(input())
isPrime = True
orign = n
factorcnt = 0
privfactor = 0
k = 2
while n != 1:
	if k >= int(math.sqrt(orign)) + 10:
		if isPrime == False:
			factorcnt += 1
		break
	if n % k == 0:
		if privfactor != k:
			privfactor = k
			factorcnt += 1
		isPrime = False
		n //= k
	else:
		k += 1
if factorcnt >= 2:
	print(1)
elif factorcnt == 1:
	print(privfactor)
else:
	print(n)


from math import sqrt, floor

def sieve(n):
	primes = [True] * (n + 1)
	primes[0] = False
	primes[1] = False
	for i in range(2, n + 1):
		if i * i > n:
			break
		if primes[i] == False:
			continue
		for j in range(2 * i, n + 1, i):
			primes[j] = False
	return primes

def run_testcase():
	number = int(input())
	num_sqrt = sqrt(number)
	primes = sieve(floor(num_sqrt))
	prime_divisors_count = 0
	last_prime_divisor = 0
	for (value, prime) in enumerate(primes):
		if prime:
			if number % value == 0:
				last_prime_divisor = value
				prime_divisors_count += 1
				if prime_divisors_count >= 2:
					return 1
				while number % value == 0:
					number = number // value
				if number == 1:
					return value
				else:
					return 1
	for (value, prime) in enumerate(primes):
		if prime:
			if number % value == 0:
				last_prime_divisor = value
				prime_divisors_count += 1
				if prime_divisors_count >= 2:
					return 1
	if last_prime_divisor == 0:
		return number
	elif last_prime_divisor ** 2 == number:
		return last_prime_divisor
	else:
		return 1
	return last_prime_divisor if last_prime_divisor != 0 else number
print(str(run_testcase()))


import math

def SieveofEratosthenes(number):
	prime_list = []
	prime = number
	for i in range(2, int(math.sqrt(number)) + 3, 1):
		if number % i == 0:
			prime = i
			break
	while number > 1:
		if number % prime == 0:
			number = number // prime
		else:
			break
	if number == 1:
		return prime
	else:
		return 1
	return prime_list
num = int(input())
if num == 1:
	print(num)
else:
	print(SieveofEratosthenes(num))


n = int(input())
c = n
s = set()
r = int(n ** 0.5)
i = 2
while i <= r:
	if n % i == 0:
		while n % i == 0:
			s.add(i)
			n //= i
		break
	i += 1
if n == 1 and len(s) == 1:
	f = s.pop()
	if f == c:
		print(c)
	else:
		print(f)
elif len(s) == 0:
	print(c)
else:
	print(1)


from math import sqrt, ceil

def is_prime(a):
	if 1 == a:
		return False
	if 2 == a:
		return True
	else:
		return all((a % i for i in range(2, int(ceil(sqrt(a) + 1)))))
n = int(input())
if n == 1:
	print(1)
elif is_prime(n):
	print(n)
else:
	numero = n
	for i in range(2, int(ceil(sqrt(n) + 3))):
		if numero % i == 0:
			while True:
				if numero % i != 0:
					break
				numero /= i
			if numero == 1:
				print(i)
			else:
				print(1)
			break


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
import math
k = math.ceil(n ** 0.5)
arr = set()
for i in range(2, k + 1):
	if n % i == 0:
		arr.add(i)
		if n // i != 1:
			arr.add(n // i)
if not arr:
	print(n)
elif len(arr) == 1:
	print(list(arr)[0])
else:
	arr = list(arr)
	m = gcd(arr[0], arr[1])
	for i in range(2, len(arr) - 1):
		m = min(m, gcd(arr[i], arr[i + 1]))
	print(m)


import math
n = int(input())
arr = []
i = 2
while i * i <= n:
	if i * i != n and n % i == 0:
		arr.append(i)
		arr.append(n // i)
	elif i * i == n:
		arr.append(i)
	i += 1
ans = 0
if len(arr) == 0:
	print(n)
else:
	for j in arr:
		ans = math.gcd(j, ans)
	print(ans)


import array
import bisect
import collections
from fractions import Fraction
import functools
import itertools
import math
import os
import sys

def main():
	N = read_int()
	print(solve(N))

def solve(N):
	d = []
	x = 2
	while x * x <= N:
		if N % x == 0:
			d.append(x)
			if x * x < N:
				d.append(N // x)
		x += 1
	d.sort()
	if not d:
		return N
	g = d[0]
	for x in d[1:]:
		g = math.gcd(g, x)
	return g
DEBUG = 'DEBUG' in os.environ

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

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
divs = []
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		divs.append(i)
		if i != n // i:
			divs.append(n // i)
if len(divs) == 0:
	print(n)
	exit()
G = divs[0]
for d in divs[1:]:
	G = gcd(G, d)
print(G)


import sys
input = sys.stdin.readline
import math

def primeFactors(n):
	factor = set()
	while n % 2 == 0:
		(factor.add(2),)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			(factor.add(i),)
			n = n / i
	if n > 2:
		factor.add(n)
	return factor
t = int(input())
x = list(primeFactors(t))
if len(x) > 1:
	print(1)
elif t == 1:
	print(1)
else:
	print(min(x))


import os
import sys
from io import BytesIO, IOBase
from math import gcd

def main():
	n = int(input())
	(a, i) = ([n], 2)
	while i * i <= n:
		if not n % i:
			if n // i != i:
				a.append(n // i)
			a.append(i)
		i += 1
	g = 0
	for i in a:
		g = gcd(g, i)
	print(g)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


def mi():
	return map(int, input().split())
n = int(input())
c = 0
div = -1
while n % 2 == 0:
	c = 1
	n = n / 2
	div = 2
import math
for i in range(3, int(math.sqrt(n)) + 1, 2):
	en = False
	while n % i == 0:
		en = True
		n = n / i
		div = i
	if en:
		c += 1
if n > 2:
	c += 1
	div = n
if c == 1:
	print(div)
else:
	print(1)


n = int(input())
divs = set()
for i in range(2, 1 + int(n ** 0.5)):
	if n % i == 0:
		divs.add(i)
		divs.add(n // i)
divs = sorted(list(divs))
if len(divs) == 0:
	print(n)
elif len(divs) == 1:
	print(int(n ** 0.5))
else:
	par = divs[0]
	ok = True
	for i in divs:
		if i % par:
			ok = False
			break
	if ok:
		print(par)
	else:
		print(1)


import math
n = int(input())

def pf(n):
	l = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if len(l) >= 2:
			return 1
		if n % i == 0:
			l.append(i)
		while n % i == 0:
			n = n // i
	if n >= 2:
		l.append(n)
	if len(l) >= 2:
		return 1
	return l[0]

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
if n == 1:
	print(1)
elif isPrime(n):
	print(n)
else:
	print(pf(n))


n = int(input())
c = 0
for i in range(2, 10 ** 6 + 1):
	if n % i == 0:
		while n != 1:
			if n % i == 0:
				n /= i
			else:
				print('1')
				break
		if n == 1:
			print(i)
		c = 1
		break
if c != 1:
	print(n)


import math

def primeFactors(n):
	t = False
	c = 0
	s = set()
	while n % 2 == 0:
		t = True
		s.add(2)
		n = n / 2
	if t:
		c += 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		t = False
		while n % i == 0:
			t = True
			s.add(i)
			n = n / i
		if t:
			c += 1
	if n > 2:
		s.add(n)
		c += 1
	if c == 0:
		print(n)
	elif c == 1:
		print(s.pop())
	else:
		print(1)
primeFactors(int(input()))


n = int(input())
i = 2
while i * i <= n:
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		break
	i += 1
else:
	print(n)


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
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	kk = prime_factors(n)
	if len(set(kk)) == 1:
		print(kk[0])
	else:
		print(1)


n = int(input())

def Factor(n):
	Ans = set()
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.add(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.add(n)
	return Ans
if n < 4:
	print(n)
	exit()
divs = Factor(n)
if len(divs) == 1:
	print(divs.pop())
elif not divs:
	print(n)
else:
	print(1)


import math
n = int(input())
dividings = set()
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n > 1:
			print(1)
			exit()
		dividings.add(i)
if len(dividings) > 1:
	print(1)
if len(dividings) == 1:
	for i in dividings:
		print(i)
if len(dividings) == 0:
	print(n)


n = int(input())
p = 2
while n % p and p ** 2 <= n:
	p += 1
if p ** 2 > n:
	p = n
pw = n.bit_length() // p.bit_length()
while pow(p, pw) < n:
	pw += 1
while pow(p, pw) > n:
	pw -= 1
if pow(p, pw) == n:
	print(p)
else:
	print(1)


n = int(input())
if n == 1:
	print(1)
else:
	import math
	if n > 1000:
		k = math.sqrt(n)
		k = math.ceil(k)
	else:
		k = n + 1
	p = n
	for i in range(2, k + 1):
		if p % i == 0:
			while p % i == 0:
				p = p / i
			break
	if p == 1:
		print(i)
	elif p == n:
		print(n)
	else:
		print(1)


def make_prime_factors_distinct(n):
	prime_factors = []
	for k in range(2, int(n ** 0.5) + 1):
		if n % k == 0:
			prime_factors.append(k)
			while n % k == 0:
				n = n // k
	if n != 1:
		prime_factors.append(n)
	return prime_factors
n = int(input())
ans = make_prime_factors_distinct(n)
if len(ans) == 1 and ans[0] == n:
	print(n)
elif len(ans) == 1:
	print(ans[0])
else:
	print(1)


n = int(input())
factors = set()
num = n
for i in range(2, int(num ** 0.5) + 1):
	while n % i == 0:
		factors.add(i)
		n //= i
if n != 1:
	factors.add(n)
if len(factors) == 0:
	print(n)
elif len(factors) == 1:
	print(list(factors)[0])
else:
	print(1)


import math
n = int(input())
if n == 1:
	print(1)
else:
	primes = [n]
	for i in range(2, math.floor(math.sqrt(n)) + 1):
		if n % i == 0:
			primes.append(i)
			primes.append(n // i)
	best = primes[0]
	for i in range(1, len(primes)):
		best = math.gcd(best, primes[i])
	print(best)


import sys
readline = sys.stdin.readline

def prf(m):
	pf = {}
	for i in range(2, int(m ** 0.5) + 1):
		while m % i == 0:
			pf[i] = pf.get(i, 0) + 1
			m //= i
	if m > 1:
		pf[m] = 1
	return pf
N = int(readline())
Pf = prf(N)
ans = 1
if len(Pf) == 1:
	ans = list(Pf.keys())[0]
print(ans)


n = int(input())
min_del = 0
i = 2
while i * i <= n:
	if n % i == 0:
		if min_del == 0:
			min_del = i
		elif i % min_del != 0:
			print(1)
			exit()
		while n % i == 0:
			n //= i
	i += 1
if n > 1 and min_del != 0:
	print(1)
elif min_del == 0:
	print(n)
else:
	print(min_del)


import math
n = int(input())
div = []
for i in range(2, n):
	if i * i > n:
		break
	if n % i == 0:
		if i * i != n:
			div += [i, n // i]
		else:
			div.append(i)
g = n
for i in div:
	g = math.gcd(g, i)
print(n if div == [] else g)


import math

def div(n):
	i = 2
	ans1 = []
	ans2 = []
	while i <= math.sqrt(n):
		if n % i == 0:
			ans1.append(i)
			if n // i != i:
				ans2.append(n // i)
		i += 1
	return ans1 + list(reversed(ans2))

def solve(n):
	divs = div(n)
	if not divs:
		return n
	mind = divs[0]
	ans = mind
	for i in range(1, len(divs)):
		if divs[i] % mind != 0:
			return 1
	return mind
n = int(input())
print(solve(n))


def kekw(n):
	i = 2
	primfac = []
	while i * i <= n:
		while n % i == 0:
			primfac.append(i)
			n = n / i
		i = i + 1
	if n > 1:
		primfac.append(int(n))
	return primfac
quq = int(input())
if quq == 1:
	print(1)
	exit()
kek = kekw(quq)
if len(kek) == 1:
	print(kek[0])
elif len(list(set(kek))) > 1:
	print(1)
else:
	print(kek[0])


import sys
input = lambda : sys.stdin.readline().strip()
from math import ceil, sqrt
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	for i in range(2, ceil(sqrt(n)) + 1):
		if n % i == 0:
			while not n % i:
				n //= i
			if n == 1:
				print(i)
			else:
				print(1)
			break
	else:
		print(n)


import math
from decimal import *
import random
import sys
n = int(input())
tn = int(n)
(odd, even) = (False, False)
mult = set()
i = 2
prime = True
while i * i <= tn:
	if n % i == 0:
		prime = False
		while n % i == 0:
			mult.add(i)
			n //= i
		if n == 1:
			break
	i += 1
if n != 1:
	mult.add(n)
if prime or tn == 1:
	print(tn)
elif len(mult) > 1:
	print(1)
else:
	print(list(mult)[0])


import math
n = int(input())
j = 1
l = []
for i in range(2, math.ceil(math.sqrt(n)) + 1):
	if n % i == 0:
		if n // i == i:
			l.append(i)
		else:
			if i != n:
				l.append(i)
			if n // i != 1:
				l.append(n // i)
l.sort()
n1 = len(l)
mini = n
if n1 >= 1:
	mini = l[0]
for i in range(n1 - 1):
	mini = min(l[i + 1] - l[i], mini)
for i in range(n1):
	for j in range(i + 1, n1):
		if math.gcd(l[i], n // l[i]) == 1:
			mini = 1
			break
print(max(mini, 1))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

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

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

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

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
prime = [1 for i in range(10 ** 6 + 1)]
prime[0] = 0
prime[1] = 0
for i in range(10 ** 6 + 1):
	if prime[i]:
		for j in range(2 * i, 10 ** 6 + 1, i):
			prime[j] = 0
n = l()[0]
if n <= 3:
	print(n)
	exit()
step = n
div = []
for i in range(2, int(n ** 0.5) + 2):
	if n % i == 0 and prime[i]:
		div.append(i)
		if n // i < 10 ** 6 + 2 and prime[n // i] and (n // i not in div):
			div.append(n // i)
		step = i
if len(div) > 1:
	print(1)
	exit()
if len(div) == 1:
	while n % div[0] == 0:
		n //= div[0]
	if n != 1:
		print(1)
		exit()
print(step)


from math import sqrt
n = int(input())
if n == 1:
	print(1)
else:
	d = [1]
	(i, p) = (2, n)
	while p > 1 and i * i <= p:
		if p % i == 0:
			d.append(i)
			while p % i == 0:
				p //= i
		i += 1
	if p > 1:
		d.append(p)
	if len(d) == 2:
		print(d[1])
	else:
		print(1)


import math
s = set()

def prime(n):
	while n % 2 == 0:
		s.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(int(i))
			n = n / i
	if n > 2:
		s.add(int(n))
n = int(input())
if n == 1:
	print('1')
	exit()
prime(n)
l = sorted(s)
if len(l) == 1:
	print(l[0])
else:
	print('1')


def LOL(a1, b1):
	a = int(a1)
	b = int(b1)
	while a != 0 and b != 0:
		if b > a:
			(a, b) = (b, a)
		a = a % b
	if b > a:
		(a, b) = (b, a)
	return a
a = int(input())
if a == 1:
	print(1)
else:
	A = []
	i = 2
	while a >= i ** 2:
		if a % i == 0:
			A.append(i)
			a = a // i
		while a % i == 0:
			a = a // i
		i += 1
	if a != 1:
		A.append(a)
	k = A[0]
	for i in range(1, len(A)):
		k = LOL(A[i], k)
	print(k)


def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
if isPrime(n) or n == 1:
	print(n)
else:
	p = 2
	x = True
	while x:
		if n % p == 0:
			x = False
		else:
			p += 1
	q = 0
	while n > 1:
		if n % p != 0:
			q = n
			break
		n = int(n / p)
	if q != 0:
		print(1)
	else:
		print(p)


from math import *
n = int(input())
ka = n
for i in range(2, int(sqrt(n)) + 1):
	if n % i == 0:
		ka = gcd(ka, i)
		ka = gcd(n // i, ka)
print(ka)


from math import ceil
from cmath import sqrt

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

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

def linput():
	return list(minput())
n = inp()
m = n
sn = ceil(sqrt(n).real)
if n % 2 == 0:
	m = 2
for i in range(3, sn + 1, 2):
	if n % i == 0:
		if m == 2:
			print(1)
			exit()
		z = i
		while z < n:
			z *= i
		if z == n:
			print(i)
		else:
			print(1)
		exit()
if m == 2:
	print(2 if n // 2 % 2 != 1 or n == 2 else 1)
else:
	print(m)


import sys, os, io

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

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

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

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

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

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

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')

	def primeFactors(n):
		pf = []
		while n % 2 == 0:
			pf.append(2)
			n = n / 2
		for i in range(3, int(math.sqrt(n)) + 1, 2):
			while n % i == 0:
				pf.append(int(i))
				n = n / i
		if n > 2:
			pf.append(int(n))
		return pf
	for _ in range(1):
		n = ri()
		nf = 0
		c = 0
		z = primeFactors(n)
		nf = len(set(z))
		if len(z) != 1:
			if nf == 1:
				print(z[0])
			else:
				print(1)
		else:
			print(n)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

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

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

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

class FastWriter(io.IOBase):

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

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

class FastStdin(io.IOBase):

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

class FastStdout(io.IOBase):

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


n = int(input())
if n in [1, 2, 3]:
	print(n)
	exit()
divs = []
i = 2
while i * i <= n:
	if n % i == 0:
		divs.append(i)
		divs.append(n / i)
	i += 1
if len(divs) == 0:
	print(n)
	exit()
i = divs[0]
while n != 1 and n % i == 0:
	n /= i
if n == 1:
	print(i)
else:
	print(1)


import math
from sys import stdin

def factorize(x):
	i = 2
	y = x
	prime_factors = []
	while i * i <= x:
		if y % i == 0:
			prime_factors.append(i)
			while y % i == 0:
				y //= i
		i += 1
	if y > 1:
		prime_factors.append(y)
	return prime_factors

def main():
	n = int(input())
	prime_factors = factorize(n)
	if n == 1 or len(prime_factors) > 1:
		print(1)
	elif n > prime_factors[0]:
		print(prime_factors[0])
	else:
		print(n)

def __starting_point():
	main()
__starting_point()


import sys
import math
import collections
import heapq
input = sys.stdin.readline

def prime(n):
	c = 1
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			c = 0
			break
	return c
n = int(input())
if n % 2 == 0:
	if math.log(n, 2) == int(math.log(n, 2)):
		print(2)
	else:
		print(1)
elif n == 1:
	print(1)
else:
	c = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				c += 1
			else:
				c += 2
	if c == 0:
		print(n)
	elif c == 1:
		print(int(math.sqrt(n)))
	else:
		c1 = 0
		for i in range(2, int(math.sqrt(n)) + 1):
			if pow(i, round(math.log(n, i))) == n and prime(i):
				c1 = 1
				print(i)
				break
		if c1 == 0:
			print(1)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
from math import gcd
(n,) = I()
d = []
for i in range(2, int(n ** 0.5) + 1):
	if n % i:
		continue
	d.append(i)
	if i ** 2 != n:
		d.append(n // i)
if len(d) == 0:
	print(n)
else:
	g = 0
	for i in d:
		g = gcd(g, i)
	print(g)


import math
n = int(input())
(g, i) = (n, 2)
while i * i <= n:
	if n % i == 0:
		g = math.gcd(g, i)
		g = math.gcd(g, n // i)
	i += 1
print(g)


import math
n = int(input())
d = []
for i in range(2, n):
	if i * i > n:
		break
	if n % i == 0:
		if i * i != n:
			d += [i, n // i]
		else:
			d.append(i)
gc = n
for i in d:
	gc = math.gcd(gc, i)
print(n if d == [] else gc)


n = int(input())
counter = 0
p = 1
for i in range(2, round(n ** 0.5) + 1):
	if n % i == 0:
		p = 0
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		break
if p == 1:
	print(n)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
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 list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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 pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

class Prime:

	def __init__(self, n):
		self.M = m = int(math.sqrt(n)) + 10
		self.A = a = [True] * m
		a[0] = a[1] = False
		self.T = t = [2]
		for j in range(4, m, 2):
			a[j] = False
		for i in range(3, m, 2):
			if not a[i]:
				continue
			t.append(i)
			for j in range(i * i, m, i):
				a[j] = False
		self.ds_memo = {}
		self.ds_memo[1] = set([1])

	def is_prime(self, n):
		return self.A[n]

	def division(self, n):
		d = collections.defaultdict(int)
		for c in self.T:
			while n % c == 0:
				d[c] += 1
				n //= c
			if n < 2:
				break
		if n > 1:
			d[n] += 1
		return d.items()

def main():
	t = 1
	rr = []
	for _ in range(t):
		pr = Prime(10 ** 12)
		n = I()
		d = list(pr.division(n))
		if len(d) == 1:
			rr.append(d[0][0])
		else:
			rr.append(1)
	return JA(rr, '\n')
print(main())


import sys, math, queue, collections
MOD = 10 ** 9 + 7
n = int(input())
ans = n
i = 2
while i * i <= n:
	if n % i == 0:
		ans = math.gcd(ans, i)
		ans = math.gcd(ans, n // i)
	i += 1
print(ans)


from math import sqrt, gcd, inf
q = int(input())
w = []
s = sqrt(q)
for i in range(2, int(s) + 1):
	if q % i == 0:
		w.append(i)
test = []
for i in range(len(w) - (s == int(s))):
	test.append(q // w[i])
w += test
w.append(q)
l = inf
for i in range(len(w)):
	for j in range(i + 1, len(w)):
		l = min(l, gcd(w[i], w[j]))
print(min(l, q))


import sys

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

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

def mints():
	return map(int, minp().split())
n = mint()
for i in range(2, int(n ** 0.5) + 2):
	if n % i == 0 and i != n:
		break
if n % i == 0 and i != n:
	while n % i == 0:
		n //= i
	if n == 1:
		print(i)
	else:
		print(1)
else:
	print(n)


from sys import stdin

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

def intput():
	return int(input())

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

def intsput():
	return map(int, sinput())
n = intput()
for i in range(2, 1000001):
	if i * i > n:
		break
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
			exit()
		else:
			print(1)
			exit()
print(n)


n = int(input())
dividers = list()
i = 2
while i * i <= n:
	if n % i == 0:
		dividers.append(i)
		while n % i == 0:
			n /= i
	i += 1
if n > 1:
	dividers.append(n)
if len(dividers) == 1:
	print(dividers[0])
else:
	print(1)


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

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

def si():
	return input()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

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

def isprime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return 0
	return 1

def solve():
	n = ii()
	x = 1
	c = 0
	for i in range(2, int(sqrt(n)) + 1):
		f = 0
		while n % i == 0:
			x = i
			f = 1
			n //= i
		if f:
			c += 1
	if n > 1:
		x = n
		c += 1
	if c > 1:
		print(1)
	else:
		print(x)
solve()


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
(n,) = rl()
N = 1000000
for p in range(2, N):
	if n % p == 0:
		for k in range(1, 57):
			if p ** k == n:
				print(p)
				break
		else:
			print(1)
		break
else:
	print(n)


n = int(input())
p = int(pow(n, 0.5))
div = []
prime = 0
for i in range(2, p + 1):
	if n % i == 0:
		div.append(i)
		for j in range(2, int(pow(i, 0.5) + 1)):
			if i % j == 0:
				break
		else:
			prime += 1
		m = int(n / i)
		if m != i:
			for j in range(2, int(pow(m, 0.5)) + 1):
				if m % j == 0:
					break
			else:
				prime += 1
	if prime == 2:
		print(1)
		break
else:
	if div == []:
		print(n)
	else:
		print(min(div))


def main():
	from math import gcd, floor, sqrt
	n = int(input())
	if n == 1:
		print(1)
		exit(0)
	ans = [n]
	for i in range(2, floor(sqrt(n)) + 1):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	g = ans[0]
	for i in range(1, len(ans)):
		g = gcd(g, ans[i])
	print(g)
main()


if True:
	n = int(input())
	if n % 6 == 0:
		print(1)
	else:
		factors = []
		flag = 0
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				flag = 1
				factors.append(i)
				while n % i == 0:
					n = n // i
		if n != 1:
			factors.append(n)
		if flag == 0:
			print(n)
		elif len(factors) == 1:
			print(factors[0])
		else:
			print(1)


n = int(input())
prime = []
t_prime = -1
if n & 1 == 0:
	prime.append(2)
	tn = n >> 1
	while tn & 1 == 0:
		tn = tn >> 1
	if tn > 1:
		prime.append(tn)
i = 3
dn = 1
while i <= n ** 0.5:
	if n % i == 0:
		t_prime = i
		for p in prime:
			if t_prime % p == 0:
				t_prime = -1
				break
		if t_prime != -1:
			prime.append(t_prime)
			tn = n // t_prime
			while tn % t_prime == 0:
				tn = tn // t_prime
			if tn > 1:
				prime.append(tn)
			if len(prime) >= 2:
				print('1')
				dn = 0
				break
	i += 2
if dn and len(prime) >= 2:
	print('1')
	dn = 0
if dn:
	if len(prime) == 1:
		print(prime[0])
	else:
		print(n)


def task_3(k):
	result = k
	for i in range(2, int(k ** (1 / 2)) + 1):
		if k % i == 0:
			while k > 1:
				if k % i == 0:
					k = k // i
				else:
					result = 1
					break
			if k == 1:
				result = i
			break
	print(result)
k = int(input().rstrip())
task_3(k)


import sys
import math

def primeFactors(n):
	primes = set()
	while n % 2 == 0:
		primes.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			primes.add(i)
			if len(primes) == 2:
				print('1')
				exit(0)
			n = n / i
	if n > 2:
		primes.add(n)
	if len(primes) == 2:
		print('1')
		exit(0)
	if len(primes) == 1:
		print(str(primes.pop()))
		exit(0)
	if len(primes) == 0:
		print(str(n))
		exit(0)
in_num = int(sys.stdin.readline()[:-1])
if in_num == 1:
	print('1')
	exit(0)
primeFactors(in_num)


import sys
input = sys.stdin.readline
N = n = int(input())
primes = []
if not n & 1:
	primes.append(2)
	while not n & 1:
		n >>= 1
limit = int(n ** 0.5) + 1
f = 3
while f < limit and f <= n:
	if n % f == 0:
		primes.append(f)
		while n % f == 0:
			n //= f
	f += 2
if n > 1:
	primes.append(n)
if not primes:
	print(N)
elif len(primes) == 1:
	print(primes[0])
else:
	print(1)


import os, sys, math
n = int(input())
sqt = int(math.sqrt(n))

def IsPrime(n):
	for i in range(2, sqt + 1):
		if n % i == 0:
			return False
	return True
if IsPrime(n):
	print(n)
	return
found = 0
for i in range(2, sqt + 1):
	if n % i != 0:
		continue
	x = n / i
	while x % i == 0:
		x /= i
	if x == 1:
		print(i)
		return
	else:
		found += 1
		if found == 2:
			print(1)
			return
print(1)


import math

def prime_factors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l
n = int(input())
if n == 1:
	print(1)
else:
	l = prime_factors(n)
	l = list(set(l))
	l.sort()
	if l[-1] == n:
		print(n)
	elif len(l) == 1:
		print(l[0])
	else:
		print(1)


def criba_eratostenes(n):
	multiplos = set()
	for i in range(2, n + 1):
		if i not in multiplos:
			yield i
			multiplos.update(range(i * i, n + 1, i))
(n, s) = (int(input()), set())
p = int(n)
for i in criba_eratostenes(1000000):
	while not n % i:
		n /= i
		s.add(i)
if not len(s) and n == 1:
	print(1)
elif n != 1 and len(s):
	print(1)
elif len(s) > 1:
	print(1)
elif n != 1 or p == list(s)[0]:
	print(int(p))
else:
	print(list(s)[0])


def getPrimeFactorCounts(x):
	primeFactorCnts = []
	for i in range(2, int(x ** 0.5) + 1):
		cnt = 0
		while x % i == 0:
			cnt += 1
			x //= i
		if cnt > 0:
			primeFactorCnts.append((i, cnt))
	if x > 1:
		primeFactorCnts.append((x, 1))
	return primeFactorCnts

def main():
	n = int(input())
	pfc = getPrimeFactorCounts(n)
	if len(pfc) == 1:
		print(pfc[0][0])
	else:
		print(1)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import math
n = int(input())
if n == 1:
	print(1)
else:

	def isPrime(n):
		if n <= 3:
			return True
		if n % 2 == 0 or n % 3 == 0:
			return False
		i = 5
		while i * i <= n:
			if n % i == 0 or n % (i + 2) == 0:
				return False
			i = i + 6
		return True
	if isPrime(n):
		print(n)
	else:
		l = []
		for i in range(2, math.ceil(math.sqrt(n)) + 1):
			if n % i == 0:
				if n // i == i:
					l.append(i)
				else:
					l.append(n // i)
					l.append(i)
		f = 0
		for i in l:
			for j in l:
				if math.gcd(i, j) == 1:
					print(1)
					f = 1
					break
			if f:
				break
		if not f:
			for i in l:
				if isPrime(i):
					j = 1
					while i ** j <= n:
						j += 1
						if i ** j == n:
							print(i)
							f = 1
							break
					if f:
						break


import sys, math
input = sys.stdin.readline
from fractions import gcd
from functools import reduce

def qwqw(list):
	x = reduce(gcd, list)
	return x

def qw(n):
	if n == 1:
		return [1, 1]
	i = 1
	q = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				q.append(i)
			else:
				q.append(i)
				q.append(n // i)
		i = i + 1
	return q
for n in range(1):
	n = int(input())
	a = qw(n)
	a.sort()
	a.pop()
	a.pop(0)
	if len(a) == 0:
		a.append(n)
	print(qwqw(a))


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(test,) = Neo()
n = test
s = set()

def primeFactors(n):
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
primeFactors(n)
if len(s) == 1:
	t = s.pop()
	print(t)
else:
	print(1)


from math import ceil

def find_divisor(n):
	if n == 2:
		return []
	root = ceil(n ** 0.5)
	ans = []
	for i in range(2, root + 1):
		if n % i == 0:
			ans.extend([i, n / i])
	return list(set(ans))

def fans(n):
	div = find_divisor(n)
	if len(div) == 0:
		return n
	else:
		m = min(div)
		divs = True
		for x in div:
			divs = divs and x % m == 0
			if divs == False:
				break
		if divs:
			return min(div)
		else:
			return 1

def __starting_point():
	n = int(input())
	print(fans(n))
__starting_point()


import sys, atexit
from io import BytesIO
inp = BytesIO(sys.stdin.buffer.read())
input = lambda : inp.readline().decode('ascii')
buf = BytesIO()
atexit.register(lambda : sys.__stdout__.buffer.write(buf.getvalue()))
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
if n == 1:
	print(1)
	exit()
ans = 1
i = 2
while i * i <= n:
	if n % i == 0:
		while n % i == 0:
			n //= i
		if n == 1:
			print(i)
		else:
			print(1)
		break
	i += 1
else:
	print(n)


import math

def primeFactors(n):
	factors = set()
	while n % 2 == 0:
		factors.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.add(i)
			n = n / i
	if n > 2:
		factors.add(n)
	return factors

def main():
	n = int(input())
	if n == 1:
		print(1)
		return
	factors = primeFactors(n)
	if len(factors) > 1:
		print(1)
	else:
		print(factors.pop())
main()


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 = 10 ** 9 + 7
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()]

def divisors(n):
	factors = []
	if n < 0:
		factors.append(-1)
		n = abs(n)
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 1:
		factors.append(n)
	return sorted(set(factors))
n = Int()
div = divisors(n)
if len(div) == 1:
	print(div[0])
else:
	print(1)


from math import sqrt, gcd

def gen_primes():
	D = {}
	q = 2
	while True:
		if q not in D:
			yield q
			D[q * q] = [q]
		else:
			for p in D[q]:
				D.setdefault(p + q, []).append(p)
			del D[q]
		q += 1

def is_prime(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	return all((n % i for i in range(3, int(sqrt(n)) + 1)))

def calculate_colors(n):
	primes = gen_primes()
	sqr_n = int(sqrt(n)) + 1
	if n == 1:
		return 1
	for p in primes:
		if n % p == 0:
			while n % p == 0:
				g = gcd(p, n)
				n = int(n // g)
			if n > 1:
				return 1
			else:
				return p
		if p > sqr_n:
			return n
n = int(input())
print(calculate_colors(n))


from time import time
n = int(input())

def primes_sieve2(n):
	limit = 10 ** 6
	a = [True] * limit
	a[0] = a[1] = False
	for (i, isprime) in enumerate(a):
		if isprime:
			yield i
			for n in range(i * i, limit, i):
				a[n] = False
primes = primes_sieve2(n)
di = {}
for prime in primes:
	if prime == n:
		print(n)
		quit()
	if prime > n:
		break
	pc = prime
	di[pc] = prime
	while pc <= 10 ** 12:
		pc *= prime
		if pc not in di:
			di[pc] = prime
ans = n
di2 = {}
from collections import OrderedDict
if n in di:
	print(di[n])
else:
	for i in range(2, 10 ** 6 + 1):
		if n % i == 0:
			print(1)
			quit()
	print(n)


import sys
input = sys.stdin.readline
from math import ceil, sqrt, gcd
n = int(input())
yy = ceil(sqrt(n))
ans = []
t = 0
if n == 2:
	print(2)
	exit()
for i in range(2, yy + 1):
	if n % i == 0:
		ans.append(i)
		t += 1
		if n // i != i:
			ans.append(n // i)
			t += 1
if t == 0:
	print(n)
else:
	res = ans[0]
	for i in range(1, t):
		res = gcd(res, ans[i])
	print(res)


import sys
input = sys.stdin.readline
n = int(input())
u = 0
l = []
if n % 2 == 0:
	l.append(2)
while n % 2 == 0:
	n = n // 2
	u = 2
z = int(n ** 0.5)
for i in range(3, z + 1, 1):
	if n % i == 0:
		l.append(i)
		while n % i == 0:
			n = n // i
if n != 1:
	l.append(n)
if len(l) > 1:
	print(1)
elif len(l) > 0:
	print(l[0])
else:
	print(n)


import math, collections, sys
input = sys.stdin.readline

def primeFactors(a):
	p = set([])
	while a:
		if a % 2:
			break
		p.add(2)
		a //= 2
	for i in range(3, int(a ** 0.5) + 2, 2):
		while a:
			if a % i:
				break
			p.add(i)
			a //= i
	if a > 1:
		p.add(a)
	return p
n = int(input())
x = list(primeFactors(n))
if len(x) == 1:
	print(x[0])
else:
	print(1)


from math import sqrt, ceil

def prr(n):
	k = -1
	for i in range(2, int(ceil(sqrt(n))) + 1):
		if n % i == 0:
			k = i
			break
	assert k != -1
	while n > 1 and n % k == 0:
		n //= k
	if n > 1:
		return [False, -1]
	else:
		return [True, k]

def pr(n):
	for i in range(2, int(ceil(sqrt(n))) + 1):
		if n % i == 0:
			return False
	return True

def main():
	n = int(input())
	if n == 1:
		print(1)
		return
	if pr(n):
		print(n)
		return
	k = prr(n)
	if k[0]:
		print(k[1])
		return
	print(1)
	return
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
divs = set()
for i in range(2, 1 + int(n ** 0.5)):
	if n % i == 0:
		divs.add(i)
		divs.add(n // i)
divs = sorted(list(divs))
if len(divs) == 0:
	print(n)
elif len(divs) == 1:
	print(int(n ** 0.5))
else:
	par = divs[0]
	ok = True
	for i in divs:
		if i % par:
			ok = False
			break
	if ok:
		print(par)
	else:
		print(1)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

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

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def primeF(n):
	A = set()
	while n % 2 == 0:
		A.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			A.add(i)
			n = n // i
	if n > 2:
		A.add(n)
	return list(A)

def solve():
	(n,) = aj()
	if n <= 2:
		print(n)
	else:
		A = primeF(n)
		if A[0] == n:
			print(n)
		elif len(A) > 1:
			print(1)
		else:
			print(A[0])
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


n = int(input())
if n == 1:
	print(1)
	exit()
s = set()
xx = n
ans = []
for i in range(2, int(n ** 0.5) + 1):
	if xx % i == 0:
		ans.append(i)
		s.add(i)
		while xx % i == 0:
			xx = xx // i
if xx > 1:
	ans.append(xx)
	s.add(xx)
if len(s) > 1:
	print(1)
else:
	print(ans[0])


import sys
input = sys.stdin.readline
N = int(input())
i = 2
x = N + 0
s = set()
while i * i <= N:
	while x % i == 0:
		x //= i
		s.add(i)
	i += 1
if x > 1 and x != N:
	s.add(x)
if len(s) == 0:
	print(N)
elif len(s) == 1:
	print(s.pop())
else:
	print(1)


import sys, math
input = sys.stdin.readline

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

def getInt():
	return int(input())

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

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

def listStr():
	return list(input().strip())
import collections as col
import math

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

def solve():
	N = getInt()
	if N > 1:
		F = prime_factors(N)
		if len(F) == 1:
			return F[0][0]
	return 1
print(solve())


from math import gcd
from math import sqrt
n = int(input())
t = int(sqrt(n)) + 1
k = n
for i in range(2, t):
	if not n % i:
		k = gcd(k, i)
		k = gcd(k, n // i)
print(k)


n = int(input())
x = n
while x % 2 == 0:
	x //= 2
if n == 1:
	print(1)
	exit(0)
if x == 1:
	print(2)
	exit(0)
if x != n:
	print(1)
	exit(0)
x = n
for i in range(3, 10 ** 6, 2):
	if x % i == 0:
		while x % i == 0:
			x //= i
		if x != 1:
			print(1)
			exit(0)
		print(i)
		exit(0)
print(n)


import math
n = int(input())

def primefactorisation(n):
	P = []
	while n % 2 == 0:
		P.append(2)
		n //= 2
	i = 3
	while i <= int(math.sqrt(n)):
		while n % i == 0:
			P.append(i)
			n //= i
		i += 2
	if n > 2:
		P.append(n)
	return P
A = primefactorisation(n)
result = 0
for i in range(len(A)):
	result = math.gcd(result, A[i])
	if result == 1:
		break
if n == 1:
	print(1)
else:
	print(result)


import math

def findFirstDelimeter(n):
	value = 1
	for i in range(int(math.sqrt(n)))[1::1]:
		if n % (i + 1) == 0:
			if value == 1:
				value = i + 1
				while n % value == 0:
					n /= value
			if n != 1:
				return 1
			else:
				return value
	return n
n = int(input())
print(findFirstDelimeter(n))


import math
n = int(input())
ans = 0
i = 2
A = []
while i * i <= n:
	if n % i == 0:
		ii = n // i
		A.append(i)
		A.append(ii)
	i += 1
if not A:
	print(n)
else:
	for j in A:
		ans = math.gcd(j, ans)
	print(ans)


n = int(input())
m = n
d = 2
a = []
ans = 1
while d * d <= n:
	if n % d == 0:
		if d not in a:
			a += [d]
		n //= d
	elif d >= 3:
		d += 2
	else:
		d += 1
if n > 1 and n not in a:
	a += [n]
if len(a) > 1:
	ans = 1
elif len(a) == 0:
	ans = 1
else:
	ans = a[0]
print(ans)


from math import gcd, floor, sqrt, log
inp = lambda : int(input())
seq = lambda : list(map(int, input().strip().split()))

def isprime(n):
	if n == 1:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def results(t):
	cnt = t
	if t == 1:
		return 1
	for i in range(2, int(sqrt(t)) + 1):
		if t % i == 0:
			cnt = i
			break
	while t % cnt == 0:
		t //= cnt
	if t > 1:
		return 1
	return cnt

def main():
	t = inp()
	result = results(t)
	print(result)
main()


n = int(input())
v = 0
for i in range(2, int(n ** 0.5 + 1)):
	if n % i:
		continue
	v = 1
	t = n
	while t > 1 and t % i == 0:
		t //= i
	if t == 1:
		print(i)
		exit()
	else:
		break
print(1 if v else n)


import math

def main():
	n = int(input())
	g = 0
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			if i > 1:
				g = math.gcd(max(g, i), min(g, i))
			g = math.gcd(max(g, n // i), min(g, n // i))
	print(g)
main()


from math import sqrt, gcd
n = int(input())
gc = n
for i in range(2, int(sqrt(n)) + 1):
	if n % i == 0:
		i2 = n // i
		if i == i2:
			gc = gcd(gc, i)
		else:
			gc = gcd(gc, i)
			gc = gcd(gc, i2)
print(gc)


from math import sqrt

def isPrime(x: int) -> bool:
	m = int(sqrt(x))
	for i in range(2, m + 1):
		if x % i == 0:
			return False
	return True
n = int(input())
if isPrime(n):
	print(n)
	exit(0)
div = []
i = 2
while i * i <= n:
	if n % i == 0:
		div.append(i)
	while n % i == 0:
		n //= i
	i += 1
if n > 1:
	div.append(n)
if len(div) == 1:
	print(div[0])
else:
	print(1)


n = int(input())
N = n
div = []
for d in range(2, min(1000001, n + 1)):
	if n % d == 0:
		div.append(d)
		while n % d == 0:
			n //= d
if n > 1:
	div.append(n)
if len(div) == 1:
	print(div[0])
else:
	print(1)


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

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

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

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

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

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
ts = time.time()
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
show_flg = False
show_flg = True
n = I()

def primeFactor(N):
	(i, n) = (2, N)
	ret = {}
	(d, sq) = (2, 99)
	while i <= sq:
		k = 0
		while n % i == 0:
			(n, k, ret[i]) = (n // i, k + 1, k + 1)
		if k > 0 or i == 97:
			sq = int(n ** (1 / 2) + 0.5)
		if i < 4:
			i = i * 2 - 1
		else:
			(i, d) = (i + d, d ^ 6)
	if n > 1:
		ret[n] = 1
	return ret
p = primeFactor(n)
if len(p) == 1:
	print(list(p.items())[0][0])
else:
	print(1)


import math

def p(x):
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			return i
	else:
		return x

def r(x):
	if round(x) - x < 0.5:
		return round(x)
	else:
		return round(x) - 1
n = int(input())
if n == 1:
	print(1)
else:
	m = p(n)
	d = math.log(n, m)
	if m ** r(d) == n:
		print(m)
	else:
		print(1)


from math import *
n = int(input())
flag1 = False
for i in range(2, int(sqrt(n) + 1)):
	if n % i == 0:
		fact = i
		flag1 = True
		break
if flag1 == False:
	print(n)
else:
	flag = False
	val = fact
	for i in range(42):
		if val == n:
			flag = True
		elif val <= 10 ** 12:
			val = val * fact
	if flag == True:
		print(fact)
	else:
		print(1)


from math import sqrt
n = int(input())
divisors = []
while n % 10 == 0 and int(n / 10) > 10:
	n = int(n / 10)
for i in range(2, round(sqrt(n)) + 1):
	if n % i == 0:
		divisors.append(i)
		divisors.append(n / i)
divisors.sort()
if len(divisors) == 0:
	print(n)
else:
	gcd = 1
	for i in range(2, min(divisors) + 1):
		for j in divisors:
			if j % i != 0:
				break
			if j == max(divisors):
				gcd = i
	print(gcd)


from math import *

def is_prime(n):
	if n == 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	if n < 9:
		return True
	else:
		f = 5
		r = ceil(sqrt(n))
		while f <= r:
			if n % f == 0:
				return False
			if n % (f + 2) == 0:
				return False
			f += 6
		return True

def factors(n):
	x = set()
	while n % 2 == 0:
		x.add(2)
		n = n / 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			x.add(i)
			n = n / i
	if n > 2:
		x.add(n)
	return list(x)
n = int(input())
if n & 1 == 0:
	if log2(n) == int(log2(n)):
		print(2)
	else:
		print(1)
elif n == 1:
	print(n)
elif is_prime(n):
	print(n)
else:
	tmp = factors(n)
	if len(tmp) > 1:
		print(1)
	else:
		print(tmp[0])


import sys, math

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

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

def main():
	N = int(input())
	P = [1]
	for k in range(2, math.floor(math.sqrt(N)) + 1):
		if N % k == 0:
			P.append(k)
			P.append(N // k)
	P = set(P)
	P = sorted(list(P))
	if len(P) == 1:
		print(N)
	else:
		ans = P[1]
		for k in range(1, len(P)):
			ans = gcd(ans, P[k])
		print(ans)
main()


import math

def primeFactors(n):
	x = []
	while n % 2 == 0:
		n = n // 2
		x.append(2)
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n // i
			x.append(i)
	if n > 2:
		x.append(n)
	return list(set(list(x)))
n = int(input())
z = primeFactors(n)
if len(z) == 1:
	print(z[0])
else:
	print(1)


from math import gcd, sqrt, ceil, floor
n = int(input())
s = set()
s.add(n)
for i in range(2, floor(sqrt(n)) + 1):
	if n % i == 0:
		s.add(i)
		s.add(n // i)
ans = 0
for i in s:
	ans = gcd(ans, i)
print(ans)


n = int(input())

def isPrime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			v = [i, False]
			return v
	v = [1, True]
	return v
s = isPrime(n)
if s[1] or n == 1:
	print(n)
else:
	k = n
	i = 2
	ok = True
	while i * i <= k and ok:
		if k % i == 0:
			while k % i == 0:
				k = k / i
			ok = False
		i = i + 1
	if k == 1:
		print(s[0])
	else:
		print(1)


import math

def primeFactors(n):
	pfs = set()
	while n % 2 == 0:
		pfs.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			pfs.add(i)
			n = n // i
	if n > 2:
		pfs.add(n)
	return pfs
n = int(input())
if n == 1:
	print(1)
	quit()
pfs = primeFactors(n)
if len(pfs) >= 2:
	print(1)
elif len(pfs) == 1:
	print(list(pfs)[0])


def main():
	global visited, adj, sets
	n = get_int()
	factors = prime_factors(n)
	if len(factors) > 1 or len(factors) == 0:
		print(1)
	else:
		print(list(factors.keys())[0])
import sys
import math

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()
print(*out, sep='\n')


import math

def factorize(n):
	count = 0
	v = []
	while (n % 2 > 0) == False:
		n >>= 1
		count += 1
	if count > 0:
		v.append((2, count))
	for i in range(3, int(math.sqrt(n)) + 1):
		count = 0
		while n % i == 0:
			count += 1
			n = int(n / i)
		if count > 0:
			v.append((i, count))
		i += 2
	if n > 2:
		v.append((n, 1))
	return v
n = int(input())
v = factorize(n)
k = len(v)
if k == 1 and v[0][0] > 1:
	print(int(v[0][0]))
elif k >= 2:
	print(1)
else:
	print(n)


n = 1000005
primes = []
sieve = [1] * n
for i in range(2, n):
	if sieve[i]:
		primes.append(i)
		for j in range(i * i, n, i):
			sieve[j] = 0
n = int(input())
if n != 1 and n not in primes:
	for p in primes:
		if n % p == 0:
			while n % p == 0:
				n //= p
			if n == 1:
				print(p)
			else:
				print(1)
			exit()
print(n)


from sys import stdin, stdout, exit
for i in stdin:
	n = int(i)
	break

def prime_factors(n):
	i = 2
	while i * i <= n:
		if n % i:
			i += 1
		else:
			return i
	return n
factor = prime_factors(n)
if factor == n:
	stdout.write(str(n) + '\n')
	exit(0)
else:
	while 1:
		if n == 1:
			break
		elif n % factor == 0:
			n = n // factor
		elif n % factor != 0:
			stdout.write('1\n')
			exit(0)
stdout.write(str(factor) + '\n')


g = int(input())
b = g
delare = []
counter = 3
for i in range(round(g ** 0.5) + 1):
	if b % 2 == 0:
		if 2 not in delare:
			delare.append(2)
			if len(delare) == 2:
				break
		b /= 2
	elif b % counter == 0:
		if counter not in delare:
			delare.append(counter)
			if len(delare) == 2:
				break
		b /= counter
	else:
		counter += 2
if b != 1 and b != g:
	delare.append(b)
if len(delare) > 1:
	print(1)
elif len(delare) == 1:
	print(delare[0])
else:
	print(g)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd

def prime(t):
	for i in range(2, int(sqrt(t)) + 1):
		if n % i == 0:
			return 0
	return 1
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif prime(n):
	print(n)
else:
	l = []
	a = 2
	while a <= sqrt(n) and n > 1:
		if n % a == 0:
			l.append(a)
			n = n // a
		else:
			a += 1
	if n != 1:
		l.append(n)
	if len(set(l)) == 1:
		print(l[0])
	else:
		print(1)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
divisors = []
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		divisors.append(i)
		divisors.append(int(n / i))
if len(divisors) == 0:
	print(n)
elif len(divisors) == 1:
	print(divisors[0])
else:
	g = divisors[0]
	for i in range(len(divisors)):
		g = gcd(g, divisors[i])
	print(g)


from collections import Counter
import sys
import math
from functools import reduce

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

def li():
	return [int(i) for i in input().rstrip('\n').split(' ')]

def st():
	return input().rstrip('\n')

def val():
	return int(input())
n = sorted(factors(val()))[1:]
if not len(n):
	print(1)
	exit()
x = n[0]
for i in range(1, len(n)):
	x = math.gcd(x, n[i])
print(x)


import math
N = int(input())
n = N
KK = []
for i in range(2, int(math.sqrt(n) + 1)):
	if n % i == 0:
		if n // i == i:
			KK.append(int(i))
		else:
			KK.append(int(i))
			KK.append(int(n // i))
KK.sort()
KK = KK[::-1]
if len(KK) == 0:
	ans = N
else:
	ans = KK[0]
	for i in range(1, len(KK)):
		ans = math.gcd(ans, KK[i])
print(ans)


from math import sqrt, ceil, gcd

def find_gcd(n, a, i):
	if i >= len(a) or n == 1:
		return n
	return find_gcd(gcd(n, a[i]), a, i + 1)
n = int(input().strip())
ans = []
for i in range(2, ceil(sqrt(n)) + 1):
	if n % i == 0:
		ans.append(i)
		result = n // i
		if result > 1:
			ans.append(result)
if n == 1:
	print(1)
elif ans == []:
	print(n)
else:
	print(find_gcd(ans[0], ans, 1))


from math import ceil
n = int(input())
if n == 1:
	print(1)
else:
	l = set()
	i = 2
	y = n
	tmp = ceil(n ** 0.5) + 1
	while n != 1 and i < tmp:
		if n % i == 0:
			l.add(i)
		while n % i == 0:
			n //= i
		i += 1
	if n == y:
		print(n)
	else:
		if n != 1:
			l.add(n)
		l = list(sorted(list(l)))
		if len(l) != 1:
			print(1)
		else:
			print(l[0])


numero = int(input())
lista = []
if numero == 1:
	print(1)
	exit()
for i in range(2, int(numero ** 0.5) + 1):
	contador = 0
	while numero % i == 0:
		contador += 1
		numero /= i
	if contador > 0:
		lista.append([i, contador])
if numero > 1:
	lista.append([numero, 1])
if len(lista) > 1:
	print(1)
else:
	print(lista[0][0])


import math

def ispowof(n, b):
	while n > 1:
		r = n % b
		if r != 0:
			return False
		n /= b
	return True

def solve(n):
	if n % 2 == 0:
		return 1 if not ispowof(n, 2) else 2
	pmax = int(math.sqrt(n)) + 1
	slots = [True] * pmax
	for i in range(3, pmax + 1):
		if i % 2 == 1 and slots[i - 1]:
			if n % i == 0:
				return 1 if not ispowof(n, i) else i
			for j in range(i, pmax + 1, i):
				slots[j - 1] = False
	return n
n = int(input())
print(solve(n))


import math
n = int(input())
c = 0
temp = n
for i in range(2, int(math.sqrt(n)) + 5):
	if n % i == 0:
		c += 1
		p = i
		while n % i == 0:
			n //= i
if n > 1:
	c += 1
if c > 1:
	print(1)
elif temp == n:
	print(temp)
else:
	print(p)


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

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

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

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import sqrt, ceil

def main():
	n = N()
	up = ceil(sqrt(n))
	for i in range(2, up + 1):
		if n % i == 0:
			while n % i == 0:
				n //= i
			if n != 1:
				print(1)
			else:
				print(i)
			break
	else:
		print(n)
main()


n = int(input())
nn = n
i = 2
dziel = []
while True:
	if n % i == 0:
		n //= i
		dziel.append(i)
	else:
		i += 1
	if i ** 2 > nn:
		if n > 1:
			dziel.append(n)
		break
if len(dziel) == 1:
	print(nn)
else:
	a = set(dziel)
	if len(a) == 1:
		print(dziel[0])
	else:
		print(1)


import math

def primeFactors(n):
	while n % 2 == 0:
		arr.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			arr.add(i)
			n = n / i
	if n > 2:
		arr.add(n)
n = int(input())
arr = set()
primeFactors(n)
l = len(arr)
if l == 0:
	print(n)
elif l == 1:
	for i in arr:
		print(i)
else:
	print('1')


n = int(input())
i = 2
g = []
from math import gcd
while i * i <= n:
	if n % i == 0:
		g.append(i)
		g.append(n // i)
	i += 1
from functools import reduce
if len(g) == 0:
	print(n)
	exit(0)
gg = reduce(gcd, g)
print(gg)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

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

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

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

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

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

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

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 ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	div = []
	if n == 1:
		print(1)
		return
	for i in range(1, floor(n ** 0.5) + 1):
		if n % i == 0:
			if i != 1:
				div.append(i)
			if n // i != i:
				div.append(n // i)
	if len(div) == 1:
		print(n)
		return
	div = sorted(div)
	g = div[0]
	for i in range(1, len(div)):
		g = gcd(g, div[i])
	print(g)
testcase(1)


import sys
import math

def primeFactors(n):
	x = []
	if n % 2 == 0:
		x.append(2)
	while n % 2 == 0:
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			x.append(i)
		while n % i == 0:
			n = n // i
	if n > 2:
		x.append(n)
	return x
t = 1
for i in range(t):
	n = int(sys.stdin.readline())
	x = primeFactors(n)
	if len(x) == 1:
		print(x[0])
	else:
		print(1)


import math
n = int(input())
a = []
top = 0
for i in range(2, int(math.sqrt(n) + 1)):
	if n % i == 0:
		a.append(i)
		top += 1
		while n % i == 0:
			n //= i
if n != 1:
	a.append(n)
	top += 1
a.sort()
if top == 1:
	print(a[0])
elif top == 0:
	print(n)
else:
	print(1)


import sys
input = sys.stdin.readline
import math

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

def main():
	N = int(input())
	if N == 1:
		print(1)
		exit()
	x = make_divisors(N)
	if len(x) == 2:
		print(N)
	elif len(x) == 3:
		print(x[1])
	else:
		mi = float('inf')
		for i in range(1, len(x) - 2):
			mi = min(mi, math.gcd(x[i], x[i + 1]))
			if mi == 1:
				break
		print(mi)
main()


import sys

def main():
	n = sys.stdin.readline()
	return int(n)

def gcd(a, b):
	if a > b:
		r = a % b
		if r == 0:
			return b
		a = r
		return gcd(max(a, b), min(a, b))
	else:
		r = b % a
		if r == 0:
			return a
		b = r
		return gcd(max(a, b), min(a, b))

def solve(n):
	run = None
	cap = int(n ** 0.5)
	for x in range(2, cap + 1):
		if n % x == 0:
			if run == None:
				run = x
			comp = int(n / x)
			run = gcd(max(run, x), min(run, x))
			run = gcd(max(run, comp), min(run, comp))
	if run is None:
		return n
	return run
res = solve(main())
sys.stdout.write(str(res) + '\n')


n = int(input())
ans = n
if n == 1:
	print(1)
	exit()
facts = []
while n % 2 == 0:
	facts.append(2)
	n = n // 2
for i in range(3, int(n ** 0.5) + 1, 2):
	while n % i == 0:
		n = n // i
		facts.append(i)
if n != 1:
	facts.append(n)
if facts[-1] == ans:
	print(ans)
elif len(set(facts)) == 1:
	print(facts[0])
else:
	print(1)


n = int(input())
ara = []
i = 2
while i ** 2 <= n:
	if n % i == 0:
		ara.append(i)
	while n % i == 0:
		n /= i
	i += 1
if len(ara) == 0 or n > 1:
	ara.append(n)
if len(ara) > 1:
	print(1)
else:
	print(ara[0])


a = int(input())
import math

def fact(x):
	ans = []
	for i in range(1, int(math.sqrt(x)) + 1):
		if x % i == 0:
			if x // i == i:
				ans.append(i)
			else:
				ans.append(x // i)
				ans.append(i)
	return ans
ans = fact(a)
ans.sort()
if a == 1:
	print(1)
	exit()
x = ans[1]
tot = 1
while tot < a:
	tot = tot * x
if tot == a:
	print(ans[1])
else:
	print(1)


n = int(input())
if n == 1:
	color = 1
else:
	d = []
	p = 2
	while p <= n ** (1 / 2):
		if n % p == 0:
			d.append(p)
			break
		p += 1
	if len(d) == 0:
		color = n
	else:
		i = 1
		color = 1
		while d[0] ** i <= n:
			if d[0] ** i == n:
				color = d[0]
				break
			i += 1
print(color)


import math

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

def printDivisors(n):
	i = 1
	curr_gcd = n
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				if i != 1:
					curr_gcd = gcd(curr_gcd, i)
			else:
				if i != 1:
					curr_gcd = gcd(curr_gcd, i)
				if n / i != 1:
					curr_gcd = gcd(curr_gcd, int(n / i))
		i = i + 1
	return curr_gcd
n = int(input())
if n == 1:
	print(1)
else:
	print(printDivisors(n))


def prime_factor(n):
	ass = []
	for i in range(2, int(n ** 0.5) + 1):
		while n % i == 0:
			ass.append(i)
			n = n // i
	if n != 1:
		ass.append(n)
	return ass
n = int(input())
p = list(set(prime_factor(n)))
if len(p) == 1:
	print(p[0])
else:
	print(1)


n = int(input())
test = 2
out = 1
while test * test <= n:
	p = 0
	while n % test == 0:
		n //= test
		p += 1
	if p >= 1:
		out = test
		break
	test += 1
if out == 1 and n > 1:
	print(n)
elif out > 1 and n == 1:
	print(out)
else:
	print(1)


from math import sqrt
n = int(input())
devi = set()
i = 2
S = sqrt(n) + 1
while i <= S and i <= n:
	if n % i == 0:
		devi.add(i)
		if n // i != 1 and n // i % i != 0:
			devi.add(n // i)
		n //= i
	else:
		i += 1
if len(devi) == 0:
	print(n)
elif len(devi) == 1:
	print(*devi)
else:
	print(1)


import math
n = int(input())
r = n
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		while n > 1:
			if n % i == 0:
				n //= i
			else:
				r = 1
				break
		if n == 1:
			r = i
		break
print(r)


n = int(input())
k = int(n ** 0.5) + 1
c = True
for i in range(2, k):
	if n % i == 0:
		c = False
		break
if c:
	print(n)
else:
	c = True
	while n > 1:
		if n % i != 0:
			print(1)
			c = False
			break
		else:
			n /= i
	if c:
		print(i)


import math
import sys
from collections import defaultdict, Counter
from functools import lru_cache
t = 1
for _ in range(t):
	n = int(input())
	lis = []
	num = int(math.sqrt(n)) + 1
	for i in range(2, num):
		if n % i == 0:
			t1 = n // i
			if i != t1:
				lis.append(i)
				lis.append(t1)
			else:
				lis.append(t1)
	if len(lis) == 0:
		print(n)
	elif n % 2 == 0:
		flag = 0
		for i in lis:
			if i % 2 != 0:
				flag = 1
				break
		if flag == 0:
			print(2)
		else:
			print(1)
	elif len(lis) == 1:
		print(n // lis[0])
	else:
		gcd = lis[0]
		for i in range(1, len(lis)):
			gcd = math.gcd(gcd, lis[i])
		if gcd == 1:
			print(1)
		else:
			print(lis[0])


import math
from functools import reduce

def primes(n):
	s = range(3, n + 1, 2)
	r = set(s)
	[r.difference_update(range(n << 1, s[-1] + 1, n)) for n in s if n in r]
	return sorted(r.union([2]))

def solve(n):
	t = n
	p = []
	for v in primes(int(n ** 0.5 + 1)):
		if t == 1:
			break
		cnt = 0
		while t % v == 0:
			cnt += 1
			t /= v
		if v ** cnt == n:
			return v
		elif cnt:
			p.append(v ** cnt)
	for v in p.copy():
		p.append(math.gcd(v, n // v))
	if not p:
		return n
	else:
		return reduce(lambda x, y: math.gcd(x, y), p[::-1])
print(solve(int(input())))


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
r = 0
p = -1
if isPrime(n) or n == 1:
	print(n)
	exit()
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		p = i
		break
while n % p == 0:
	n = n // p
if n == 1:
	print(p)
else:
	print(1)


import math

def factorize(n):
	g = []
	for i in range(2, int(math.sqrt(n)) + 2):
		if n % i == 0:
			while n % i == 0:
				n //= i
			g.append(i)
	if n > 1:
		g.append(n)
	if len(g) == 1:
		return g[0]
	else:
		return 1
k = int(input())
if k < 2:
	print(k)
else:
	n = factorize(k)
	print(n)


import math
p = int(input())
x = p
for i in range(2, int(p ** 0.5) + 1):
	if p % i == 0:
		x = math.gcd(x, i)
		x = math.gcd(x, int(p / i))
print(x)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
ans = n
for i in range(2, int(n ** 0.5) + 1):
	while n % i == 0:
		n //= i
		div = i
	if ans != n:
		if n == 1:
			ans = div
		else:
			ans = 1
		break
print(ans)


n = int(input())
some_pow = False
prime = True
d = 2
while d * d <= n:
	if n % d == 0:
		tst = n
		while tst % d == 0 and tst > 1:
			tst //= d
		if tst == 1:
			some_pow = True
		prime = False
		break
	d += 1
if prime:
	print(n)
elif some_pow:
	print(d)
else:
	print(1)


import math

def prime(m):
	k = 0
	for i in range(2, int(math.sqrt(m)) + 1):
		if m % i == 0:
			k = i
			break
	return k
n = int(input())
t = prime(n)
if t == 0:
	print(n)
elif n % 2 == 0:
	while n % t == 0:
		n = n // t
	if n == 1:
		print(2)
	else:
		print(1)
elif n % 2 != 0:
	while n % t == 0:
		n = n // t
	if n == 1:
		print(t)
	else:
		print(1)


from math import log

def bin_search(a):
	L = 0
	R = a
	ans = 0
	while L <= R:
		med = L + (R - L) // 2
		if med ** 2 <= a:
			ans = med
			L = med + 1
		else:
			R = med - 1
	return ans
n = int(input())
sqrt = bin_search(n)
for i in range(2, sqrt + 1):
	if n % i == 0:
		while n > 1:
			if n % i != 0:
				print(1)
				exit()
			n //= i
		print(i)
		exit()
print(n)


import math
from collections import *

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

def check(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def cal(n):
	i = 2
	m = n
	while i * i <= n:
		if n % i == 0:
			arr.add(i)
			while n % i == 0:
				n //= i
		i += 1
	if n != 1 and n != m:
		arr.add(n)
n = int(input())
arr = set([])
if n % 2 == 0:
	if n & n - 1 == 0:
		print(2)
	else:
		print(1)
else:
	cal(n)
	arr = list(arr)
	if check(n):
		print(n)
	elif len(arr) == 1:
		print(arr[0])
	else:
		print(1)


n = int(input())
ism2 = False
if n % 2 == 0:
	ism2 = True
	while n % 2 == 0:
		n = n // 2
if ism2 and n != 1:
	print('1')
	exit(0)
elif ism2 and n == 1:
	print('2')
	exit(0)
ndiv = n
for div in range(3, int((n + 1) ** 0.5) + 1, 2):
	if n % div == 0:
		ndiv = div
		while n % div == 0:
			n = n // div
		if n != 1:
			ndiv = 1
		break
print(ndiv)


import math

def primeFactors(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n //= i
	if n > 2:
		a.append(n)
	return sorted(list(set(a)))
n = int(input())
if n == 1:
	print(n)
else:
	pfs = primeFactors(n)
	if len(pfs) == 1:
		print(pfs[0])
	else:
		print(1)


import math
n = int(input())
sqrt = math.floor(math.sqrt(n))
n_divisors = 0
lowest_two_divisors = []
for i in range(2, sqrt + 1):
	if n % i == 0:
		n_divisors += 1
		lowest_two_divisors.append(i)
		lowest_two_divisors.append(n // i)
if n_divisors == 0:
	print(n)
else:
	start = lowest_two_divisors[0]
	superd = -1
	for i in range(1, len(lowest_two_divisors)):
		if lowest_two_divisors[i] % start != 0:
			superd = lowest_two_divisors[i]
	if superd == -1:
		print(start)
	else:
		print(1)


import sys
import math
input = sys.stdin.readline
N = int(input())
k = N
ans = set()
while True:
	if k == 1:
		break
	q = k
	for i in range(2, int(math.sqrt(k)) + 2):
		if k % i == 0:
			ans.add(i)
			k //= i
			break
	if k == q:
		ans.add(k)
		break
if N == 1:
	print(1)
elif len(ans) == 1:
	print(*ans)
else:
	print(1)


import math
n = int(input())
if n == 1:
	print(1)
	exit(0)

def prime_factors(n):
	factors = set()
	d = 2
	while d * d <= n:
		while n % d == 0:
			factors.add(d)
			n //= d
		d += 1
	if n > 1:
		factors.add(n)
	return factors
factors = prime_factors(n)
if len(factors) > 1:
	print(1)
else:
	print(factors.pop())


while True:
	try:
		n = int(input())
		(num, i) = ([], 2)
		if n == 1:
			print('1')
			continue
		while i * i <= n:
			if n % i == 0:
				num.append(i)
				while n % i == 0:
					n /= i
			i += 1
		if n > 1:
			num.append(n)
		if len(num) > 1:
			print(1)
		else:
			print(num[0])
	except EOFError:
		break


from math import *
n = int(input())
bon = True
for p in range(2, int(sqrt(n)) + 1):
	if n % p == 0:
		bon = False
		while n % p == 0:
			n //= p
		if n == 1:
			print(p)
		else:
			print(1)
		break
if bon:
	print(n)


import sys
from fractions import gcd
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

def divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	divisors.sort()
	return divisors
n = int(input())
if n == 1:
	print(1)
	exit()
div = divisors(n)
ans = div[1]
for item in div[1:]:
	ans = gcd(ans, item)
print(ans)


import math
n = int(input())
p = n
cnt = 0
x = int(math.sqrt(n))
for i in range(2, x + 1):
	if n % i == 0:
		cnt += 1
		p = i
		while n % i == 0:
			n /= i
if n != 1:
	cnt += 1
	p = n
if cnt > 1:
	print(1)
else:
	print(p)


import math
x = int(input())
y = x
if x == 1:
	print(1)
	exit()
lol = []
for i in range(2, int(math.sqrt(x)) + 1):
	if x % i == 0:
		while x % i == 0:
			x //= i
		lol.append(i)
if x >= 2:
	lol.append(x)
if len(lol) == 1:
	print(lol[0])
else:
	print(1)


import os, sys, math
import collections
if os.path.exists('testing'):
	name = os.path.basename(__file__)
	if name.endswith('.py'):
		name = name[:-3]
	src = open(name + '.in.txt', encoding='utf8')
	input = src.readline
num = int(input().strip())

def solve():
	global num
	max_num = max(10, int(num ** 0.5) + 1)
	used = [False] * (max_num + 1)
	found = None
	for x in range(2, len(used)):
		if not used[x]:
			if num % x == 0:
				while num > 1 and num % x == 0:
					num = num // x
				if num == 1:
					return x
				return 1
			for y in range(x, len(used), x):
				used[y] = True
	return num
T = solve()
print(T)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = input()
n = int(n)
i = 2
ans = n
while i * i <= n:
	if n % i == 0:
		ans = gcd(ans, i)
		ans = gcd(ans, n // i)
	i += 1
print(ans)


from math import sqrt
n = int(input())
m = n
for i in range(2, int(sqrt(n)) + 1):
	if n % i == 0:
		count = 0
		while True:
			m //= i
			count += 1
			if m == 0 or m == 1:
				break
		if i ** count == n:
			print(i)
		else:
			print(1)
		break
else:
	print(n)


n = int(input())
m = int(n ** 0.5) + 2
ans = n
for i in range(2, m):
	if n % i == 0:
		while n % i == 0:
			n = n // i
		if n != 1:
			ans = 1
			break
		else:
			ans = i
print(ans)


import math

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

def is_odd(n):
	return n % 2 == 1
N = int(input())
k = int(math.sqrt(N)) + 1
nb_divisors = 0
first_div = -1
for i in range(2, k + 1):
	if N % i == 0:
		first_div = i
		break
res = 1
if first_div == -1:
	res = N
else:
	j = first_div
	while True:
		if j == N:
			res = first_div
			break
		elif j > N:
			res = 1
			break
		j *= first_div
print(res)


from sys import stdin, stdout
from collections import Counter, deque
from bisect import bisect_left
from itertools import product
n = int(input())
if n == 1:
	print(1)
	exit()
(p, dv) = (2, [])
while n > 1 and p * p <= n:
	while n % p == 0:
		dv.append(p)
		n //= p
	p += 1
if n > 1:
	dv.append(n)
cc = Counter(dv)
print(1 if len(cc.keys()) > 1 else list(cc.keys())[0])


n = int(input())
if n == 1:
	print(1)
else:
	es = 0
	for i in range(2, 1000000):
		if n % i == 0:
			es = 1
			while n % i == 0:
				n = n // i
			if n == 1:
				print(i)
			else:
				print(1)
			break
	if es == 0:
		print(n)


import math
n = int(input())
fl = False
mn = -1
for i in range(2, int(math.sqrt(n)) + 1):
	if n % i == 0:
		if fl == False:
			while n % i == 0 and n > 1:
				n /= i
			if n != 1:
				print(1)
				exit(0)
			mn = i
if mn != -1:
	print(mn)
else:
	print(n)


x = int(input())
a = x
for i in range(2, int(x ** 0.5) + 2):
	if x % i == 0:
		a = i
		break
for i in range(2, int(x ** 0.5) + 2):
	if x % i == 0 and (i % a != 0 or x / i % a != 0) and (x != a):
		a = 1
		break
print(a)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue
from statistics import median
from math import gcd, sqrt, floor, factorial, ceil, log2, log10
import copy
from copy import deepcopy
import sys
sys.setrecursionlimit(10 ** 7)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def get_primes(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return [i] + get_primes(n // i)
	return [n]

def non_repeated(l):
	return list(Counter(l))
t = 1
for i in range(t):
	n = int(input())
	lista = non_repeated(get_primes(n))
	if len(lista) == 1:
		a = lista[0]
		if a == n:
			print(n)
		else:
			print(a)
			continue
	else:
		print(1)
		continue


from math import sqrt
n = int(input())
d = {}
for i in range(2, int(sqrt(n)) + 1):
	if n % i == 0:
		while n % i == 0:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
			n //= i
if n != 1:
	d[n] = 1
if len(d) == 1:
	for k in d.keys():
		print(k)
else:
	print(1)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

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

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

def is_prime(n):
	if n == 1:
		return False
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
	return True

def prime_factorize(n):
	if n == 1:
		return [1]
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n:
		if n % f == 0:
			a.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		a.append(n)
	return a
n = inp()
m = set(prime_factorize(n))
if is_prime(n):
	print(n)
elif len(m) == 1:
	print(list(m)[0])
else:
	print(1)


n = int(input())
m = n
mn = n
t = n
i = 2
while i <= n ** 0.5:
	if n % i == 0:
		if mn == n:
			mn = i
		elif mn != i:
			m = 1
		n //= i
	else:
		i += 1
if mn == n and m != i:
	print(mn)
elif m != i:
	print(1)
else:
	print(mn)


n = int(input())
a = 0
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		a = 1
		break
if a == 0:
	print(n)
else:
	import math
	l = []
	count = 0
	while (n % 2 > 0) == False:
		n >>= 1
		count += 1
	if count > 0:
		l.append(2)
	for i in range(3, int(math.sqrt(n)) + 1):
		count = 0
		while n % i == 0:
			count += 1
			n = int(n / i)
		if count > 0:
			l.append(i)
		i += 2
	if n > 2:
		l.append(n)
	if len(l) == 1:
		print(l[0])
	else:
		print(1)


n = int(input())

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

def pf(n):
	primeFact = []
	for i in range(2, n):
		if n == 1:
			break
		if n % i == 0:
			primeFact.append(i)
			while n % i == 0:
				n = n // i
	return primeFact
pLen = len(set(primeFact))
if pLen == 0:
	print(n)
elif pLen == 1:
	print(primeFact[0])
else:
	print(1)


mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq
import random

def modinv(n, p):
	return pow(n, p - 2, p)

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

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

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

def printDivisors(n):
	l = []
	p = n
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(int(n // i))
	l.sort()
	nn = len(l)
	if nn == 2 or nn == 1:
		return p
	x = l[1]
	for i in range(1, nn - 1):
		x = math.gcd(x, l[i])
	return x

def main():
	n = inin()
	ans = printDivisors(n)
	print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

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

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

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

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

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

class IOWrapper(IOBase):

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

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


def prime_decomposition(n):
	i = 2
	table = []
	while i * i <= n:
		while n % i == 0:
			n //= i
			table.append(i)
		i += 1
	if n > 1:
		table.append(n)
	return table
N = int(input())
p = prime_decomposition(N)
if N == 1:
	print(1)
	exit()
if len(p) == 1:
	print(N)
	exit()
p = list(set(p))
if len(p) >= 2:
	print(1)
else:
	print(p[0])


import math
N = int(input())
S = []
for n in range(2, int(math.sqrt(N)) + 1):
	if N % n == 0:
		if N // n > n:
			S.append(n)
			S.append(N // n)
		elif N // n == n:
			S.append(n)
if len(S) == 0:
	print(N)
else:
	S.sort()
	ok = True
	for s in S:
		if s == S[0]:
			continue
		if s % S[0] != 0:
			ok = False
			break
	if not ok:
		print(1)
	else:
		print(S[0])


import math
n = int(input())
i = 2
arr = []
if n == 1:
	print(1)
else:
	while i * i <= n:
		if n % i == 0:
			arr.append(i)
		while n % i == 0:
			n //= i
		i += 1
	if n != 1:
		arr.append(n)
	if len(arr) == 1:
		print(arr[0])
	else:
		t = math.gcd(arr[0], arr[1])
		for i in range(2, len(arr)):
			t = math.gcd(t, arr[i])
		print(t)


from math import sqrt

def prime(n):
	temp = []
	while n % 2 == 0:
		n = n // 2
		temp.append(2)
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n // i
			temp.append(i)
	if n > 2:
		temp.append(n)
	return list(set(list(temp)))
n = int(input())
ans = prime(n)
if len(ans) == 1:
	print(*ans)
else:
	print(1)


n = int(input())
if n == 1:
	print(1)
else:
	k = int(pow(n, 0.5))
	div = []
	count = 0
	flag = 0
	for i in range(2, k + 1):
		if n % i == 0:
			div.append(i)
			count += 1
			while n % i == 0:
				n = n // i
			if n == 1:
				break
			else:
				flag = 1
				break
	if flag == 1:
		print(1)
	elif n == 1:
		print(div[0])
	else:
		print(n)


from math import sqrt
n = int(input())
if n <= 3:
	print(n)
else:
	rec = n
	nums = []
	dict_ = {}
	while n:
		m = int(sqrt(n))
		flag = False
		for i in range(2, m + 1):
			if not n % i:
				if not dict_.get(i, False):
					nums.append(i)
				flag = True
				dict_[i] = True
				break
		if not flag:
			if not dict_.get(n, False):
				nums.append(n)
			break
		else:
			n = int(n / i)
			if n <= 3:
				if not dict_.get(n, False):
					nums.append(n)
				break
	size = len(nums)
	if size == 1:
		print(nums[0])
	if not size:
		print(rec)
	if size > 1:
		print(1)


import math
N = int(input())

def primeFactors(n):
	st = 1
	c = 0
	if n % 2 == 0:
		c += 1
		st = 2
	while n % 2 == 0:
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			c += 1
			st = i
			if c == 2:
				return 1
		while n % i == 0:
			n = n // i
	if n > 2:
		if st == 1:
			return n
		elif st != n:
			c += 1
	if c == 2:
		return 1
	elif c == 1:
		return st
if N != 1:
	print(primeFactors(N))
else:
	print(1)


n = int(input())
N = int(n ** 0.5)

def eraSieve(N):
	poss = []
	isPrime = [1 for i in range(N + 1)]
	for i in range(2, N + 1):
		if isPrime[i]:
			if not n % i:
				poss.append(i)
				if len(poss) >= 3:
					break
			for j in range(i, N + 1, i):
				isPrime[j] = 0
	return poss
poss = eraSieve(N)
if not poss:
	print(n)
elif len(poss) >= 2:
	print(1)
else:
	p = poss[0]
	fail = 0
	while n > 1:
		if n % p:
			fail = 1
			break
		n //= p
	if fail:
		print(1)
	else:
		print(p)


from fractions import gcd
from datetime import date, timedelta
from heapq import *
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7

def factorize(n):
	fct = []
	(b, e) = (2, 0)
	while b * b <= n:
		while n % b == 0:
			n = n // b
			e = e + 1
		if e > 0:
			fct.append((b, e))
		(b, e) = (b + 1, 0)
	if n > 1:
		fct.append((n, 1))
	return fct

def is_prime(n):
	if n == 1:
		return False
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
	return True

def main():
	n = int(input())
	if n == 1:
		print(1)
	elif is_prime(n):
		print(n)
	else:
		l = factorize(n)
		if len(l) >= 2:
			print(1)
		else:
			print(l[0][0])
main()


import math

def countprime(x):
	i = 2
	primes = set()
	while i <= math.sqrt(x) + 1:
		if i == 2:
			while x % i == 0:
				x = x / i
				primes.add(i)
			i += 1
		else:
			while x % i == 0:
				x = x / i
				primes.add(i)
			i += 2
	if x > 1:
		primes.add(x)
	return primes
n = int(input())
if len(countprime(n)) == 1 and sum(countprime(n)) == n:
	print(n)
elif len(countprime(n)) == 0:
	print(1)
else:
	d = countprime(n)
	e = 0
	o = 0
	for s in d:
		if s % 2 == 0:
			e += 1
		else:
			o += 1
	if o > 1:
		print(1)
	elif o > 0 and e > 0:
		print(1)
	else:
		print(int(min(d)))


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import heapify, heappop, heappush
from statistics import median
from math import gcd, sqrt, floor, factorial, ceil, log2, log10
import copy
from copy import deepcopy
import sys
sys.setrecursionlimit(10 ** 7)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import random, randint, randrange

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

class MaxHeap:

	def __init__(self, maxsize):
		self.maxsize = maxsize
		self.size = 0
		self.Heap = [0] * (self.maxsize + 1)
		self.Heap[0] = sys.maxsize
		self.FRONT = 1

	def parent(self, pos):
		return pos // 2

	def leftChild(self, pos):
		return 2 * pos

	def rightChild(self, pos):
		return 2 * pos + 1

	def isLeaf(self, pos):
		if pos >= self.size // 2 and pos <= self.size:
			return True
		return False

	def swap(self, fpos, spos):
		(self.Heap[fpos], self.Heap[spos]) = (self.Heap[spos], self.Heap[fpos])

	def maxHeapify(self, pos):
		if not self.isLeaf(pos):
			if self.Heap[pos] < self.Heap[self.leftChild(pos)] or self.Heap[pos] < self.Heap[self.rightChild(pos)]:
				if self.Heap[self.leftChild(pos)] > self.Heap[self.rightChild(pos)]:
					self.swap(pos, self.leftChild(pos))
					self.maxHeapify(self.leftChild(pos))
				else:
					self.swap(pos, self.rightChild(pos))
					self.maxHeapify(self.rightChild(pos))

	def insert(self, element):
		if self.size >= self.maxsize:
			return
		self.size += 1
		self.Heap[self.size] = element
		current = self.size
		while self.Heap[current] > self.Heap[self.parent(current)]:
			self.swap(current, self.parent(current))
			current = self.parent(current)

	def Print(self):
		for i in range(1, self.size // 2 + 1):
			print(' PARENT : ' + str(self.Heap[i]) + ' LEFT CHILD : ' + str(self.Heap[2 * i]) + ' RIGHT CHILD : ' + str(self.Heap[2 * i + 1]))

	def extractMax(self):
		popped = self.Heap[self.FRONT]
		self.Heap[self.FRONT] = self.Heap[self.size]
		self.size -= 1
		self.maxHeapify(self.FRONT)
		return popped

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

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

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

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

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

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
t = 1
for i in range(t):
	n = input_int()
	if is_prime(n):
		print(n)
		continue
	fac = prime_factors(n)
	dict = Counter(fac)
	lena = len(dict)
	if len(dict) > 1:
		print(1)
	else:
		print(list(dict)[0])


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

def fi():
	return float(input())

def si():
	return input()

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

def li():
	return list(mi())
import math
n = ii()
l = []
i = 2
while i * i <= n:
	if n % i == 0:
		l.append(i)
		if i * i != n:
			l.append(n // i)
	i += 1
l.append(n)
c = 0
for i in range(len(l)):
	c = math.gcd(c, l[i])
print(c)


import math

def isp(n):
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			return False
	return True
n = int(input())
if isp(n):
	print(n)
else:
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			while n % i == 0:
				n //= i
			if isp(i) and n == 1:
				print(i)
			else:
				print(1)
			break