This page is still under construction.

Parts of this page are still being built. What you see may change.

Composite Factorization

Interview

Time limit1sMemory limit1024 MB

Summary
Factor N into a product of composite numbers, choosing the lexicographically smallest such sequence, or report that none exists.
Level

Medium6 of 10

Topics
Math, Number theory, Greedy, Brute force
Solved
No attempts yet

Problem

Prime factorization expresses a natural number as a product of primes. Yeondu, who hates number theory with a passion, trembles at the mere sight of a prime, so instead she invented "composite factorization," which expresses a natural number as a product of composite numbers.

The composite factorization of a natural number NN is defined as a sequence AA that satisfies all of the following conditions.

  • Every element of AA is a composite number. (A composite number is an integer that has a divisor other than 11 and itself.)
  • The product of all elements of AA is NN.

However, Yeondu realized that NN may have several composite factorizations, or none at all. Write a program that performs composite factorization of NN on Yeondu's behalf. If several results are possible, choose the lexicographically smallest one.

Input

The input is given as follows.

NN

Output

Among the composite factorizations of NN, print the elements of the lexicographically smallest sequence in order, separated by spaces.

If no composite factorization is possible, print -1 instead.

Constraints

  • 2≤N≤10122 \le N \le 10^{12}
  • NN is an integer.

Hint

The precise definition of a sequence A=a1,a2,…,anA = a_1, a_2, \dots, a_n being lexicographically smaller than a sequence B=b1,b2,…,bmB = b_1, b_2, \dots, b_m is that one of the following holds.

  • There exists an ii such that a1=b1, a2=b2, …, ai−1=bi−1a_1=b_1,\ a_2=b_2,\ \dots,\ a_{i-1}=b_{i-1} and ai<bia_i < b_i.
  • a1=b1, a2=b2, …, an=bna_1=b_1,\ a_2=b_2,\ \dots,\ a_n=b_n and n<mn<m.

Examples2

  1. Example 1

    Input
    3
    
    Expected output
    -1
    
  2. Example 2

    Input
    24
    
    Expected output
    4 6