require 'prime' x = gets.to_i if Prime.prime?(x) || x == 1 puts x exit(0) end res = 1 arr = Prime.each(Math.sqrt(x).to_i + 1).to_a for a in arr do if x == 1 puts res exit(0) end cnt = 0 while x % a == 0 do x /= a cnt += 1 end if cnt % 2 == 1 res *= a end end puts res