import math
def countprime(x):
    i=2
    primes=set()
    while i<=math.sqrt(x) + 1:

        if i==2:

            while x%i==0:
                # print(primes)
                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)
    # print(primes)
    return primes
# print(countprime(1))
n=int(input())
if len(countprime(n))==1 and sum(countprime(n))==n:
    print(n)
else:
    if len(countprime(n))==0:
        print(1)
    else:
        d=(countprime(n))

        # d.remove(1)
        e=0
        o=0
        # print(d)
        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)))
        # print(min(d))

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 ** .5) + 1):
    if ( n % i == 0 ):
        a = mdc(a, i)
        a = mdc(a, n // i)
print(a)

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
def primeFactors(n,ans):

    while n % 2 == 0:
        ans.append(2)
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            ans.append(i)
            n = n // i

    if n > 2:
        ans.append(n)

n=int(input())
ans=[]
if(n==1):
    print(1)
else:
    primeFactors(n,ans)
    ans=set(ans)
    ans=list(ans)
    if(len(ans)==1):
        print(ans[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)

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

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)

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
	else:
		if 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)

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)

# if ans==n:
#     print(n)
# else:
#     print(ans, n)
#     p =  ans
#     x = [i for i in range(p)]
#     for i in range(ans+1, m):
#         if n%i==0:
#             tmp = n//i
#             # print(i)
#             if n//i>=p:
#                 x = [0 for j in range(p)]
#                 break
#             else:
#                 for j in range(1,n//i+1):
#                     x[(j*i)%p] = 0
#             while(n%i==0):
#                 n = n//i

#     print(len(set(x)))

from math import gcd
n = int(input())
if n == 1:
    print(1)
    exit()
elif n == 2:
    print(2)
    exit()
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)

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)

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)

#!/usr/bin/python3

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

###############################################################################
# AUXILIARY FUNCTIONS

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)

if __name__ == '__main__':
    main()

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])

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")

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 math
n = int(input())
x = n
for i in range(2, int(n**0.5)+1):
    if n%i==0:
        x = math.gcd(x, i)
        x = math.gcd(x,int(n/i))
print(x)

from collections import Counter,defaultdict,deque
import heapq as hq
from itertools import count, islice
from functools import reduce
#alph = 'abcdefghijklmnopqrstuvwxyz'
#from math import factorial as fact
#a,b = [int(x) for x in input().split()]
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))

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)

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())
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)

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)

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
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
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)]

# @lru_cache(None)

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
        # break
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)

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())
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 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)
    else:
        if len(l)==1:
            print(l[0])
        else:
            print(1)

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
def primef(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())
l=primef(n)
l=list(set(l))
if len(l)==1:
    print(l[0])
else:
    print(1)

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 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=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)

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)

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 val

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

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

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 math import gcd
n = int(input())
if n == 1:
    print(1)
    exit()
elif n == 2:
    print(2)
    exit()
d = 0
for i in range(2, n):
    if i * i > n:
        break
    if n % i:
        continue
    d = gcd(d, i)
    d = gcd(d, n // i)
if d:
    print(d)
else:
    print(n)

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=[]
        # Print the number of two's that divide n
        while n % 2 == 0:
            pf.append(2)
            n = n / 2

        # n must be odd at this point
        # so a skip of 2 ( i = i + 2) can be used
        for i in range(3,int(math.sqrt(n))+1,2):

            # while i divides n , print i ad divide n
            while n % i== 0:
                pf.append(int(i))
                n = n /i

        # Condition if n is a prime
        # number greater than 2
        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)

    #<--Solving Area Ends
    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

if __name__ == '__main__':
    sys.stdin = FastStdin()
    sys.stdout = FastStdout()
    main()

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])

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)

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)

if __name__ == '__main__':
    # Number of requests
    k = int(input().rstrip())
    task_3(k)

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, int(n/i))
print(x)

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)

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)

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

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 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 = []  # prime factor
    b, e = 2, 0  # base, exponent
    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():
    # k = int(input())
    # for i in range(k):
    #     n  = int(input())
    #     s = list(input())
    #     t = list(input())
    #     d = defaultdict(int)
    #     for i in range(n):
    #         d[s[i]] += 1
    #         d[t[i]] += 1

    #     f = False
    #     for v in d.values():
    #         if v % 2 == 1:
    #             print("No")
    #             f = True
    #     if f:
    #         continue

    n = int(input())
    # l = [0] * n
    # l[1] = 1
    # for i in range(2, n):
    #     f= True
    #     for j in range(n):
    #         if i == j:
    #             continue
    #         if abs(i - j) > 1 and (n % abs(j - i)) == 0:
    #             l[i] = l[j]
    #             f = False
    #             break
    #     if f:
    #         l[i] = i
    # print(l,len(list(set(l))))
    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])

if __name__ == '__main__':
    main()

#!/usr/bin/python3

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]));

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)

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
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
#print(arr)6

ans=0
if len(arr)==0:print(n)
else:
 for j in arr:
  ans=math.gcd(j,ans)
 print(ans)

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

import math
def isPrime(n) :

    # Corner cases
    if (n <= 1) :
        return False
    if (n <= 3) :
        return True

    # This is checked so that we can skip
    # middle five numbers in below loop
    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 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))

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])

'''
    Author : thekushalghosh
    Team   : CodeDiggers
'''
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 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])

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)

import math

# A function to print all prime factors of
# a given number n
def primeFactors(n,a):

    # Print the number of two's that divide n
    while n % 2 == 0:
        a.append(2)
        n = n / 2

    # n must be odd at this point
    # so a skip of 2 ( i = i + 2) can be used
    for i in range(3,int(math.sqrt(n))+1,2):

        # while i divides n , print i ad divide n
        while n % i== 0:
            a.append(i)
            n = n / i

    # Condition if n is a prime
    # number greater than 2
    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 sys import stdin, stdout
from collections import Counter, deque
from bisect import bisect_left
from itertools import product
#input = stdin.buffer.readline

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])

def main():
    global visited, adj, sets
    #print = out.append
    ''' Cook your dish here! '''
    n = get_int()
    factors = prime_factors(n)
    if len(factors)>1 or len(factors)==0: print(1)
    else: print(list(factors.keys())[0])

''' Coded with love at India by Satyam Kumar '''
import sys
#from collections import defaultdict
import math
def prime_factors(n):  # n**0.5 complex
    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)
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')

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

from __future__ import division, print_function
def main():
    n=int(input())
    orig=n
    x=int(n**0.5)
    count=0
    divisor=-1
    for i in range(2,x+1):
        if n%i==0:
            divisor=i
            while n%i==0:
                n=n//i
            count+=1
            break
    if count==0:
        print(n)
    else:
        if n==1:
            print(divisor)
        else :
            print(1)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

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

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
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

if __name__== "__main__":
  main()

import math
def fun(n):
    ans=[]
    # Print the number of two's that divide n
    if n%2==0:
        ans.append(2)
    while n % 2 == 0:
        n = n / 2

    # n must be odd at this point
    # so a skip of 2 ( i = i + 2) can be used
    for i in xrange(3,int(math.sqrt(n))+1,2):

        # while i divides n , print i ad divide n
        if n%i==0:
            ans.append(i)
        while n % i== 0:
            n = n / i

    # Condition if n is a prime
    # number greater than 2
    if n > 2:
        ans.append(n)
    return ans

n=input()
x=fun(n)
if len(x)==1:
    print x[0]
else:
    print 1

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)

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)

import os
import sys
from collections import defaultdict as ddic, Counter, deque
from itertools import combinations, permutations, product
import bisect, heapq

FAST_INPUT = 0
if FAST_INPUT:
    from atexit import register
    from io import BytesIO

    sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
    sys.stdout = BytesIO()
    register(lambda: os.write(1, sys.stdout.getvalue()))

rr = lambda: sys.stdin.readline().rstrip('\r\n')
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
MOD = 10**9 + 7

DEBUG = 0
if DEBUG:
    import random
    random.seed(0)
    ri = random.randint

#####

def genprimes(n):
    sieve = [True] * (n/2)
    for i in xrange(3,int(n**0.5)+1,2):
        if sieve[i/2]:
            sieve[i*i/2::i] = [False] * ((n-i*i-1)/(2*i)+1)
    return [2] + [2*i+1 for i in xrange(1,n/2) if sieve[i]]

#primes = genprimes(10**6)
def factorization(n):
    facs = []
    d = 2
    while d*d <= n:
        e =0
        while n%d == 0:
            n /= d
            e += 1
        if e:
            facs.append((d, e))
        d += 1 + (d&1)
    if n > 1:
        facs.append((n, 1))
    return facs

def divisors(n):
    facs = factorization(n)
    from itertools import product
    D, E = zip(*facs)
    for es in product(*[range(ei+1) for ei in E]):
        bns = 1
        for i, e in enumerate(es):
            bns *= D[i] ** e
        yield bns

def solve(N):
    """
    for all i<j, j-i > 1, n %(j-i) == 0
    # then i and j are the same
    """
    if N == 1: return 1
    if N == 2: return 2
    if N == 3: return 3
    if N == 4: return 2
    if N == 5: return 5

    primes, expos = zip(*factorization(N))

    from fractions import gcd
    g = reduce(gcd, primes)
    return g

class DSU:
    def __init__(self, N):
        self.par = list(range(N))

    def find(self, x):
        if self.par[x] != x:
            self.par[x] = self.find(self.par[x])
        return self.par[x]

    def union(self, x, y):
        xr, yr = self.find(x), self.find(y)
        if xr == yr: return False
        self.par[yr] = xr
        return True

def brute(N):
    dsu = DSU(N)
    while True:
        found = False
        for d in xrange(2, N):
            if N % d == 0:
                for i in xrange(N):
                    j = i+d
                    if j < N:
                        if dsu.union(i, j):
                            found = True
        if not found: break
    return len({dsu.find(i) for i in xrange(N)})

#####

if 0:
    for i in xrange(1, 100):
        bru = brute(i)
        if bru != solve(i):
            print i, solve(i), ';', bru
    print 'done'

N = rri()
ans = solve(N)
print ans

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)

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

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 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))

import math

# A function to print all prime factors of
# a given number n
def rs(n):
    s = set()
    # Print the number of two's that divide n
    while n % 2 == 0:
        s.add(2)
        n = n // 2

    # n must be odd at this point
    # so a skip of 2 ( i = i + 2) can be used
    for i in range(3,int(math.sqrt(n))+1,2):

        # while i divides n , print i ad divide n
        while n % i== 0:
            s.add(i)
            n = n // i

    # Condition if n is a prime
    # number greater than 2
    if n > 2:
        s.add(n)
    return s

n = int(input())
s = rs(n)
if(len(s) == 1):
    print(list(s)[0])
else:
    print(1)

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))

from math import sqrt
def prime(n):
    temp = []
    while n % 2 == 0:
        # print (2)
        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())
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)

# for nt in range(1,100):
# 	n=nt
# 	ans=[0]*n
# 	color=0
# 	for i in range(1,n+1):
# 		if ans[i-1]==0:
# 			color+=1
# 		for j in range(i+2,n+1):
# 			if n%(j-i)==0:
# 				if ans[i-1]!=0:
# 					ans[j-1]=ans[i-1]
# 				elif ans[j-1]!=0:
# 					ans[i-1]=ans[j-1]
# 				else:
# 					ans[i-1]=color
# 					ans[j-1]=color
# 			#print (i,j,ans)
# 	if ans.count(0)==len(ans):
# 		print (str(nt)+" : "+str(n))
# 	else:
# 		count={}
# 		calc=0
# 		for i in ans:
# 			if i not in count:
# 				calc+=1
# 				count[i]=1
# 		print (str(nt)+" : "+str(calc))
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)
		else:
			if len(factors)==1:
				print (factors[0])
			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)
    else:
        if(n==1):
            print (div[0])
        else:
            print (n)

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)

def isPrime(n):

    isp=True
    i=2
    while i*i<=n:
        if n%i==0:
            isp=False
            break
        i+=1
    return isp
def soe(n):
    primes=[True]*(n+1)
    primes[0]=primes[1]=False
    i=4
    while i<n:
        primes[i]=False
        i+=2
    i=3
    while i*i<=n:
        for j in range(i*i,n,2*i):
            primes[j]=False
        i+=2
    ans=[]
    for i in range(len(primes)):
        if primes[i]:
            ans.append(i)
    return ans
prim=soe(10**7)
n=int(input())
ct=0
f=-1

for i in prim:
    if n%i==0:
        fac=n//i
        isp=isPrime(fac)
        ct+=1
        if isp and fac!=i:
            ct+=1
        f=i
isp=isPrime(n)
if isp:
    print(n)

elif ct>=2:
    print(1)
elif ct==1:
    print(f)
else:
    print(n)

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)

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())
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)

'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College
    Date:10/06/2020

'''
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
#mod=998244353
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():

    # for _ in range(ii()):

    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)

if __name__ =="__main__":
    solve()

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):
        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)

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

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()
sn = ceil(sqrt(n).real)
m = n
if n % 2 == 0:
    m = 2
if m != 2:
    for i in range(3, sn + 2, 2):
        if n % i == 0:
            m = i
            break
print(m if m == n else n // m)

import math
def calc(n):
    temp=n
    if(n==1):
        return 1
    else:
        p=2
        result=0
        while(n!=1):
            bool=False
            while(n%p==0):
                n//=p
                bool=True
            if bool is True:
                result=math.gcd(result,p)
            if(result==1 or p>int(math.sqrt(temp))+1):
                break
            p+=1
            #print(result)
        if(result==0):
            return temp
        else:
            return result
n=int(input())
print(calc(n))

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

if x==1 or z==2:
    print(1)
else:
    print(a)

import math
def primeFactors(n,ans):

    while n % 2 == 0:
        ans.append(2)
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            ans.append(i)
            n = n // i

    if n > 2:
        ans.append(n)

n=int(input())
ans=[]
if(n==1):
    print(1)
else:
    primeFactors(n,ans)
    print(ans[len(ans)-1])

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 = []  # prime factor
    b, e = 2, 0  # base, exponent
    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():
    # k = int(input())
    # for i in range(k):
    #     n  = int(input())
    #     s = list(input())
    #     t = list(input())
    #     d = defaultdict(int)
    #     for i in range(n):
    #         d[s[i]] += 1
    #         d[t[i]] += 1

    #     f = False
    #     for v in d.values():
    #         if v % 2 == 1:
    #             print("No")
    #             f = True
    #     if f:
    #         continue

    n = int(input())
    # l = [0] * n
    # l[1] = 1
    # for i in range(2, n):
    #     f= True
    #     for j in range(n):
    #         if i == j:
    #             continue
    #         if abs(i - j) > 1 and (n % abs(j - i)) == 0:
    #             l[i] = l[j]
    #             f = False
    #             break
    #     if f:
    #         l[i] = i
    # print(l,len(list(set(l))))
    if n == 1:
        print(1)
    elif is_prime(n):
        print(n)
    elif n == 4:
        print(2)
    else:
        l = factorize(n)
        print(l[0][0])

if __name__ == '__main__':
    main()

import math

n = int(input())

if n in [1,2,3]:
	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 os, sys, math

n = int(input())
sqt = int(math.sqrt(n))

have = 0
haveodd = 0
odd = 0
for i in range(2,sqt+1):
	if n%i == 0:
		have += 1
		if i%2 == 1:
			haveodd += 1
			odd = i
		if i*i != n and (n/i)%2 == 1:
			haveodd += 1
			odd = i

if have == 0:
	print(n)
	sys.exit(0)

if n%2 == 0:
	if haveodd:
		print(1)
	else:
		print(2)
else:
	if haveodd == 1:
		print(odd)
	else:
		print(2)

import sys
ip=lambda :sys.stdin.readline().rstrip()
# from collections import *
n=int(ip())
if n<=2:
    print(n)
elif n%2==0:
    print(n//2)
else:
    val=-1
    ct=0
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            if val==-1:
                val=i
            ct+=1
    if ct>=1:
        print(val)
    else:
        print(n)

n = int(input())
m = int(n**0.5)+2
ans = n
for i in range(2,m):
    if n%i==0:
        ans = i
        break
if ans==n:
    print(n)
else:
    p =  ans
    x = [1 for i in range(p)]
    for i in range(ans+1, m):
        if n%i==0:
            if n//i>=p:
                x = [0 for j in range(p)]
                break
            else:
                for j in range(1,n//i+1):
                    p[(j*i)%p] = 0
    print(max(x.count(1), 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)

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)
		sys.exit(0)
print(1)

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)

k=min(lol)
a=k
for i in lol:
    if i!=a:
        c=i//a
        d=c+1
        k=min(k,i%a*c,i%a*d)
print(k)

def soe(n):
    primes=[True]*(n+1)
    primes[0]=primes[1]=False
    i=4
    while i<n:
        primes[i]=False
        i+=2
    i=3
    while i*i<=n:
        for j in range(i*i,n,2*i):
            primes[j]=False
        i+=2
    ans=[]
    for i in range(len(primes)):
        if primes[i]:
            ans.append(i)
    return ans
prim=soe(10**7)
n=int(input())
ct=0
f=-1
for i in prim:
    if n%i==0:
        ct+=1
        f=i
if ct>=2:
    print(1)
elif ct==1:
    print(f)
else:
    print(n)

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()
sn = ceil(sqrt(n).real)
m = n
if n % 2 == 0:
    m = 2
for i in range(3, sn + 1, 2):
    if n % i == 0:
        if m == 2:
            print(1)
            exit()
        m = i
        while m < n:
            m *= i
        if m == n:
            print(i)
        else:
            print(1)
        exit()
print(n)

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)
	sys.exit(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)
		sys.exit(0)
print(1)

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)
    if l[i]*l[i+1]==n:
        mini=1
print(max(mini,1))

import math
def smallestDivisor(n):
    # if divisible by 2
    if (n % 2 == 0):
        return 2;

        # iterate from 3 to sqrt(n)
    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)
print(small)
if isPower(small,num):
    print(small)
else:
    print(1)

n = 6#int(input())
def titlePain(n):
    if n < 2:
        return n
    count = 0
    dic = dict()
    for i in range(1,n):
        for j in range(i+1,n+1):
            results = abs(i-j)
            if results>1 and n%results ==0:
                dic[str(i)+'-'+str(j)] = results
    if(len(dic)>n):
        return 1
    if dic:
        return len(dic)
    return n
print(titlePain(n))

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

import sys
ip=lambda :sys.stdin.readline().rstrip()
# from collections import *
n=int(ip())
if n<=2:
    print(n)
elif n%2==0:
    print(2)
else:
    fl=False
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            fl=True
            break
    if fl:
        print(1)
    else:
        print(n)

n = int(input())
i = 2

while i * i <= n:
    if n % i == 0:
        break

    i += 2

if n % i == 0:
    print(i)
else:
    print(n)

#Ashish Sagar
import math
def isPrime(n) :
    # Corner cases
    if (n <= 1) :
        return False
    if (n <= 3) :
        return True

    # This is checked so that we can skip
    # middle five numbers in below loop
    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)):
    print(n)
elif n==1:
    print(1)
else:
    if n==4 or n==9 or n==25 or n==49:
        print(int(math.sqrt(n)))
    elif math.sqrt(n)*math.sqrt(n)==n:
        print(int(math.sqrt(n)))
    elif n%2==0:
        if n%3==0 or n%5==0 or n%7==0:
            print(1)
        else:
            print(2)
    elif n%3==0:
        if n%5==0 or n%7==0:
            print(1)
        else:
            print(3)
    elif n%5==0:
        if n%7==0:
            print(1)
        else:
            print(5)
    else:
        print(1)

def task_3(k):
    start = (k+1)//2
    while k%start:
        start -=1
    print(k//start)

if __name__ == '__main__':
    # Number of requests
    k = int(input().rstrip())
    task_3(k)

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:
    m=math.log(n,2)
    if m==int(m):
        print(2)
    else:
        print(1)
elif n%2!=0:
    print(n//t)
else:
    print(n//t)

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

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(n//s[0])
    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 g == []:
		return n
	elif len(g) == 1:
		return g[0]
	else:
		return 1

k = int(input())
if k < 2:
	print(k)
else:
	n = factorize(k)
	print(n)

#Bhargey Mehta (Junior)
#DA-IICT, Gandhinagar
import sys, math, queue, collections
MOD = 10**9+7
#sys.stdin = open('input.txt', 'r')

n = int(input())
for i in range(2, 10**6+5):
    if n % i == 0:
        print(i)
        exit()
print(n)

def primes_UT(m):
    siz = m//2
    sieve = [1]*siz
    lim = int(m**0.5)
    for i in range(1,lim):
        if sieve[i]:
            val = 2*i+1
            temp = ((siz-1) - i)
            temp = temp//val
            sieve[i+val::val] = [0]*temp
    return [2] + [i*2+1 for i, v in enumerate(sieve) if v and i>0]

n = int(input())

primes = primes_UT(1000000) #1.000.000

if(n in primes):
    print(n)
elif(n==1):
    print(1)
else:
    for i in range(2,1000000):
        if(n%i==0):
            prim = i
            while(n%i==0):
                n = n//i

            if(n==1):
                print(i)
            else:
                print(1)
            break

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

if x==1 or z>1:
    print(1)
else:
    print(a)

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

l = int(input())
k=[l]
for i in range(2, l // 2 + 1, 1):
    if (l % i == 0):
     k.append(i)
k.sort()
a=len(k)
r=int(1)
for i in range(1,a):
    if (int(k[i])-int(k[i-1])==0):
        print("1")
        r=0
        break
if(r==1):
    print(min(k))

from math import sqrt,gcd,inf
q=int(input())
w=[]
s=sqrt(q)
for i in range(2,int(s)):
    if q%i==0:w.append(i)
for i in w:w.append(q//i)
if s==int(s):w.append(int(s))
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))

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

def check_all_even(arr):
    for i in arr:
        if i%2 != 0:
            return False
    return True

def get_color(n):
    if isprime(n):
        return n
    #Tim Ước của n
    arr = []
    for i in range(2,int(n**0.5)+2):
        if n%i==0:
            arr.append(i)

    if n%2 == 0:
        if check_all_even(arr):
            return 2
        else:
            return 1
    else:
        return arr[0]
    # return int(n**0.5)
if __name__ == "__main__":
    n = int(input())
    print (get_color(n))

import os, sys, math

n = int(input())
sqt = int(math.sqrt(n))

have = 0
haveodd = 0
odd = 0
for i in range(2,sqt+1):
	if n%i == 0:
		have += 1
		if i%2 == 1:
			haveodd += 1
			odd = i
		if i*i != n and (n/i)%2 == 1:
			haveodd += 1
			odd = i

if have == 0:
	print(n)
	sys.exit(0)

if n%2 == 0:
	if haveodd:
		print(1)
	else:
		print(2)
else:
	if haveodd == 1:
		print(odd)
	else:
		print(2)

import math
n = int(input())
isPrime = True
maxdiv = 0
divcnt = 0
for i in range(2, int(math.sqrt(n))+1):
    if n % i == 0:
        isPrime = False
        divcnt += 1
        maxdiv = i
        if n // maxdiv != maxdiv:
            divcnt += 1
            maxdiv = n // maxdiv
            break
        else:
            break

if isPrime:
    print(n)
else:
    if divcnt >= 2:
        print(1)
    else:
        print(maxdiv)

from math import sqrt,log
n=input()
i=2
x=int(sqrt(n))+1
while i<x:
	if n%i==0:
		#print i,log(n,i)
		z=int(log(n,i))
		#print z,log(n,i)%1.0,z.is_integer()
		if pow(i,z)==n:
			print i
			exit(0)
		break
	i+=1
if i==x:
	print n
else:
	print 1

import math
N = int(input())
def minFactors(n):
	for i in range(2,int(math.sqrt(n))+1):
		if n % i== 0:
			return i
	return n
print(minFactors(N))

#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
import math
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

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

def solve1(n):
	facs = []
	for i in range(1, int(n**.5)+1):
		if n%i == 0:
			facs.append(i)
			if n//i != i:
				facs.append(n//i)
	ans = 0
	for i in range(1, len(facs)):
		ans = gcd(ans, facs[i])
	return ans

def solve2(n):
	facs = factors(n)
	ans = 0
	for fac in facs:
		if fac != 1:
			ans = gcd(ans, fac)
	return ans

def main():
	n = int(input())
	print(solve2(n))

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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 FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()

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)
    if len(a) > 1:
        print(1)
    else:
        print(a[0])

n = int(input())
count = 0
dic = dict()
for i in range(1,n):
    # print('this is i ', i)
    for j in range(i+1,n+1):
        results = abs(i-j)
        if results>1 and n%results ==0:
            dic[str(i)+'-'+str(j)] = True
if dic:
    print(len(dic))
else:
    print(n)

import math

# Function to calculate all the prime
# factors and count of every prime factor
def factorize(n):
    num = 0
    c = 0
    count = 0;
    i = 0
    # count the number of
    # times 2 divides
    while ((n % 2 > 0) == False):

        # equivalent to n = n / 2;
        n >>= 1;
        count += 1;

    # if 2 divides it
    if (count > 0):
        c+=1
        num = max(num, 2)

    # check for all the possible
    # numbers that can divide it
    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):
            c+=1;
            num = max(num, i)
        i += 2;

    # if n at the end is a prime number.
    if (n > 2):
        num = max(num, i)
        c+=1
    return c, num

n = int(input())
k, num = factorize(n)
if k == 1 and num!= 0:
    print(int(n // n**(1/2)))
elif k >=2:
    print(1)
else:
    print(n)

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 val

def titlePaint(n):

    if n < 2 or isPrime(n):
        print(n)
        return 0

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

from math import sqrt, ceil
def is_prime(a):
    if (2==a):
        return True
    else:
        return all(a % i for i in range(2, int(ceil(sqrt(a)+1))))

n = int(input())

if is_prime(n):
   print(n)
else:
   found = False
   for i in range(2, int(ceil(sqrt(n)+3))):
       if  n % i == 0 and is_prime(i):
           if is_prime(int(n/i)):
              found = 1
              break
           if found:
               found = 1
               break
           if not found:
               found = i
   print(found)

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

n = int(input())
p = int(pow(n,0.5))
for i in range(p,1,-1):
    if n%i==0:
        j = int(n/i)
        k = max(i,j)
        print(k)
        break
else:
    print(n)

from __future__ import print_function # for PyPy2
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(1e9)+7
inf = float("inf")

n, = gil()

if n&1:
	for i in range(3, int(math.ceil(math.sqrt(n)))+1, 2):
		if n%i == 0:
			print(i)
			exit()
	print(n)
	exit()

print(2)

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)
        #print(i,n/i)
        for j in range(2,int(pow(i,0.5)+1)):
            if i%j==0:
                break
        else:
            prime += 1
        m = int(n/i)
        #print(m,i,m!=i)
        if m!=i:
            for j in range(2,int(pow(m,0.5))+1):
                if m%j==0:
                    print(j)
                    break
            else:
                prime += 1
    if prime == 2:
        print(1)
        break
else:
    if div == []:
        print(n)
    else:
        print(min(div))
#(prime)

import math

# Function to calculate all the prime
# factors and count of every prime factor
def factorize(n):
    num = 0
    c = 0
    count = 0;
    i = 0
    # count the number of
    # times 2 divides
    while ((n % 2 > 0) == False):

        # equivalent to n = n / 2;
        n >>= 1;
        count += 1;

    # if 2 divides it
    if (count > 0):
        c+=1
        num = max(num, 2)

    # check for all the possible
    # numbers that can divide it
    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):
            c+=1;
            num = max(num, i)
        i += 2;

    # if n at the end is a prime number.
    if (n > 2):
        num = max(num, i)
        c+=1
    return c, num

n = int(input())
k, num = factorize(n)
if k == 1 and num != 0:
    print(int(n - n // n**(1/2)))
elif k >=2:
    print(1)
else:
    print(n)

import math

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

n = int(input())
if n == 1:
    print(1)
else:
    m = p(n)
    d = math.log(n, m)
    if int(d) == d:
        print(m)
    else:
        print(1)

import math

def factorize(n):
	g = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if (n % i == 0):
			while n % i == 0:
				n //= i
			g.append(i)
	if g == []:
		return n
	elif 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
def findFirstDelimeter(n):
    for i in range(int(math.sqrt(n)))[1::1]:
        if n%(i+1) == 0:
            return i+1
    return n
n = int(input())
print(findFirstDelimeter(n))

x=int(input())
if x==1:
    print(1)
for i in range (2,x+1):
    if x%i==0:
        print(i)
        break

def calc(n):
    if(n==1):
        return 1
    else:
        p=2
        while(n%p!=0):
            p+=1
        return p

n=int(input())
#n=3
print(calc(n))

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:
            devi.add(n//i)
        n //= i
    else:
        i += 1
if len(devi) == 0:
    print(n)
elif len(devi) == 1:
    print(*devi)
else:
    print(1)

from sys import stdin, exit

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

print(f)

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(n)
else:
	a = set(dziel)
	if len(a) == 1:
		print(dziel[0])
	else:
		print(1)

"""input
4
5
4 3 1 4 5
4
4 4 4 4
3
1 1 1
5
5 5 1 1 5
"""

from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())
import math
def maxPrimeFactors (n):
	maxPrime = -1
	for i in range(3, int(math.sqrt(n))+1, 2):
		if n % i == 0:
			maxPrime = i
			break
	if int(maxPrime) == -1:
		return n
	else:
		return maxPrime

def cont(n):
	# ans = len(set(color))
	if n%2 == 1:
		print maxPrimeFactors(n)
	else:
		print 2
# for i in range(1,10000):
n = input()
if n == 2:
	print 2
elif n == 3:
	print 3
else:
	cont(n)

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()
sn = ceil(sqrt(n).real)
m = n
if n % 2 == 0:
    m = 2
z = 0 if m == n else 1
for i in range(3, sn + 2, 2):
    if n % i == 0:
        m = i
        z += 1
if z > 1:
    print(1)
else:
    print(m if m == n else n // m)

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

        # Corner cases
        if (n <= 1) :
            return False
        if (n <= 3) :
            return True

        # This is checked so that we can skip
        # middle five numbers in below loop
        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:
        if n%2:
            for i in range(2,math.ceil(math.sqrt(n))):
                if n%i==0:
                    print(i)
                    break
        else:
            print(2)

n = int(input())
factors = []
if n%2==0:
    factors = [2]

for i in range(3, int(n**0.5)+1,2):
    if n%i==0:
        factors.append(i)
    if len(factors)>=2:
        break

if n==1:
    print(1)
elif len(factors)==0:
    print(n)
else:
    if len(factors)==1:
        print(factors[0])
    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:
  # found = False
 #  for i in range(2, int(ceil(sqrt(n)+3))):
 #      if  n % i == 0 and is_prime(i):
 #          if int(n/i) != i and is_prime(int(n/i)):
 #             found = 1
 #             break
 #          if found:
 #              found = 1
 #              break
 #          if not found:
 #              found = i
 #  print(found)
    numero = n
    for i in range(2, int(ceil(sqrt(n)+3))):
        if numero%i == 0:
            while  numero !=1:
                if numero % i !=0:
                    break
                numero /=i
            if is_prime(int(numero)):
                print(1)
                break
            else:
                print(i)
                break

from math import sqrt, floor

def run_testcase():
	number = int(input())

	# prime_divisors_count = 0

	# # while number % 2 == 0:
	# # 	prime_divisors_count += 1

	# last_prime_divisor = 2

	# # def sieve():

	# if number % last_prime_divisor == 0:
	# 	prime_divisors_count += 1
	# 	while number % last_prime_divisor == 0:
	# 		# number /= last_prime_divisor
	# 		number = number // last_prime_divisor

	num_sqrt = sqrt(number)

	# primes = [True] * (int(sqrt) + 1)
	# primes = [True] * int(sqrt)
	# primes = [True] * (int(sqrt) + 1)
	# primes = [True] * (floor(num_sqrt) + 1)
	primes = [True] * (floor(num_sqrt) + 2)
	primes[0] = False
	primes[1] = False

	# print(len(primes))

	# for i in range(len(primes)):
	# for i in range(len(2, primes)):
	for i in range(2, len(primes)):
		# for j in range(i)
		if i*i >= num_sqrt:
			break

		# if prime[i] == True:
		if primes[i] == True:
			continue

		# j = 0
		j = 2 * i
		while j < len(primes):
			# print(j)
			primes[j] = False
			j += i

		# print('test')

	prime_divisors_count = 0
	last_prime_divisor = 0

	# for value, prime in primes:
	for value, prime in enumerate(primes):
		if prime:
			# print(value)
			if number % value == 0:
				last_prime_divisor = value
				prime_divisors_count += 1
				if prime_divisors_count >= 2:
					return 1

	# return last_prime_divisor
	# return last_prime_divisor if last_prime_divisor != 0 else number

	# print(last_prime_divisor)

	# if last_prime_divisor ** 2 == number:
		# return last_prime_divisor
	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

# testcase_count = int(input())

# for i in range(testcase_count):
# 	print(str(run_testcase()))
	# run_testcase()
# run_testcase()
print(str(run_testcase()))

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")
##########################################################
import math
import bisect
#for _ in range(int(input())):
from collections import  Counter
#sys.setrecursionlimit(10**6)
#dp=[[-1 for i in range(n+5)]for j in range(cap+5)]
#arr= list(map(int, input().split()))
#n,m= map(int, input().split())
#arr= list(map(int, input().split()))
#for _ in range(int(input())):
import bisect
#n=int(input())
#for _ in range(int(input())):
from  collections import deque
#n,q= map(int, input().split())
#rr =deque(map(int, input().split()))
n=int(input())
if n==0:
    print("")
else:
    f=[]
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            f.append(i)
            if i!=n//i:
                f.append(n//i)
    f.append(0)
    f.append(n)
    f.sort()
    ans=10**12

    for i in range(len(f)-1):
        ans=min(ans,f[i+1]-f[i])
    if ans==10**12:
        print(n)
    else:
        print(ans)

# Python program to print prime factors

import math

# A function to print all prime factors of
# a given number n
def primeFactors(n):

	# Print the number of two's that divide n
	while n % 2 == 0:
		arr.add (2)
		n = n / 2

	# n must be odd at this point
	# so a skip of 2 ( i = i + 2) can be used
	for i in range(3,int(math.sqrt(n))+1,2):

		# while i divides n , print i ad divide n
		while n % i== 0:
			arr.add (i)
			n = n / i

	# Condition if n is a prime
	# number greater than 2
	if n > 2:
		arr.add(n)

# Driver Program to test above function

n = int(input())
arr=set()
primeFactors(n)
l=len(arr)
if(l==0):
    print(l)
if(l==1):
    for i in arr:
        print(i)
else:
    print("1")

# This code is contributed by Harshit Agrawal

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:
    m=math.log(n,2)
    if m==int(m):
        print(2)
    else:
        print(1)
elif n%2!=0:
   while n%t!=0:
       n=n//t
   if n==t:
       print(t)
   else:
       print(1)

import math
def primeFactors(n,ans):

    while n % 2 == 0:
        ans.append(2)
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            ans.append(i)
            n = n // i

    if n > 2:
        ans.append(n)

n=int(input())
ans=[]
if(n==1):
    print(1)
else:
    primeFactors(n,ans)
    print(ans[len(ans)-1])

from math import sqrt,gcd,inf
q=int(input())
w=[]
s=sqrt(q)
for i in range(2,int(s)):
    if q%i==0:w.append(i)
for i in w:w.append(q//i)
if s==int(s):w.append(int(s))
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))

from math import sqrt
x=int(input())
lol=[]
if x==1 or x==2:
    print(x)
else:
    for i in range(2,int(sqrt(x))+1):
        if x%i==0:
            lol.append(i)
            while x%i==0:
                x//=i
    if x>2:
        lol.append(x)
    if len(lol)>0:
        print(min(lol))
    else:
        print(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
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
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)]

# @lru_cache(None)

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]
step=n
for i in range(2,int(n**0.5)+2):
    if(n%i==0):
        step=i
        break
print(step)

def min_divisor(n):
    if not n % 2:
        return 2

    i = 3

    while i * i <= n:
        if not n % i:
            return i

        i += 2

    return n

n = int(input())
print(min_divisor(n))

import math
from decimal import *
import random
import sys

n = int(input())
tn = int(n)
odd, even = False, False
mult  = []
for i in range(2, int(math.sqrt(tn))+2):
    if(n%i==0):
        while(n%i==0):
            n//=i
            if(i%2==0):
                even = True
            if(i%2==1):
                odd = True
            mult.append(i)
        if(n==1):
            break
if(n!= 1 or tn==1):
    print(tn)
else:
    if(odd and even):
        print(1)
    else:
        print(mult[0])

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
        ans = i
        break

if ans==n:
    print(n)
else:
    p =  ans
    x = [i for i in range(p)]
    for i in range(ans+1, m):
        if n%i==0:
            # print(i)
            if n//i>=p:
                x = [0 for j in range(p)]
                break
            else:
                for j in range(1,n//i+1):
                    x[(j*i)%p] = 0
            while(n%i==0):
                n = n//i

    print(len(set(x)))

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:
    for i in range(2,10**6+1):
        if n % i == 0:
            print(n)
            quit()
    print(di[n])
else:
    print(1)

def abs(n):
    return n if n >= 0 else -n

n = int(input())
sup = n ** (1 / 2)
i = 2
while ( n % i != 0 ):
    if ( i > sup ):
        i = n
        break
    i += 1

print(i)

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

# Author : raj1307 - Raj Singh
# Date   : 6.11.19

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def msi(): return map(str,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations

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
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[0]
def sort2(l):return sorted(l, key=getKey)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]

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

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

def isPrime(n) : # Check Prime Number or not
    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 read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

def main():

    #for _ in range(ii()):

    n=ii()

    if(isPrime(n)):
        print(n)
        exit()
    """
    for i in range(2,int(sqrt(n))):
        if n%2==0:
            d=i
            break

    """

    print(2)

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()

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

import math
def primeFactors(n,ans):

    while n % 2 == 0:
        ans.append(2)
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            ans.append(i)
            n = n // i

    if n > 2:
        ans.append(n)

n=int(input())
ans=[]
if(n==1):
    print(1)
else:
    primeFactors(n,ans)
    if(len(ans)==1):
        print(ans[0])
    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):
        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 isprime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return False
    return True

def check_all_even(arr):
    for i in arr:
        if i%2 != 0:
            return False
    return True

def get_color(n):
    if isprime(n):
        return n

    #Tim Ước của n
    arr = []
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            arr.append(i)

    if n%2 == 0:
        if check_all_even(arr):
            return 2
        else:
            return 1
    else:
        return arr[0]
    # return int(n**0.5)

# def get_color(n):
#     if isprime(n):
#         return n
#     #Tim Ước của n
#     # arr = []
#     # for i in range(2,n):
#     #     if n%i==0:
#     #         arr.append(i
#     if n%2 == 0:
#         x = int(n**0.5)
#         if x*x == n:
#             return 2
#         else:
#             return 1
#     else:
#         # x = int(n**0.5)
#         # if x*x == n:
#         #     return x
#         for i in range(2,n):
#             if n%i==0:
#                 return i
#     # return int(n**0.5)

if __name__ == "__main__":
    n = int(input())
    print (get_color(n))
    # for i in range(100):
    #     print (i, get_color(i))

#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

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:
            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())
x = int(math.sqrt(n))
if x * x == n:
    print(int(x))
    exit(0)

prime = True
for i in range(2, x + 1):
    if n % i == 0:
        prime = False
        break

print(n if prime else 2)

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

#########################
# imgur.com/Pkt7iIf.png #
#########################

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))

for i in pr:
    if n % i == 0:
        c.append(i)
    if len(c) == 2:
        break
print(1) if len(c) == 2 else print(c[0])

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:
    m=math.log(n,2)
    if m==int(m):
        print(2)
    else:
        print(1)
elif n%2!=0:
    print(n//t)
else:
    print(n//t)

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(int(n/i),0.5)+1)):
                if i%j==0:
                    break
            else:
                prime += 1
    if prime == 2:
        print(1)
        break
else:
    if div == []:
        print(n)
    else:
        print(min(div))

# ------------------- fast io --------------------
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")

# ------------------- fast io --------------------

import math
import bisect

primes=[2]
for s in range(3,10**6+1):
    ind=min(bisect.bisect_left(primes,math.ceil(math.sqrt(s))+1),len(primes)-1)
    broke=False
    for b in range(ind):
        if s%primes[b]==0:
            broke=True
            break
    if broke==False:
        primes.append(s)
n=int(input())
#prime multiply by prime? 1 colour
#prime by 1? thats prime colours
#find its prime factors
tempy=n+0
primefacs=[]
setty=set([])
indy=min(bisect.bisect_left(primes,math.ceil(math.sqrt(n))+1),len(primes)-1)
for s in range(ind):
    if n%primes[s]==0:
        primefacs.append(primes[s])
        setty.add(primes[s])
        tempy=tempy//primes[s]
if tempy>1 and not(tempy in setty):
    primefacs.append(tempy)
if len(primefacs)>=2:
    print(1)
elif len(primefacs)==1:
    print(primefacs[0])
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

se = set()
for i in range(100):
    se.add(2**(i+1))
n = inp()
if is_prime(n):
    print(n)
elif n in se:
    print(2)
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:
    m=math.log(n,2)
    if m==int(m):
        print(2)
    else:
        print(1)
elif n%2!=0:
   print(1)

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

n = int(input())
count = 0
dic = dict()
for i in range(1,n):
    # print('this is i ', i)
    for j in range(i+1,n+1):
        results = abs(i-j)
        if results>1 and n%results ==0:
            dic[str(i)+'-'+str(j)] = results
if n ==0:
    print(0)
elif dic:
    print(len(dic))
else:
    print(n)

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

if x==1 or z>1:
    print(1)
else:
    print(a)