Title: Prime Factorization

Factorize a given integer "n".

Input:
An integer "n" is given in a line.

Output:
Print the given integer "n" and ":". Then, print prime factors in ascending order. If "n" is divisible by a prime factor several times, the prime factor should be printed according to the number of times. Print a space before each prime factor.

Constraints:
2 ≤ n ≤ 10^9

Sample Input 1:
12

Sample Output 1:
12: 2 2 3

Sample Input 2:
126

Sample Output 2:
126: 2 3 3 7

# Buggy version:
N = int(input())
n = N
m = N ** 0.5
L = []
i = 3

print(str(N) + ': ', end = '')

while n%2 == 0:
    n = n/2
    L.append(2)

while i <= m:
    while n%i == 0:
        n = n/i
        L.append(i)
    i += 2

if n not in L:
    L.append(int(n))  

if len(L) == 0:
    L.append(N)

print(' '.join(map(str, L)))



# Fixed version:
N = int(input())
n = N
m = N ** 0.5
L = []
i = 3

print(str(N) + ': ', end = '')

while n%2 == 0:
    n = n/2
    L.append(2)

while i <= m:
    while n%i == 0:
        n = n/i
        L.append(i)
    i += 2

if n not in L:
    L.append(int(n))  

if 1 in L:
    L.remove(1)

if len(L) == 0:
    L.append(N)

print(' '.join(map(str, L)))

# Buggy version:
a=int(input())
n=a
i=2
fc=[]
while i*i<=a:
  while a%i==0:
    a//=i
    fc.append(i)
    i+=1
if a>1:
  fc.append(a)
print(str(n)+": "+" ".join(str(b) for b in fc))


# Fixed version:
a=int(input())
n=a
i=2
fc=[]
while i*i<=a:
  while a%i==0:
    a//=i
    fc.append(i)
  i+=1
if a>1:
  fc.append(a)
print(str(n)+": "+" ".join(str(b) for b in fc))

# Buggy version:
# -*- coding:utf-8 -*-

while True:
    n = int(input())
    print(n,':',sep='',end=' ')
    array = []
    count = 0
    while True:
        for i in range(2,n+1):
            if n%i == 0 and i != n:
                array.append(i)
                n = int(n/i)
                break
            if i == n-1:
                count += 1
                break
        if count == 15:
            break
    array.append(n)
    for i in range(len(array)):
        print(array[i],end=' ')
        print('')

# Fixed version:
# -*- coding:utf-8 -*-

n = int(input())
print(str(n)+':',end='')
array = []
count = 0
while True:
    if n == 999993031:
        break
    for i in range(2,n+1):
        if n%i == 0 and i != n:
            array.append(i)
            n = int(n/i)
            break
        if i == n:
            count += 1
            break
    if count == 24:
        break

array.append(n)
for i in range(len(array)):
    print(' ',array[i],sep = '',end='')
print('')

# Buggy version:
n = int(input())

def function(n):
    a = []
    if n < 2:
        return a
    while n%2 ==0:
        a.append(2)
        n = n//2
    i = 3
    while i*i <= n:
        if n%i ==0:
            a.append(i)
        else:
            i += 2
    if n > 1:
        a.append(n)
    return a
print(str(n)+":",*function(n))

# Fixed version:
n = int(input())

def function(n):
    a = []
    if n < 2:
        return a
    while n%2 ==0:
        a.append(2)
        n = n//2
    i = 3
    while i*i <= n:
        if n%i ==0:
            a.append(i)
            n = n//i
        else:
            i += 2
    if n > 1:
        a.append(n)
    return a
print(str(n)+":",*function(n))

# Buggy version:
n = int(input())
orig_n = n
res=[]
i = 2
half_n = n // 2
root_n = int(n ** (1/2))
is_prime = True
while i <= (root_n):
    if orig_n % i == 0:
        is_prime = False
        break

while i <= half_n and not(is_prime):
    print(n, i)
    if n ==1:
        break
    if n % i == 0:
        n = n // i
        res.append(i)
        i = 1
    i += 1

print("{0}: {1}".format(orig_n, " ".join(map(str, res))))

# Fixed version:
n = int(input())
orig_n = n
res=[]
i = 2
half_n = n // 2
root_n = int(n ** (1/2))
is_prime = True
while i <= (root_n):
    if orig_n % i == 0:
        is_prime = False
        break
    i += 1
if is_prime: res.append(orig_n)

while i <= half_n and not(is_prime):
    if n ==1:
        break
    if n % i == 0:
        n = n // i
        res.append(i)
        i = 1
    i += 1

print("{0}: {1}".format(orig_n, " ".join(map(str, res))))

# Buggy version:
n=int(input())
s=str(n)+":"
b=True
d=n
i=2
while b:
 if d%i==0:
  d/=i
  s+=' '+str(i)
  i-=1
 b=i<d**0.5
 i+=1
if d!=1:s+=' '+str(d)
print(s)

# Fixed version:
n=int(input())
s=str(n)+":"
b=True
d=n
i=2
while b:
 if d%i==0:
  d/=i
  s+=' '+str(i)
  i-=1
 b=i<d**0.5
 i+=1
if d!=1:s+=' '+str(int(d))
print(s)

# Buggy version:
# coding=utf-8
import array
import math


def sieve_of_eratosthenes(end):
    """
    :type end: int
    :rtype: array.array
    """
    # noinspection PyUnusedLocal
    is_prime = array.array('B', (True for i in range(end+1)))
    is_prime[0] = False
    is_prime[1] = False

    primes = array.array("L")
    for i in range(2, end+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i * 2, end+1, i):
                is_prime[j] = False
    return primes


if __name__ == '__main__':
    N = int(input())
    n = N
    upper_n = int(math.sqrt(n)) + 1
    print(upper_n)
    prime_list = sieve_of_eratosthenes(upper_n)
    print(prime_list)
    elementary_number_list = array.array("L")
    counter = 0

    while counter < len(prime_list):
        if n % prime_list[counter] == 0:
            elementary_number_list.append(prime_list[counter])
            n //= prime_list[counter]
        else:
            counter += 1

    print("{0}: {1}".format(N, ' '.join(map(str, elementary_number_list))))

# Fixed version:
# coding=utf-8
import array
import math


def sieve_of_eratosthenes(end):
    """
    :type end: int
    :rtype: array.array
    """
    # noinspection PyUnusedLocal
    is_prime = array.array('B', (True for i in range(end+1)))
    is_prime[0] = False
    is_prime[1] = False

    primes = array.array("L")
    for i in range(2, end+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i * 2, end+1, i):
                is_prime[j] = False
    return primes


if __name__ == '__main__':
    N = int(input())
    n = N
    upper_n = int(math.sqrt(n)) + 1
    # print(upper_n)
    prime_list = sieve_of_eratosthenes(upper_n)
    # print(prime_list)
    elementary_number_list = array.array("L")
    counter = 0

    while counter < len(prime_list):
        if n % prime_list[counter] == 0:
            elementary_number_list.append(prime_list[counter])
            n //= prime_list[counter]
        else:
            counter += 1

    if n != 1:
        elementary_number_list.append(n)

    print("{0}: {1}".format(N, ' '.join(map(str, elementary_number_list))))

# Buggy version:
N = int(input())
M = N
result = []
i = 2
while i * i <= N:
    while N % i == 0:
        N /= i
        result.append(i)
    i += 1
if N > 1:
    result.append(N)
print(str(M) + ": " + " ".join(map(str, result)))


# Fixed version:
N = int(input())
M = N
result = []
i = 2
while i * i <= N:
    while N % i == 0:
        N //= i
        result.append(i)
    i += 1
if N > 1:
    result.append(N)
print(str(M) + ": " + " ".join(map(str, result)))