You are given one integer number $n$. Find three distinct integers $a, b, c$ such that $2 \le a, b, c$ and $a \cdot b \cdot c = n$ or say that it is impossible to do it.

If there are several answers, you can print any.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

The next $n$ lines describe test cases. The $i$-th test case is given on a new line as one integer $n$ ($2 \le n \le 10^9$).


-----Output-----

For each test case, print the answer on it. Print "NO" if it is impossible to represent $n$ as $a \cdot b \cdot c$ for some distinct integers $a, b, c$ such that $2 \le a, b, c$.

Otherwise, print "YES" and any possible such representation.


-----Example-----
Input
5
64
32
97
2
12345

Output
YES
2 4 8 
NO
NO
NO
YES
3 5 823

Source: codeforces | Difficulty: EASY
Tags: Number theory

Mathematics

Greedy algorithms


Solutions:
cases = int(input())

def prime(n):
	for i in range(2, int((n + 1) ** 0.5)):
		if n % i == 0:
			return False
	return True
for i in range(cases):
	num = int(input())
	if prime(num):
		print('NO')
		continue
	if num < 24:
		print('NO')
		continue
	n = num
	d = {}
	for j in range(2, int((n + 1) ** 0.5)):
		while num % j == 0:
			if j not in d:
				d[j] = 1
			else:
				d[j] += 1
			num /= j
	if num > 1:
		if num not in d:
			d[num] = 1
		else:
			d[num] += 1
	ans = []
	if len(d) >= 3:
		two = 2
		print('YES')
		for key in d:
			if two == 0:
				break
			ans.append(key)
			d[key] -= 1
			two -= 1
		c = 1
		for ele in d:
			val = d[ele]
			c *= ele ** val
		ans.append(int(c))
		print(int(ans[0]), int(ans[1]), int(ans[2]))
	elif len(d) == 2:
		for key in d:
			ans.append(key)
			d[key] -= 1
		c = 1
		for key in d:
			val = d[key]
			c *= key ** val
		if c not in ans and c != 1:
			ans.append(int(c))
			print('YES')
			print(int(ans[0]), int(ans[1]), int(ans[2]))
		elif c in ans or c == 1:
			print('NO')
	elif len(d) == 1:
		val = list(d.values())
		if val[0] < 6:
			print('NO')
		else:
			a = int(list(d.keys())[0])
			b = int(list(d.keys())[0] ** 2)
			c = int(list(d.keys())[0] ** (val[0] - 3))
			print('YES')
			print(a, b, c)


import math
for p in range(int(input())):
	num = int(input())
	b = []
	a = num
	for i in range(2, int(math.sqrt(num)) + 1):
		if len(b) < 2:
			if a % i == 0:
				b.append(int(i))
				a /= i
		else:
			break
	if a not in b and len(b) == 2:
		print('YES')
		print(str(b[0]) + ' ' + str(b[1]) + ' ' + str(int(a)))
	else:
		print('NO')


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	f = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i != i:
				t = n // i
				for j in range(2, int(sqrt(t)) + 1):
					if t % j == 0:
						if t // j != j:
							if i != j and i != t // j:
								print('YES')
								print(i, j, t // j)
								f = 1
								break
		if f:
			break
	if not f:
		print('NO')


from math import sqrt
t = int(input())

def factor(n):
	factors = []
	div = int(sqrt(n))
	i = 2
	count = 1
	aux_n = n
	while n > 1 and i <= div:
		while n % i == 0:
			factors.append(i)
			n = n // i
			count *= i
		i += 1
	if n > 1:
		factors.append(aux_n // count)
	return factors
for _ in range(t):
	n = int(input())
	primes = factor(n)
	ans = []
	i = 0
	while i < len(primes):
		count = primes[i]
		if count not in ans:
			ans.append(count)
			i += 1
		else:
			i += 1
			while i < len(primes) and count in ans:
				count *= primes[i]
				i += 1
			ans.append(count)
	if len(ans) > 2:
		last = 1
		for i in range(2, len(ans)):
			last *= ans[i]
		ans = [ans[0], ans[1], last]
		if len(set(ans)) == 3:
			print('YES')
			print(ans[0], ans[1], last)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	on = n
	a = []
	for i in range(2, 1 + int(n ** 0.5)):
		if not n % i:
			a.append(i)
			n //= i
		if len(a) == 2:
			break
	if len(a) < 2 or on // (a[0] * a[1]) == 1 or on // (a[0] * a[1]) in a:
		print('NO')
	else:
		print('YES')
		a.append(on // (a[0] * a[1]))
		print(*a)


def solve(n):
	(a, b, c) = (None, None, n)
	i = 2
	while c >= 2 and i * i <= c:
		if c % i == 0:
			c //= i
			if a is None:
				a = i
			elif c >= 2 and len(set((a, i, c))) == 3:
				return (a, i, c)
		i += 1
	raise ValueError()
for T in range(int(input())):
	try:
		(a, b, c) = solve(int(input()))
		print('YES')
		print(a, b, c)
	except ValueError:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 9)
IA = lambda : map(int, input().split())
ans = [0, 0, 0, 0]

def solve(n):
	num = int(0)
	i = int(2)
	tmp = 1
	m = n
	while i * i <= n:
		if n % i == 0:
			n = n // i
			tmp *= i
			if tmp not in ans:
				num += 1
				ans[num] = tmp
				tmp = 1
				if num >= 3:
					ans[num] *= n
					return 1
		i += 1
	if n > 1:
		if tmp * n not in ans:
			num += 1
			ans[num] = n * tmp
	if num >= 3:
		return 1
	else:
		return -1
T = int(input())
for t in range(0, T):
	ans = [0, 0, 0, 0]
	n = int(input())
	if solve(n) == 1:
		print('YES')
		for i in range(1, 4):
			print(ans[i], end=' ')
		print()
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	f = False
	for i in range(2, 2000):
		if n % i != 0:
			continue
		newn = n // i
		if f:
			break
		for j in range(2, 100000):
			if newn % j != 0:
				continue
			k = newn // j
			if k >= 2 and i != j and (i != k) and (j != k):
				print('YES')
				print(i, j, k)
				f = True
				break
	if not f:
		print('NO')


from math import floor, sqrt
for _ in range(int(input())):
	n = int(input())
	if n <= 10:
		print('NO')
	else:
		l = []
		c = 0
		for i in range(2, floor(sqrt(n)) + 1):
			if c == 2:
				break
			if n % i == 0:
				l.append(i)
				n //= i
				c += 1
		l.append(n)
		if len(set(l)) < 3:
			print('NO')
		else:
			print('YES')
			print(l[0], l[1], l[2])


def fin(n):
	for a in range(2, int(n ** (1 / 3)) + 1):
		if n % a == 0:
			x = n / a
			for b in range(2, int(x ** (1 / 2)) + 1):
				if x % b == 0:
					y = int(x / b)
					if a != b and b != y and (y != a):
						return (a, b, y)
	return (0, 0, 0)
for _ in range(int(input())):
	n = int(input())
	(p, q, r) = (0, 0, 0)
	(p, q, r) = fin(n)
	if p != 0:
		print('YES')
		print(p, q, r)
	else:
		print('NO')


import math
for i in range(int(input())):
	n = int(input())
	r = []
	q = 2
	i = 0
	while i < 2 and q <= math.sqrt(n):
		if n % q == 0:
			r.append(q)
			i += 1
			n = n // q
		q += 1
	if n != 1:
		r += [n]
	if len(r) < 3 or r[1] == r[2] or r[0] == r[2] or (r[0] == r[1]):
		print('NO')
	else:
		print('YES')
		print(*r)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	fact = 2
	flag = 0
	while fact < n // fact:
		if n % fact == 0:
			n = n // fact
			arr.append(fact)
			if len(arr) == 2:
				arr.append(n)
				flag = 1
				break
		fact += 1
	if flag:
		print('YES')
		print(*arr)
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	ul = math.sqrt(n)
	ul = int(ul)
	ul += 1
	l = []
	count = 0
	flag = 0
	for i in range(2, ul + 1):
		if count == 2:
			break
		if n % i == 0:
			l.append(i)
			count += 1
			n = n // i
	if count == 2 and n not in l and (n != 1):
		print('YES')
		for i in range(2):
			print(l[i], end=' ')
		print(n)
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	c = 0
	l = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			l.append(i)
			n = n // i
			if len(l) == 2:
				break
	if len(l) == 2 and n > l[1]:
		print('YES')
		l.append(n)
		print(*l)
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	i = 2
	prev = n
	fac = []
	while i * i <= n:
		if n % i == 0:
			n = n // i
			fac.append(i)
			prev = i
		i += 1
	if n > 1:
		fac.append(n)
	while len(fac) > 3:
		fac[2] = fac[2] * fac[3]
		fac.pop(3)
	if len(fac) < 3:
		print('NO')
		continue
	if fac[1] == fac[2]:
		print('NO')
	else:
		print('YES')
		for j in range(len(fac)):
			if j == len(fac) - 1:
				print(fac[j])
			else:
				print(fac[j], end=' ')


import math

def primes(n):
	while n % 2 == 0:
		prime.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.append(i)
			n = n / i
	if n > 2:
		prime.append(int(n))
t = int(input())
for _ in range(t):
	n = int(input())
	prime = []
	primes(n)
	p = {}
	for i in prime:
		if i in p.keys():
			p[i] += 1
		else:
			p[i] = 1
	g = list(p.keys())
	if len(g) == 1:
		if p[g[0]] >= 6:
			print('YES')
			p1 = p[g[0]] - 2
			print(g[0], g[0] ** 2, g[0] ** (p[g[0]] - 3))
		else:
			print('NO')
		continue
	if len(g) == 2:
		if p[g[0]] + p[g[1]] > 3:
			print('YES')
			n1 = g[0]
			n2 = g[1]
			p1 = p[g[0]]
			p2 = p[g[1]]
			print(n1, n2, pow(n1, p1 - 1) * pow(n2, p2 - 1))
		else:
			print('NO')
	else:
		print('YES')
		ans = pow(g[0], p[g[0]] - 1) * pow(g[1], p[g[1]] - 1)
		for i in range(2, len(g)):
			ans *= pow(g[i], p[g[i]])
		print(g[0], g[1], ans)


for i in range(0, int(input())):
	n = int(input())
	f1 = 0
	f2 = 0
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			k = i
			f1 = 1
			break
	if f1 == 1:
		n = int(n / k)
		root = int(n ** 0.5)
		k1 = k
		for i in range(2, root + 1):
			if n % i == 0 and i * i != n and (i != k1):
				k = i
				f2 = 1
				break
		if f2 == 1:
			print('YES')
			print(k1, k, int(n / k))
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	l = []
	i = 2
	while len(l) < 2 and n > i ** 2:
		if n % i == 0:
			l.append(i)
			n = n / i
		i += 1
	if len(l) == 2 and n not in l:
		print('YES')
		print(*l, int(n))
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	k = 2
	i = k
	a = -1
	b = -1
	c = -1
	while i <= n / k:
		k += 1
		if n % i == 0:
			a = i
			x = n / a
			break
		else:
			i = k
	if a == -1:
		print('NO')
	else:
		k = 3
		i = k
		while i <= x / k:
			k += 1
			if x % i == 0 and i != a:
				b = i
				c = x // b
				c = int(c)
				break
			else:
				i = k
		if b == -1 or c == -1:
			print('NO')
		elif a == c or b == c or a == b:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


for _ in range(int(input())):
	n = int(input())
	c = []
	i = 2
	while len(c) < 2 and i ** 2 < n:
		if n % i == 0:
			c.append(i)
			n = n // i
		i += 1
	if len(c) == 2 and n not in c:
		print('YES')
		print(*c, n)
	else:
		print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	lists = []
	i = 2
	while len(lists) < 2 and i * i < n:
		if n % i == 0:
			lists.append(i)
			n //= i
		i += 1
	if len(lists) == 2 and n not in lists:
		print('YES')
		print(*lists, n)
	else:
		print('NO')


import math

def function(num):
	var = int(math.sqrt(num)) + 1
	for i in range(2, var + 1):
		if num % i == 0 and num // i != i:
			return list((i, num // i))
t = int(input())
for _ in range(t):
	count = 0
	n = int(input())
	num = int(math.sqrt(n)) + 1
	for i in range(2, num):
		if n % i == 0:
			func = function(n // i)
			if func == None:
				pass
			elif len(set([i, func[0], func[1]])) == 3:
				count = 1
				print('YES')
				print('{} {} {}'.format(i, func[0], func[1]))
				break
			else:
				pass
	if count == 0:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = []
	for i in range(2, n):
		if i * i >= n:
			break
		if n % i == 0:
			ans.append(i)
			n //= i
		if len(ans) == 2:
			ans.append(n)
			break
	if len(ans) == 3:
		print('YES')
		print(*ans)
	else:
		print('NO')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
for _ in range(n):
	num = ii1()
	res = []
	for i in range(2, int(sqrt(num)) + 1):
		if num % i == 0:
			num //= i
			res.append(i)
		if len(res) == 2 and num > 2:
			res.append(num)
			if len(set(res)) == 3:
				print('YES')
				print(*res)
				break
	else:
		print('NO')


import sys
t = int(input())
for i in range(t):
	n = int(input())
	i = 2
	flag = 0
	while i ** 2 <= n:
		if n % i == 0:
			a = i
			j = 2
			while j ** 2 <= n // a:
				if n // a % j == 0:
					b = n // a // j
					c = n // a // b
					if a != b and a != c and (b != c):
						flag = 1
						break
				j += 1
		i += 1
		if flag:
			print('YES')
			print(a, b, c)
			break
	if not flag:
		print('NO')


import math

def primeFactors(n):
	arr = []
	while n % 2 == 0:
		arr.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			arr.append(i)
			n = n / i
	if n > 2:
		arr.append(n)
	return arr
t = int(input())
for _ in range(t):
	n = int(input())
	arr = primeFactors(n)
	if len(arr) >= 3:
		a = arr[0]
		if arr[0] != arr[1]:
			b = arr[1]
			c = n // (a * b)
			if c == a or c == b or c < 2:
				print('NO')
			else:
				print('YES')
				print(a, b, c)
		else:
			b = arr[1] * arr[2]
			c = n // (a * b)
			if c == a or c == b or c < 2:
				print('NO')
			else:
				print('YES')
				print(a, b, c)
	else:
		print('NO')


def solve(n, i):
	a = -1
	b = -1
	while i * i <= n:
		if n % i == 0:
			a = i
			b = n // i
			if a == b:
				a = -1
				b = -1
			break
		i += 1
	return (a, b)
for t in range(int(input())):
	n = int(input())
	(a, b) = solve(n, 2)
	if a == -1:
		print('NO')
	else:
		(b, c) = solve(b, a + 1)
		if b == -1:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p
p = sieve(32000)
for _ in range(ii()):
	z = ii()
	n = z
	a = []
	i = 0
	while n > 1:
		if not n % p[i]:
			n //= p[i]
			a.append(p[i])
		else:
			i += 1
			if p[i] ** 2 > z:
				break
	if n > 1:
		a.append(n)
	f = 0
	if len(a) > 2:
		ans = [a[0]]
		c = a[1]
		x = 2
		if c == ans[0]:
			c *= a[2]
			x = 3
		ans.append(c)
		c = 1
		if x < len(a):
			for i in a[x:]:
				c *= i
			if c != ans[0] and c != ans[1]:
				ans.append(c)
				ans.sort()
				f = 1
	if f:
		print('YES')
		print(*ans)
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	f = set()
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			f.add(i)
			f.add(n // i)
	flag = 0
	for i in f:
		x = n // i
		for j in f:
			if x % j == 0:
				z = [i, x // j, j]
				p = i * j * (x // j)
				if len(set(z)) == 3 and p == n and (i != 1) and (x != 1) and (x // j != 1):
					flag = 1
					break
		if flag == 1:
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		print(*z)


import math

def solution(n):
	a = 0
	b = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			n //= i
			break
	if a:
		for j in range(a + 1, int(math.sqrt(n)) + 1):
			if n % j == 0:
				b = j
				n //= j
				break
	if a and b and (b != n):
		print('YES')
		print(f'{a} {b} {n}')
	else:
		print('NO')
t = int(input())
kls = [int(input()) for _ in range(t)]
for k in kls:
	solution(k)


import math
t = int(input())
L = []
for i in range(t):
	L += [int(input())]

def multiples(n):
	i = 2
	while i <= math.floor(n ** (1.0 / 3.0)):
		if n % i == 0:
			j = i + 1
			k = n / i
			while j <= math.sqrt(k):
				if k % j == 0 and j != math.sqrt(k):
					return '\n' + 'YES' + '\n' + str(i) + ' ' + str(j) + ' ' + str(int(k / j))
				j += 1
		i += 1
	return '\n' + 'NO'
for l in L:
	print(multiples(l))


def abc(num):
	threshold = num ** 0.5
	myDivisors = []
	potentialDiv = 2
	current = num
	while potentialDiv <= threshold and current != 1:
		if current // potentialDiv == current / potentialDiv:
			myDivisors.append(potentialDiv)
			current /= potentialDiv
		potentialDiv += 1
		if len(myDivisors) >= 2 and current not in myDivisors:
			myDivisors.append(int(current))
			return myDivisors
	if len(myDivisors) >= 3 and current == 1:
		return myDivisors
	else:
		return False
repeat = int(input())
for i in range(0, repeat):
	temp = abc(int(input()))
	if temp:
		for i in range(0, len(temp)):
			for j in range(i + 1, len(temp)):
				if temp[i] * temp[j] not in temp and len(temp) > 3:
					temp[i] *= temp[j]
					temp[j] = 1
		safiye = []
		for x in temp:
			if x != 1:
				safiye.append(x)
		if len(safiye) == 3:
			print('YES')
			for x in safiye:
				print(x, end=' ')
		else:
			print('NO')
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	dic = {}
	x = n
	if x % 2 == 0:
		dic[2] = 0
		while x % 2 == 0:
			x //= 2
			dic[2] += 1
	for i in range(3, int(math.sqrt(x)) + 1, 2):
		if x % i == 0:
			dic[i] = 0
			while x % i == 0:
				x //= i
				dic[i] += 1
	if x > 2:
		dic[x] = 1
	if len(dic) == 3:
		print('YES')
		ans = []
		for i in dic:
			ans += [pow(i, dic[i])]
		print(*ans)
	elif len(dic) > 3:
		print('YES')
		ans = []
		c = 0
		for i in dic:
			ans += [pow(i, dic[i])]
			c += 1
			dic[i] = 0
			if c == 3:
				break
		t = 1
		for i in dic:
			t *= pow(i, dic[i])
		ans[-1] *= t
		print(*ans)
	elif len(dic) == 2:
		s = 0
		for i in dic:
			s += dic[i]
		if s >= 4:
			print('YES')
			ans = []
			b = 1
			for i in dic:
				ans += [i]
				b *= pow(i, dic[i] - 1)
			ans += [b]
			print(*ans)
		else:
			print('NO')
	else:
		for i in dic:
			if dic[i] >= 6:
				print('YES')
				print(i, pow(i, 2), pow(i, dic[i] - 3))
			else:
				print('NO')


from itertools import combinations
from math import sqrt
for _ in range(int(input())):
	l = []
	n = int(input())
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i != i:
				l.append(i)
				l.append(n // i)
			else:
				l.append(i)
	if len(l) < 3:
		print('NO')
	else:
		k = combinations(l, 3)
		for i in k:
			if i[0] * i[1] * i[2] == n:
				print('YES')
				print(i[0], i[1], i[2])
				break
		else:
			print('NO')


import collections

def findDistinctTree(n):
	queue = collections.deque()
	queue.append(2)
	i = 2
	while True:
		if queue:
			i = queue.popleft()
		else:
			i += 1
		if i >= n // i:
			print('NO')
			return
		if n % i != 0:
			continue
		m = n // i
		for j in range(i + 1, m):
			if n % j == 0:
				queue.append(j)
			if j >= m / j:
				break
			if m % j != 0:
				continue
			print('YES')
			print('{} {} {}'.format(i, j, m // j))
			return
	print('NO')
	return
N = int(input())
cases = []
for _ in range(N):
	n = int(input())
	cases.append(n)
for case in cases:
	findDistinctTree(case)


import math
t = int(input())
for q in range(t):
	n = int(input())
	m = n
	fact = []
	while m % 2 == 0:
		fact.append(2)
		m = m / 2
	for i in range(3, int(math.sqrt(m)) + 1, 2):
		while m % i == 0:
			fact.append(i)
			m = m / i
	if m > 2:
		fact.append(m)
	dist = list(set(fact))
	if len(dist) == 1:
		if fact.count(dist[0]) > 4:
			o = dist[0]
			t = dist[0] * dist[0]
			if n / (o * t) > 2 and int(n / (o * t)) != o and (int(n / (o * t)) != t):
				print('YES')
				print(int(o), int(t), int(n / (o * t)))
			else:
				print('NO')
		else:
			print('NO')
	elif len(dist) == 2:
		o = dist[0]
		t = dist[1]
		if fact.count(o) + fact.count(t) >= 4:
			if n / (o * t) > 2 and int(n / (o * t)) != o and (int(n / (o * t)) != t):
				print('YES')
				print(int(o), int(t), int(n / (o * t)))
			else:
				print('NO')
		else:
			print('NO')
	if len(dist) > 2:
		o = dist[0]
		t = dist[1]
		if n / (o * t) > 2 and int(n / (o * t)) != o and (int(n / (o * t)) != t):
			print('YES')
			print(int(o), int(t), int(n // (o * t)))
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = 2
	tr = False
	cnt = 0
	ans = []
	while a * a <= n and cnt < 2:
		if n % a == 0:
			n = n // a
			ans.append(a)
			cnt += 1
		a += 1
	ans.append(n)
	if len(ans) == 3 and ans[1] < ans[2]:
		print('YES')
		print(*ans)
	else:
		print('NO')


import math

def primeFactors(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
for _ in range(int(input())):
	n = int(input())
	ar = []
	l = primeFactors(n, ar)
	s = []
	s = set(s)
	temp = 1
	for i in l:
		temp *= i
		if temp not in s and len(s) < 2:
			s.add(temp)
			temp = 1
	if temp != 1:
		s.add(temp)
	if len(s) > 2:
		print('YES')
		s = list(s)
		for i in s:
			print(i, end=' ')
	else:
		print('NO', end=' ')
	print()


from math import sqrt

def check(n):
	k = 0
	for i in range(2, int(sqrt(n + 1))):
		if k == 2 and n >= i:
			return (a, b, n)
		if k == 3:
			return (a, b, c)
		if k < 3 and n < i:
			return 'NO'
		if n % i == 0:
			k += 1
			n //= i
			if k == 1:
				a = i
			elif k == 2:
				b = i
			elif k == 3:
				c = i
	return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	out = check(n)
	if type(out) == str:
		print(out)
	else:
		print('YES')
		for x in list(out):
			print(x, end=' ')
		print()


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
import math

def printDivisors(n):
	a = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				a.append(i)
			else:
				a.append(i)
				a.append(n // i)
		i = i + 1
	return a
for i in range(I()):
	n = I()
	a = printDivisors(n)
	d = Counter(a)
	for i in a:
		f = 0
		if i == 1 or i == n:
			continue
		p = n // i
		j = 1
		while j <= math.sqrt(p):
			if p % j == 0 and j != 1 and (j in d) and (p // j in d) and (j != i) and (i != p // j) and (j != p // j) and (j != p):
				print('YES')
				print(i, j, p // j)
				f = 1
				break
			j += 1
		if f == 1:
			break
	if f == 0:
		print('NO')


n = int(input())
for _ in range(n):
	ans = []
	x = int(input())
	f = 2
	while len(ans) < 2 and f ** 2 < x:
		if x % f == 0:
			ans.append(f)
			x //= f
		f += 1
	if len(ans) == 2 and x > ans[1]:
		print('YES')
		print(ans[0], ans[1], x)
	else:
		print('NO')


from math import sqrt
n = int(input())
for i in range(n):
	m = int(input())
	m1 = m
	c = 2
	p = []
	while len(p) < 3 and c <= sqrt(m1):
		if m % c == 0:
			m = m // c
			p.append(c)
		else:
			c = c + 1
	if len(p) == 3:
		if p[0] == p[1]:
			p[1] = p[1] * p[2]
		p[2] = m1 // p[0] // p[1]
	if len(p) == 2:
		p.append(m1 // p[0] // p[1])
	if len(p) == 3 and p[2] > 1 and (p[0] != p[2]) and (p[1] != p[2]) and (p[0] != p[1]):
		print('YES')
		print(*p)
	else:
		print('NO')


d = int(input())
ans = [[0] * 3] * d
for i in range(d):
	n = int(input())
	k = int(n ** (1 / 3)) + 1
	f = True
	j = 2
	while j < k and f:
		if n % j == 0:
			l = n // j
			x = j
			while x < int(l ** 0.5) + 1 and f:
				x += 1
				if l % x == 0 and x != l // x and (j != l // x):
					ans[i] = [j, x, l // x]
					f = False
		j += 1
	if f == True:
		ans[i][0] = -1
for i in range(d):
	if ans[i][0] != -1:
		print('YES')
		print(ans[i][0], ans[i][1], ans[i][2])
	else:
		print('NO')


t = int(input().strip())
import math

def primeFactors(n):
	ans = []
	while n % 2 == 0:
		ans.append(2)
		n = n // 2
	result = int(math.sqrt(n))
	for i in range(3, result + 1, 2):
		while n % i == 0:
			ans.append(i)
			n = n // i
	if n > 2:
		ans.append(n)
	return ans
for _ in range(t):
	n = int(input().strip())
	ans = primeFactors(n)
	ts = set(ans)
	if len(ts) == 3 and len(ts) == len(ans):
		a = ans[0]
		b = ans[1]
		c = 1
		for i in range(2, len(ans)):
			c *= ans[i]
		print('YES')
		print(a, b, c)
	elif len(ts) >= 2 and len(ans) >= 4:
		a = ts.pop()
		b = ts.pop()
		c = 1
		for i in range(len(ans)):
			if ans[i] == a:
				ans[i] = 1
				break
		for i in range(len(ans)):
			if ans[i] == b:
				ans[i] = 1
				break
		for i in range(len(ans)):
			c *= ans[i]
		print('YES')
		print(a, b, c)
	elif len(ts) >= 1 and len(ans) >= 6:
		a = ans[0]
		b = ans[1] * ans[2]
		c = 1
		for i in range(3, len(ans)):
			c *= ans[i]
		print('YES')
		print(a, b, c)
	else:
		print('NO')


def solution(s):
	nums = []
	i = 2
	while len(nums) < 2 and i ** 2 <= s:
		if s % i == 0 and i not in nums:
			nums.append(i)
			s //= i
		i += 1
	if s not in nums and len(nums) == 2:
		print('YES')
		print(*nums, s)
	else:
		print('NO')
t = int(input())
while t > 0:
	t -= 1
	s = int(input())
	solution(s)


from math import ceil, gcd, trunc
from bisect import bisect_left as bl
from bisect import bisect_right as br
from array import array
from collections import Counter as ctr

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

def arr(a):
	return array('i', a)

def temp():
	print(int(input()))

def smstdiv(a, b=1):
	for i in range(2, ceil(a ** 0.5)):
		if a % i == 0 and i != b:
			return i
	return -1

def solve():
	for _ in range(int(input())):
		n = int(input())
		sd = smstdiv(n)
		if sd > 0:
			sd2 = smstdiv(n // sd, sd)
			if sd2 > 0:
				print('YES')
				print(sd, sd2, n // (sd * sd2))
			else:
				print('NO')
		else:
			print('NO')
solve()


from sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	cases = int(input())
	for line in stdin:
		n = int(line)
		ans = []
		f1 = 2
		while f1 <= math.sqrt(n):
			if n % f1 == 0:
				ans.append(f1)
				break
			f1 += 1
		if len(ans) == 0:
			print('NO')
			continue
		m = n // f1
		f2 = f1 + 1
		while f2 <= math.sqrt(m):
			if m % f2 == 0:
				ans.append(f2)
				break
			f2 += 1
		if len(ans) == 1:
			print('NO')
			continue
		f3 = n // (f1 * f2)
		if f3 not in {f1, f2}:
			print('YES')
			print(*[f1, f2, f3])
		else:
			print('NO')
main()


from collections import deque
import sys

def inp():
	return sys.stdin.readline().strip()
for _ in range(int(inp())):
	n = int(inp())
	i = 2
	fac = set()
	while i * i <= n:
		if n % i == 0:
			x = n // i
			fac.add(i)
			fac.add(x)
		i += 1
	fac = sorted(fac)
	if len(fac) < 3:
		print('NO')
		continue
	f = False
	for i in range(len(fac)):
		for j in range(i + 1, len(fac)):
			x = fac[i]
			y = fac[j]
			z = n // (x * y)
			if x != y and y != z and (z >= 2) and (x != z) and (x * y * z == n):
				f = True
				break
		if f:
			break
	if f:
		print('YES')
		print(x, y, z)
	else:
		print('NO')


from math import sqrt
n = int(input())
s = 32000
lst = [2]
for i in range(3, s + 1, 2):
	if i > 10 and i % 10 == 5:
		continue
	for j in lst:
		if j * j - 1 > i:
			lst.append(i)
			break
		if i % j == 0:
			break
	else:
		lst.append(i)
for i in range(n):
	m = int(input())
	m1 = m
	p = []
	k = 0
	c = lst[k]
	while len(p) < 3 and c <= sqrt(m1):
		if m % c == 0:
			m = m // c
			p.append(c)
		else:
			k = k + 1
			c = lst[k]
	if len(p) == 3:
		if p[0] == p[1]:
			p[1] = p[1] * p[2]
		p[2] = m1 // p[0] // p[1]
	if len(p) == 2:
		p.append(m1 // p[0] // p[1])
	if len(p) == 3 and p[2] > 1 and (p[0] != p[2]) and (p[1] != p[2]) and (p[0] != p[1]):
		print('YES')
		print(*p)
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	d = {}
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i not in d:
			d[i] = 1
			n = n // i
			break
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i not in d:
			d[i] = 1
			n = n // i
			break
	if len(d) < 2 or n in d or n == 1:
		print('NO')
	else:
		print('YES')
		d[n] = 1
		for (key, value) in d.items():
			print(key, end=' ')
		print()


def findTripple(n):
	res = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			n //= i
		if len(res) == 2:
			break
	if n != 1:
		if res:
			if n not in res:
				res.append(n)
	return res
t = int(input())
for test in range(t):
	n = int(input())
	res = findTripple(n)
	if len(res) == 3:
		print('YES')
		print(' '.join([str(item) for item in res]))
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	r = math.ceil(math.sqrt(n)) + 1
	ou = []
	for i in range(2, r):
		if len(ou) == 2:
			break
		elif n % i == 0:
			n = n // i
			ou.append(i)
	if n > 1 and len(ou) == 2 and (n not in ou):
		print('YES')
		print(n, *ou)
	else:
		print('NO')


import sys

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

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

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	a = []
	nn = n
	for i in range(2, n + 1):
		if i * i > n:
			break
		if n % i == 0:
			c = 0
			while n % i == 0:
				n //= i
				if len(a) == 2:
					break
				c += 1
			a.append((i, c))
	if n != 1:
		a.append((n, 1))
	if len(a) == 1:
		if a[0][1] < 6:
			print('NO')
		else:
			print('YES')
			print(a[0][0], a[0][0] ** 2, nn // a[0][0] ** 3)
	elif len(a) == 2:
		if a[0][1] > 1 and a[1][1] > 1:
			print('YES')
			print(a[0][0], a[1][0], nn // (a[0][0] * a[1][0]))
		elif a[0][1] > 2:
			print('YES')
			print(a[0][0], a[0][0] ** 2, nn // a[0][0] ** 3)
		elif a[1][1] > 2:
			print('YES')
			print(a[1][0], a[1][0] ** 2, nn // a[1][0] ** 3)
		else:
			print('NO')
	else:
		print('YES')
		print(a[0][0], a[1][0], nn // (a[0][0] * a[1][0]))
for i in range(mint()):
	solve()


import math

def pd(n, not_include):
	li = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				if n != not_include:
					lis = []
					lis.append(i)
					lis.append(i)
			else:
				lis = []
				if i != not_include and n // i != not_include:
					lis.append(i)
					lis.append(n // i)
					li.append(lis)
	return li
t = int(input())
for wirfb in range(t):
	n = int(input())
	li = pd(n, 1)
	f = 0
	if len(li) >= 1:
		for x in li:
			lis = pd(x[1], x[0])
			if len(lis) >= 1:
				f = 1
				break
			else:
				f = 0
	else:
		f = 0
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(x[0], lis[0][0], lis[0][1])


N = int(input())
for _ in range(N):
	x = int(input())
	d = 2
	ans = []
	for steps in range(2):
		if d > x:
			break
		while d * d <= x:
			if x % d == 0:
				ans.append(d)
				x //= d
				d += 1
				break
			d += 1
	if len(ans) == 2 and x >= d:
		print('YES')
		print(*ans + [x])
	else:
		print('NO')


import sys
from math import ceil, sqrt
t = int(sys.stdin.readline())

def factor(n):
	pf = {}
	maxp = min(n - 1, ceil(sqrt(n)))
	nf = n
	for p in range(2, maxp + 1):
		if nf == 1:
			break
		while nf % p == 0:
			nf //= p
			if p in pf:
				pf[p] += 1
			else:
				pf[p] = 1
	if nf > 1:
		if nf in pf:
			pf[nf] += 1
		else:
			pf[nf] = 1
	pf = list(pf.items())
	if len(pf) == 1:
		if pf[0][1] >= 6:
			print('YES')
			frac = n // pf[0][0] ** 3
			print(pf[0][0], pf[0][0] ** 2, frac)
		else:
			print('NO')
	elif len(pf) == 2:
		if pf[0][1] >= 2 and pf[1][1] >= 2:
			print('YES')
			frac = n // (pf[0][0] * pf[1][0])
			print(pf[0][0], pf[1][0], frac)
		elif pf[0][1] == 1 and pf[1][1] >= 3 or (pf[0][1] >= 3 and pf[1][1] == 1):
			print('YES')
			frac = n // (pf[0][0] * pf[1][0])
			print(pf[0][0], pf[1][0], frac)
		else:
			print('NO')
	else:
		print('YES')
		frac = n // (pf[0][0] * pf[1][0])
		print(pf[0][0], pf[1][0], frac)
for i in range(t):
	n = int(sys.stdin.readline())
	factor(n)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	dr = n
	i = 2
	primes = defaultdict(int)
	while i * i <= n:
		while dr % i == 0:
			primes[i] += 1
			dr //= i
		i += 1
	if dr != 1:
		primes[dr] += 1
	if len(primes) >= 3:
		print('YES')
		i = 0
		for par in primes:
			print(par, end=' ')
			n //= par
			i += 1
			if i == 2:
				break
		print(n)
	elif len(primes) == 2:
		primes = [(k, v) for (k, v) in primes.items()]
		if primes[0][1] == 1:
			if primes[1][1] <= 2:
				print('NO')
				continue
			else:
				print('YES')
				print(primes[0][0], primes[1][0], n // (primes[0][0] * primes[1][0]))
		elif primes[1][1] == 1:
			if primes[0][1] <= 2:
				print('NO')
				continue
			else:
				print('YES')
				print(primes[0][0], primes[1][0], n // (primes[0][0] * primes[1][0]))
		else:
			print('YES')
			print(primes[0][0], primes[1][0], n // (primes[0][0] * primes[1][0]))
	else:
		primes = [(k, v) for (k, v) in primes.items()]
		primes = primes[0]
		if primes[1] >= 6:
			print('YES')
			print(primes[0], primes[0] ** 2, n // primes[0] ** 3)
		else:
			print('NO')


for _ in [0] * int(input()):
	n = int(input())
	i = 2
	tt = False
	delim = []
	while i * i <= n:
		if not n % i:
			delim.append(i)
		i += 1
	for i in range(len(delim)):
		if tt == True:
			break
		for j in range(i + 1, len(delim)):
			f = n // (delim[i] * delim[j])
			if f > 1 and f not in (delim[i], delim[j]) and (not n % (delim[i] * delim[j])):
				tt = True
				print('YES')
				print(delim[i], delim[j], f)
				break
	if tt == False:
		print('NO')


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

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

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

def main():
	n = int(input())
	num1 = 2
	l = math.ceil(n ** (1 / 3))
	while num1 <= l:
		num2 = l
		while n % num1 == 0 and num2 <= l * l:
			if n % (num1 * num2) == 0:
				num3 = n // (num1 * num2)
				if num3 != 1 and num1 != num3 and (num2 != num3) and (num1 != num2):
					print('YES')
					print(num1, num2, num3)
					return
			num2 += 1
		num1 += 1
	num1 = 2
	while num1 <= l:
		num2 = num1 + 1
		while n % num1 == 0 and num2 <= l:
			if n % (num1 * num2) == 0:
				num3 = n // (num1 * num2)
				if num3 != 1 and num1 != num3 and (num2 != num3) and (num1 != num2):
					print('YES')
					print(num1, num2, num3)
					return
			num2 += 1
		num1 += 1
	print('NO')
	return
t = int(input())
for _ in range(t):
	main()


import math

def primefact(n):
	c = 0
	l = []
	while n % 2 == 0:
		c = c + 1
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			c = c + 1
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
		c = c + 1
	return l
t = int(input())
for i in range(t):
	temp = []
	n = int(input())
	temp = primefact(n)
	dic = {}
	for j in temp:
		if j in dic:
			dic[j] = dic[j] + 1
		else:
			dic[j] = 1
	if len(dic) == 1:
		for k in dic:
			if dic[k] >= 6:
				print('YES')
				print(k * 1, k * 2, int(math.pow(k, dic[k] - 3)))
			else:
				print('NO')
	elif len(dic) == 2:
		k = list(dic.keys())
		if dic[k[0]] >= 2 and dic[k[1]] >= 2:
			print('YES')
			print(k[0], int(math.pow(k[0], dic[k[0]] - 1) * math.pow(k[1], dic[k[1]] - 1)), k[1])
		elif dic[k[0]] >= 3:
			print('YES')
			print(k[0], int(math.pow(k[0], dic[k[0]] - 1)), k[1])
		elif dic[k[1]] >= 3:
			print('YES')
			print(k[0], int(math.pow(k[1], dic[k[1]] - 1)), k[1])
		else:
			print('NO')
	elif len(dic) >= 3:
		print('YES')
		k = list(dic.keys())
		print(int(math.pow(k[0], dic[k[0]])), end=' ')
		print(int(math.pow(k[1], dic[k[1]])), end=' ')
		p = 1
		for j in range(2, len(k)):
			p = p * math.pow(k[j], dic[k[j]])
		print(int(p))
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	a = 0
	b = 0
	n = int(input())
	for j in range(int(math.sqrt(n)) - 1):
		if n % (j + 2) == 0:
			n = n // (j + 2)
			a = j + 2
			break
	if a == 0:
		print('NO')
	elif a != 0:
		for j in range(int(math.sqrt(n)) - 2):
			if n % (j + 3) == 0 and j + 3 != a:
				n = n // (j + 3)
				if n != j + 3:
					b = j + 3
					break
		if b == 0:
			print('NO')
		else:
			print('YES')
			print(a, b, n)


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

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

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
for _ in range(I()):
	n = I()
	div = []
	n2 = n
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			div.append(i)
			n /= i
	if n > 1:
		div.append(n)
	if len(div) < 3 or n2 // (div[0] * div[1]) == div[0] or n2 // (div[0] * div[1]) == div[1]:
		print('NO')
	else:
		print('YES')
		print(div[0], div[1], n2 // (div[0] * div[1]))


import math

def prod(li):
	p = 1
	for i in li:
		p *= i
	return p

def getAns(n):
	d = dict()
	while n % 2 == 0:
		if 2 in d.keys():
			d[2] += 1
		else:
			d[2] = 1
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 3, 2):
		while n % i == 0:
			if i in d.keys():
				d[i] += 1
			else:
				d[i] = 1
			n //= i
	if n > 2:
		d[n] = 1
	k = list(d.keys())
	if len(k) >= 3:
		a = k[0] ** d[k[0]]
		b = k[1] ** d[k[1]]
		c = prod([k[i] ** d[k[i]] for i in range(2, len(k))])
	elif len(k) == 2:
		if d[k[0]] >= 3:
			a = k[0]
			b = k[0] ** (d[k[0]] - 1)
			c = k[1] ** d[k[1]]
		elif d[k[1]] >= 3:
			a = k[0] ** d[k[0]]
			b = k[1]
			c = k[1] ** (d[k[1]] - 1)
		elif d[k[1]] == 2 and d[k[0]] == 2:
			a = k[0]
			b = k[1]
			c = k[0] * k[1]
		else:
			return (False, -1, -1, -1)
	elif d[k[0]] >= 6:
		a = k[0]
		b = k[0] * k[0]
		c = k[0] ** (d[k[0]] - 3)
	else:
		return (False, -1, -1, -1)
	return (True, a, b, c)
for _ in range(int(input())):
	n = int(input())
	(truth, a, b, c) = getAns(n)
	if truth:
		print('YES')
		print(*sorted([a, b, c]))
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	r = 0
	b = 1
	while 1:
		p = 0
		for j in range(b + 1, a + 1):
			if a // j <= j:
				p = 1
				break
			elif a % j == 0:
				if r == 1:
					c = j
					d = a // j
					p = 1
					r += 2
					break
				else:
					b = j
					a = a // b
					r += 1
		if p == 1:
			break
	if r == 3:
		print('yes'.upper())
		print(b, c, d)
	else:
		print('no'.upper())


t = int(input())

def factor(n):
	arr = set({})
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			arr.add(i)
			arr.add(int(n / i))
	return arr

def find(n, arr):
	for a in arr:
		for b in arr:
			for c in arr:
				if a != b and b != c and (a != c) and (a * b * c == n):
					print('YES')
					return str(a) + ' ' + str(b) + ' ' + str(c)
	return 'NO'
for _ in range(t):
	n = int(input())
	arr = factor(n)
	print(find(n, arr))


from math import *
for _ in range(int(input())):
	n = int(input())
	e = []
	a = False
	for i in range(2, int(sqrt(n)) + 1):
		m = n / i
		if m.is_integer() == True:
			for j in range(2, int(sqrt(m)) + 1):
				if m % j == 0:
					if (n / (i * j)).is_integer() == True and i != j and (j != n / (i * j)) and (n / (i * j) != i):
						e.append([i, j, int(n / (i * j))])
						a = True
						break
	if a == False:
		print('NO')
	else:
		print('YES')
		print(*e[0])


for t in range(int(input())):
	n = int(input())
	try:
		a = next((i for i in range(2, int(n ** 0.5) + 1) if n % i == 0))
		n //= a
		b = next((i for i in range(a + 1, int(n ** 0.5) + 1) if n % i == 0))
		if n // b <= b:
			raise
		else:
			print('YES')
			print(a, b, n // b)
	except:
		print('NO')


from math import ceil

def find(n, p, ans):
	for i in range(2, ceil(n ** (1 / p)) + 1, 1):
		if n % i == 0:
			if p == 3:
				ans += find(n // i, 2, [i])
				if len(ans) == 3:
					return ans
				ans = []
			elif p == 2 and n // i > 1:
				new = ans + [n // i, i]
				if len(set(new)) == 3:
					return new
	return ans
for i in range(int(input())):
	n = int(input())
	k = find(n, 3, [])
	if len(k) == 3:
		print('YES')
		print(*k, sep=' ')
	else:
		print('NO')


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	if n < 24:
		cout('NO\n')
		continue
	y = int(n ** 0.5)
	l = []
	for i in range(2, y + 1):
		if not n % i:
			l += [i, n // i]
	if len(l) < 4:
		cout('NO\n')
		continue
	l.sort()
	for i in range(len(l)):
		if not n % (l[i] * l[i + 1]) and l[i] * l[i + 1] < n and (n // (l[i] * l[i + 1]) != l[i] and n // (l[i] * l[i + 1]) != l[i + 1]):
			cout('YES\n')
			cout(str(l[i]) + ' ' + str(l[i + 1]) + ' ' + str(n // (l[i] * l[i + 1])) + '\n')
			break
		elif l[i] * l[i + 1] >= n:
			cout('NO\n')
			break


from math import sqrt

def main():

	def solve():
		n = int(input())
		a = 0
		if n % 2 == 0:
			a = 2
		else:
			for i in range(3, int(n ** (1.0 / 3)) + 1, 2):
				if n % i == 0:
					a = i
					break
		if a == 0:
			print('NO')
			return
		b = 0
		for i in range(a + 1, int(sqrt(n // a)) + 1):
			if n // a % i == 0:
				b = i
				break
		if b == 0:
			print('NO')
			return
		c = n // (a * b)
		if b == c:
			print('NO')
			return
		print('YES')
		print(a, b, c)
	q = int(input())
	for _ in range(q):
		solve()
main()


def main():
	n = int(input())
	a = 2
	while a * a * a < n:
		if n % a == 0:
			b = a + 1
			while b * b < n // a:
				if n // a % b == 0:
					c = n // a // b
					if a != c and b != c:
						print('YES')
						print(a, b, n // a // b)
						return 0
				b += 1
		a += 1
	print('NO')
p = int(input())
for i in range(p):
	main()


c = int(input())

def handleCase(n):
	cap = int(n ** 0.4) + 1
	for i in range(2, cap):
		if n % i == 0:
			q = n // i
			for j in range(i + 1, int(q ** 0.5) + 1):
				if q % j == 0 and (not q == j * j):
					return str(i) + ' ' + str(j) + ' ' + str(n // i // j)
for _ in range(c):
	n = int(input())
	ans = handleCase(n)
	if ans:
		print('YES')
		print(ans)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	p = tuple((n, 1))
	lt = []
	while n % 2 == 0:
		lt.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			(lt.append(i),)
			n = n / i
	if n > 2:
		lt.append(int(n))
	if len(lt) > 5:
		print('YES')
		print(lt[0], end=' ')
		print(lt[1] * lt[2], end=' ')
		print(int(p[0] / (lt[0] * lt[1] * lt[2])))
	if len(lt) < 3:
		print('NO')
		continue
	if len(lt) == 3:
		if lt[0] == lt[1] or lt[1] == lt[2] or lt[0] == lt[2]:
			print('NO')
			continue
		else:
			print('YES')
			print(lt[0], end=' ')
			print(lt[1], end=' ')
			print(lt[2])
			continue
	if len(lt) == 4:
		a = lt[0]
		b = lt[1] * lt[2]
		c = lt[3]
		if a != b and b != c and (c != a):
			print('YES')
			print(a, end=' ')
			print(b, end=' ')
			print(c)
			continue
		else:
			print('NO')
			continue
	if len(lt) == 5:
		if len(set(lt)) == 1:
			print('NO')
			continue
		if len(set(lt)) == 2:
			if lt[0] == lt[1] == lt[2] == lt[3]:
				print('YES')
				print(lt[0], end=' ')
				print(lt[0] ** 3, end=' ')
				print(lt[-1])
				continue
			elif lt[0] == lt[1] == lt[2] and lt[3] == lt[4]:
				print('YES')
				print(lt[0], lt[1] * lt[2], lt[3] * lt[4])
			elif lt[0] == lt[1] and lt[2] == lt[3] == lt[4]:
				print('YES')
				print(lt[0] ** 2, lt[2], lt[2] ** 2)
			else:
				print('YES')
				print(lt[0], end=' ')
				print(lt[1] ** 3, end=' ')
				print(lt[1])
				continue
		if len(set(lt)) == 3:
			if lt[0] == lt[1] == lt[2]:
				print('YES')
				print(lt[0] ** 3, lt[-2], lt[-1])
				continue
			if lt[1] != lt[0] and lt[2] == lt[1] and (lt[3] == lt[4]):
				print('YES')
				print(lt[0], lt[1] * lt[2], lt[3] * lt[4])
				continue
			if lt[0] == lt[1] and lt[3] == lt[4]:
				print('YES')
				print(lt[0] * lt[1], lt[2], lt[3] * lt[4])
				continue
			if lt[0] == lt[1] and lt[3] == lt[2]:
				print('YES')
				print(lt[0] * lt[1], lt[2] * lt[3], lt[4])
			if lt[1] == lt[2] == lt[3]:
				print('YES')
				print(lt[0], lt[1] ** 3, lt[-1])
				continue
			if lt[-1] == lt[-2] == lt[-3]:
				print('YES')
				print(lt[0], lt[1], lt[2] ** 3)
				continue
		if len(set(lt)) == 4:
			print('YES')
			print(lt[0], lt[2] * lt[1], lt[3] * lt[4])
			continue
		if len(set(lt)) == 5:
			print('YES')
			print(lt[0], lt[1], lt[2] * lt[3] * lt[4])


for i in range(int(input())):
	n = int(input())
	d = 2
	a = []
	while len(a) < 2 and d * d < n:
		if n % d == 0:
			a.append(d)
			n //= d
		d += 1
	if len(a) < 2:
		print('NO')
	else:
		print('YES')
		print(n, *a)


t = int(input())
while t:
	n = int(input())
	l = []
	i = 2
	c = 0
	while c < 2 and i * i < n:
		if n % i == 0:
			l.append(i)
			n //= i
			c += 1
		i += 1
	if c == 2 and n not in l:
		print('YES')
		print(*l, n)
	else:
		print('NO')
	t -= 1


from sys import stdin

def Prime(d, n):
	if n % d == 0:
		return d
	while d * d <= n:
		if n % d == 0:
			return d
		d = d + 1
	return 0
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	if n < 24:
		print('NO')
		continue
	ans = []
	count = 0
	cond = True
	d = 2
	while count < 2:
		m = Prime(d, n)
		if m == 0:
			cond = False
			break
		else:
			ans.append(m)
			count += 1
			n = n // m
			d = m + 1
	if cond == True:
		if n in ans:
			print('NO')
		else:
			ans.append(n)
			print('YES')
			print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	x = int(input())
	li = []
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0:
			li.append(i)
			x = x // i
			break
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0 and i not in li:
			li.append(i)
			x = x // i
			break
	if len(li) < 2 or x == 1 or x in li:
		print('NO')
	else:
		print('YES')
		print(*li, x)


import math

def div(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				l.append(int(i))
			else:
				l.append(int(i))
				l.append(int(n / i))
		i = i + 1
	l.sort()
	return l
for _ in range(int(input())):
	n = int(input())
	y = n
	l = div(n)
	l = l[::-1]
	o = []
	if len(l) != 0:
		y = y // l[-1]
		x1 = l[-1]
		o.append(l[-1])
		l.pop()
	else:
		print('NO')
		continue
	if len(l) != 0:
		f = 1
		while f == 1 and y % l[-1] != 0:
			l.pop()
			if len(l) == 0:
				f = 0
		if f == 0:
			print('NO')
			continue
		y = y // l[-1]
		o.append(l[-1])
		x2 = l[-1]
		l.pop()
		if len(l) == 0:
			print('NO')
			continue
		if x2 == y or x1 == x2 or x1 == y or (x1 == 1) or (x2 == 1) or (y == 1):
			print('NO')
			continue
		o.append(y)
	else:
		print('NO')
		continue
	cnt = 1
	for i in o:
		cnt = cnt * i
	if cnt == n:
		print('YES')
		for i in o:
			print(i, end=' ')
		print('')
	else:
		print('NO')


import math

def main():
	n = int(input())
	different = [0, 0, 0]
	k = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if k == 2:
			break
		if n % i == 0 and k < 2:
			n = n // i
			different[k] = i
			k += 1
	if n == 1 or n == different[0] or n == different[1] or (different[1] == 0):
		print('NO')
		return
	different[2] = n
	print('YES')
	print(different[0], different[1], different[2])
t = int(input())
for i in range(t):
	main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	n_i = n
	if n < 24:
		print('NO')
	else:
		(a, b, c) = (2, 2, 2)
		sq = int(math.sqrt(n)) + 2
		for i in range(a, sq):
			if n % i == 0:
				a = i
				n = n // a
				sq = int(math.sqrt(n)) + 2
				break
		for i in range(a + 1, sq):
			if n % i == 0:
				b = i
				n = n // b
				break
		c = n
		if c == b or c == 2 or b == 2:
			print('NO')
		elif a == 2 and n_i % 2 != 0:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import math
t = int(input())
for _ in range(t):
	count = 0
	a = []
	n = int(input())
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0 and count < 2:
			n = int(n / i)
			a.append(i)
			count += 1
	if n not in a and n != 1:
		a.append(n)
		count += 1
	if count == 3:
		print('YES')
		for i in a:
			print(i, end=' ')
		print('')
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	a = -99
	t = 0
	if n < 24:
		print('NO')
	else:
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				if a > 0:
					if n % (i * a) == 0:
						if a != i and i != n // (i * a) and (n // (i * a) > 2) and (a != n // (i * a)):
							print('YES')
							print(a, end=' ')
							print(i, end=' ')
							print(n // (i * a))
							t = 1
							break
				else:
					a = i
					if n % (i * a) == 0:
						if a != i and i != n // (i * a) and (n // (i * a) > 2) and (a != n // (i * a)):
							print('YES')
							print(a, end=' ')
							print(i, end=' ')
							print(n // (i * a))
							t = 1
							break
		if t == 0:
			print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	if n < 24:
		print('NO')
		continue
	a = 1
	b = 1
	c = 1
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			break
	n //= a
	for i in range(2, int(math.sqrt(n)) + 1):
		if i != a and n % i == 0:
			b = i
			break
	if b != 1:
		c = n // b
	if a is not b and b is not c and (c is not a):
		print('YES')
		print(a, end=' ')
		print(b, end=' ')
		print(c)
	else:
		print('NO')


ans = ''
for _ in range(int(input())):
	n = nn = int(input())
	l1 = []
	i = 2
	while len(l1) < 2 and i * i <= nn:
		if n % i == 0:
			l1.append(i)
			n //= i
		i += 1
	if len(l1) < 2 or l1[1] == n or l1[0] == n:
		ans += 'NO\n'
	else:
		ans += 'YES\n'
		ans += f'{l1[0]} {l1[1]} {n}\n'
print(ans)


from math import *
for _ in range(int(input())):
	n = int(input())
	ch1 = 1
	ch2 = 1
	a1 = 0
	a2 = 0
	a3 = 0
	g = 0
	for i in range(2, int(sqrt(n) + 1)):
		if n % i == 0:
			a1 = i
			g = n // i
			break
	else:
		ch1 = 0
	if ch1 == 1:
		for i in range(2, int(sqrt(g) + 1)):
			if g % i == 0 and i != a1:
				a2 = i
				a3 = g // i
				if a3 == a1 or a3 == a2:
					continue
				break
		else:
			ch2 = 0
	if ch1 == 0 or ch2 == 0:
		print('NO')
	else:
		print('YES')
		print(a1, a2, a3)


from functools import reduce

def factors(n):
	return sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))))
for _ in range(int(input())):
	N = int(input())
	r = factors(N)
	len_r = len(r)
	tmp = 0
	if len_r - 2 < 3:
		print('NO')
		continue
	for i in range(1, len_r - 1):
		curr_sum = N // r[i]
		for j in range(i + 1, len_r - 1):
			if curr_sum // r[j] in r:
				s = {r[i], r[j], curr_sum // r[j]}
				if len(s) == 3 and 1 not in s:
					print('YES')
					print(r[i], r[j], curr_sum // r[j])
					tmp = 1
					break
		if tmp:
			break
	if not tmp:
		print('NO')


t = int(input())
for i in range(t):
	l = []
	n = int(input())
	for i in range(2, n):
		if n % i == 0:
			l.append(i)
			n /= i
		if len(l) == 2 or i * i > n:
			break
	if len(l) == 2 and n != l[0] and (n != l[1]) and (n > 1):
		print('YES')
		print(l[0], l[1], int(n))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())

	def solve(n):
		ans = []
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				ans.append(i)
				n /= i
				break
		if len(ans) == 0:
			return []
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0 and i != ans[0] and (n / i != ans[0]) and (i != n / i):
				ans.append(i)
				ans.append(int(n / i))
				break
		return ans
	ans = solve(n)
	if len(ans) != 3:
		print('NO')
	else:
		print('YES')
		print(' '.join(list(map(str, ans))))


from math import *
for ct in range(int(input())):
	n = int(input())
	flag = False
	for i in range(2, int(sqrt(n))):
		if flag:
			break
		if n % i == 0:
			par = n // i
			for j in range(2, int(sqrt(par)) + 1):
				if par % j == 0:
					k = par // j
					if i != j and j != k and (i != k):
						print('YES')
						print(i, j, k)
						flag = True
						break
			else:
				for j in range(2, int(sqrt(i)) + 1):
					if i % j == 0:
						k = i // j
						if par != j and j != k and (par != k):
							print('YES')
							print(par, j, k)
							flag = True
							break
	else:
		print('NO')


t = int(input())
for _ in range(t):
	out = []
	n = int(input())
	d = 2
	while d * d <= n:
		if n % d == 0:
			out.append(d)
			n //= d
			if len(out) == 2:
				break
		d += 1
	if len(out) == 2 and n > out[1]:
		print('YES')
		print(out[0], out[1], n)
	else:
		print('NO')


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	ans = -1
	if n < 24:
		print('NO')
		continue
	else:
		root = int(math.sqrt(n))
		factors = set()
		for i in range(2, root + 1):
			if n % i == 0:
				factors.add(i)
				factors.add(n // i)
		for i in factors:
			for j in factors:
				s = n // (i * j)
				if i != j and s in factors:
					if i != s and j != s:
						ans = []
						ans.append(i)
						ans.append(j)
						ans.append(s)
						ans.sort()
						break
			if ans != -1:
				break
	if ans == -1:
		print('NO')
	else:
		print('YES')
		print(*ans)


import sys
import math
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().split())
inl = lambda : list(map(int, input().split()))
t = ini()
ans = []
andsindex = [0] * t
for _ in range(t):
	n = ini()
	i = 2
	tmp = []
	while n >= i * i:
		if i == 5 and n % 5 == 0 and (4 in tmp):
			tmp.remove(4)
		if n % i == 0:
			tmp.append(i)
		if len(tmp) == 3:
			break
		i += 1
	if len(tmp) <= 1:
		ans.append('NO')
	elif len(tmp) >= 2:
		if len(tmp) == 3:
			y = (n / (tmp[0] * tmp[2])).is_integer()
			if tmp[0] * tmp[1] * tmp[2] == n:
				ans.append('YES')
				andsindex[len(ans) - 1] = f'{tmp[0]} {tmp[1]} {tmp[2]}'
				continue
			elif y and n / (tmp[0] * tmp[2]) not in tmp:
				ans.append('YES')
				andsindex[len(ans) - 1] = f'{tmp[0]} {tmp[2]} {n // (tmp[0] * tmp[2])}'
				continue
		x = (n / (tmp[0] * tmp[1])).is_integer()
		if x and n / (tmp[0] * tmp[1]) not in tmp:
			ans.append('YES')
			andsindex[len(ans) - 1] = f'{tmp[0]} {tmp[1]} {n // (tmp[0] * tmp[1])}'
		else:
			ans.append('NO')
for i in range(t):
	print(ans[i])
	if ans[i] == 'YES':
		print(andsindex[i])


t = int(input())

def printDivisors(n, a):
	i = 2
	f = 0
	while i * i <= n:
		if n % i == 0:
			j = i + 1
			n = n // i
			while j * j <= n:
				if n % j == 0:
					if j != n // j:
						print('YES')
						print(i, j, n // j)
						f = 1
						break
				j += 1
			if f == 1:
				break
		i += 1
	if f == 0:
		print('NO')
for _ in range(t):
	a = []
	n = int(input())
	printDivisors(n, a)


import sys
from math import sqrt

def readlines(type=int):
	return list(map(type, sys.stdin.readline().split()))

def read(type=int):
	return type(sys.stdin.readline().strip())
joint = lambda it, sep=' ': sep.join([str(i) if type(i) != list else sep.join(map(str, i)) for i in it])

def solve(num):

	def break_(num, n, already=-1):
		for i in range(n, int(sqrt(num)) + 1):
			if num % i == 0 and i != num // i and (i != already) and (num // i != already) and (num // i != 1):
				return (i, num // i)
		return (-1, -1)
	(first, second) = break_(num, 2)
	if first == -1:
		return 'NO'
	(third, fourth) = break_(second, first + 1, first)
	if third == -1:
		return 'NO'
	return 'YES\n{} {} {}'.format(first, third, fourth)
	return 'NO'

def main():
	print(joint(list(map(solve, [read() for _ in range(read())])), '\n'))
main()


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a.append(i)
			n = n // i
			if len(a) == 2:
				break
	if len(a) == 2 and n > a[1]:
		print('YES')
		print(a[0], a[1], n)
	else:
		print('NO')


def smallestDivisor(n, a):
	if not n & 1 and a != 2:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0 and a != i:
			return i
		i += 1
	return n
t = int(input())
for _ in range(t):
	n = int(input())
	a = smallestDivisor(n, 1)
	b = smallestDivisor(n // a, a)
	c = n // (a * b)
	if a < b and b < c:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	m = n
	a = dict()
	while n % 2 == 0:
		a[2] = a.get(2, 0) + 1
		n //= 2
	while n % 3 == 0:
		a[3] = a.get(3, 0) + 1
		n //= 3
	(p, q) = (2, 1)
	while q * q <= n:
		p = 6 - p
		q += p
		while n % q == 0:
			a[q] = a.get(q, 0) + 1
			n //= q
	if n != 1:
		a[n] = 1
	for i in list(a.keys()):
		if a[i] > 5:
			a[i] -= 5
			a[i * i] = 1
			a[i * i * i] = 1
		elif a[i] > 2:
			a[i] -= 2
			a[i * i] = 1
	k = list(a.keys())
	if len(a) > 1 and m // (k[0] * k[1]) != k[0] and (m // (k[0] * k[1]) != k[1]) and (m // (k[0] * k[1]) != 1):
		print('YES')
		print(k[0], k[1], m // (k[0] * k[1]))
	else:
		print('NO')


from math import *
t = int(input())
for z in range(t):
	n = int(input())
	na = True
	sq = ceil(sqrt(n)) + 1
	for a in range(2, sq):
		if not na:
			break
		if n % a == 0:
			q = n // a
			sq2 = ceil(sqrt(q)) + 1
			for b in range(a + 1, sq2):
				if q % b == 0:
					if q // b > b:
						print('YES')
						print(a, b, q // b)
						na = False
						break
	if na:
		print('NO')


def pm(n):
	arr = []
	while n % 2 == 0:
		arr.append(2)
		n //= 2
	for i in range(3, int(pow(n, 0.5)) + 1, 2):
		while n % i == 0:
			arr.append(i)
			n //= i
	if n > 2:
		arr.append(n)
	return arr
tc = int(input())
for ii in range(tc):
	n = int(input())
	arr = pm(n)
	a = arr[0]
	b = 1
	c = 1
	index = 0
	for i in range(1, len(arr)):
		b *= arr[i]
		if b != a:
			index = i
			break
	for j in range(index + 1, len(arr)):
		c *= arr[j]
	if a != b and b != c and (a != c) and (a != 1) and (b != 1) and (c != 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
while t > 0:
	res = []
	n = int(input())
	root = int(n ** 0.5)
	while root > 1:
		if n % root == 0:
			rem = n / root
			rem_root = int(rem ** 0.5)
			if rem == rem_root ** 2:
				root -= 1
				continue
			else:
				while rem_root > 1:
					if rem % rem_root == 0:
						if rem_root == root or rem / rem_root == root:
							rem_root -= 1
							continue
						else:
							res = [root, int(rem_root), int(rem / rem_root)]
							print(f'YES\n{root} {int(rem_root)} {int(rem / rem_root)}')
							break
					rem_root -= 1
		if len(res) == 3:
			break
		root -= 1
	t -= 1
	if len(res) != 3:
		print('NO')


import math

def primeFactors(n):
	output = []
	while n % 2 == 0:
		output.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			output.append(i)
			n = n / i
	if n > 2:
		output.append(int(n))
	return output
t = int(input())
for g in range(0, t):
	n = int(input())
	a = primeFactors(n)
	a.sort()
	output = 1
	i = 1
	x = y = z = 0
	x = a[0]
	if len(a) == 1:
		output = 0
	if output == 1:
		if a[1] != a[0]:
			y = a[1]
			z = int(n / (x * y))
		elif len(a) > 2:
			y = a[1] * a[2]
			z = int(n / (x * y))
		else:
			output = 0
	if output == 1 and z != 1 and (x != y) and (y != z) and (x != z):
		print('YES')
		print(x, y, z)
	else:
		print('NO')


from math import sqrt as s

def factorization(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n // 2
	for i in range(3, int(s(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n // i
	if n > 2:
		a.append(n)
	return a
for i in range(int(input())):
	n = int(input())
	a = factorization(n)
	flag = 'hobe'
	if len(a) < 3:
		flag = 'miao'
	else:
		res = []
		res.append(a[0])
		if a[1] == a[0]:
			res.append(a[1] * a[2])
			j = 3
		else:
			res.append(a[1])
			j = 2
		temp = 1
		for i in range(j, len(a)):
			temp = temp * a[i]
		if temp in res or temp == 1:
			flag = 'miao'
		else:
			res.append(temp)
	if flag == 'miao':
		print('NO')
	else:
		print('YES')
		print(*res)


t = int(input())
for y in range(t):
	n = int(input())
	i = 2
	a = n
	ans = []
	while i * i <= n:
		if a % i == 0:
			ans.append(i)
			a //= i
		i += 1
		if len(ans) == 2:
			break
	if len(ans) != 2:
		print('NO')
	elif a == ans[0] or a == ans[1]:
		print('NO')
	else:
		print('YES')
		print(ans[0], ans[1], a)


for i in range(int(input())):
	n = int(input())
	i = 2
	arr = []
	while n > 0 and i <= int(n ** 0.5):
		if n % i == 0:
			n /= i
			arr.append(i)
		i += 1
		if len(arr) == 2:
			break
	if len(arr) == 2:
		if n not in arr:
			print('YES')
			print(arr[0], arr[1], int(n))
		else:
			print('NO')
	else:
		print('NO')


import math

def isPrime(n):
	for i in range(2, n):
		if n % i:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	if isPrime(n):
		print('NO')
	else:
		ip = False
		i = 0
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				if not isPrime(n // i):
					ip = True
					break
		if ip:
			ip = False
			for j in range(i + 1, int(math.sqrt(n // i)) + 1):
				if n // i % j == 0:
					ip = True
					a = i
					b = j
					c = n // i // j
					break
			if ip and (a != b and b != c and (a != c)):
				print('YES')
				print(a, b, c)
			else:
				print('NO')
		else:
			print('NO')


import string
import math
import collections

def LeReseauLMD(n):
	orin = n
	(a, b, c) = (0, 0, 0)
	for a in range(2, math.floor(n ** 0.5) + 1):
		if n % a == 0:
			n //= a
			for b in range(2, math.floor(n ** 0.5) + 1):
				if n % b == 0 and b != a:
					c = n // b
					if c == a or c == b:
						c = 0
					break
			break
	if a * b * c == orin:
		return f'{a} {b} {c}'
	else:
		return 'NO'

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		rep = LeReseauLMD(n)
		if rep != 'NO':
			print('YES')
		print(rep)
main()


import math
test = int(input())
for i in range(test):
	n = int(input())
	count = 0
	j = 2
	temp = n
	ans = []
	r = math.ceil(math.sqrt(n))
	while count < 2 and j < r:
		if n % j == 0:
			count += 1
			n //= j
			ans.append(j)
		j += 1
	if count == 0 or count < 2:
		print('NO')
	else:
		s = 1
		for i in ans:
			s *= i
		if temp // s not in ans:
			print('YES')
			print(*ans, temp // s)
		else:
			print('NO')


import math

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(input())
for i in range(t):
	n = int(input())
	x = isPrime(n)
	if x == True:
		print('NO')
	else:
		c = []
		count = 0
		vv = math.sqrt(n)
		vv = int(vv)
		i = 2
		while i * i < n:
			if n % i == 0:
				count += 1
				n = n // i
				c.append(i)
			if count == 2:
				c.append(n)
				break
			i += 1
		if len(c) < 3 or c[0] == c[1] or c[1] == c[2]:
			print('NO')
		else:
			print('YES')
			print(*c)


import math
q = int(input())
for _ in range(q):
	n = int(input())
	l = []
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0:
			n = n // i
			l.append(i)
			break
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and len(l) == 1 and (i != l[0]):
			n = n // i
			l.append(i)
			break
	if n != 1 and len(l) == 2 and (n != l[0]) and (n != l[1]):
		l.append(n)
		print('YES')
		print(*l)
	else:
		print('NO')


from math import sqrt
t = int(input())
for j in range(t):
	n = int(input())
	m = 0
	bul_1 = False
	bul_2 = False
	i = 2
	while i <= int(sqrt(n)):
		if n % i == 0:
			if bul_1:
				bul_2 = True
				if i != n // i:
					print('YES')
					print(m, i, n // i)
				else:
					print('NO')
				break
			else:
				m = i
				bul_1 = True
				n //= i
		i += 1
	if not bul_2:
		print('NO')


import math

def div(n, m):
	i = m + 1
	while i * i < n:
		if n % i == 0:
			return (i, n // i)
		i += 1
	return (-1, -1)
t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	i = 2
	while i * i < n:
		if n % i == 0:
			a = i
			break
		i += 1
	if a == 0:
		print('NO')
	else:
		(b, c) = div(n // a, a)
		if b == -1:
			print('NO')
		else:
			print('YES\n', a, ' ', b, ' ', c)


from math import sqrt as S

def div(x):
	d = []
	if x == 1:
		return [1]
	if x == 2:
		return [1, 2]
	cnt = [1, n]
	for i in range(2, int(S(x)) + 1):
		if x % i == 0:
			cnt.append(i)
	return cnt

def check(arr):
	if 1 in arr or 0 in arr:
		return 0
	return len(set(arr)) == 3
import sys
input = sys.stdin.readline
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	f = 0
	cnt = div(n)
	for x in cnt:
		y = n // x
		if f:
			break
		for z in div(y):
			if check([x, z, y // z]):
				ans = [x, z, y // z]
				f = 1
				break
	if f:
		print('YES')
		print(*ans)
	else:
		print('NO')


def product(n):
	for i in range(2, int(n ** (1 / 3)) + 1):
		if n % i == 0:
			for j in range(i + 1, int(n ** (1 / 2))):
				if n // i % j == 0 and j != i and (n // i / j != i) and (j != (n // i) ** (1 / 2)):
					print('YES')
					print(i, j, n // i // j)
					return
	print('NO')
	return
t = int(input())
a = []
for i in range(t):
	a.append(int(input()))
for x in a:
	product(x)


import math
n = int(input())
for i in range(n):
	l = []
	trigger = 0
	a = int(input())
	d = 0
	original = a
	c = int(math.sqrt(a))
	for j in range(2, c + 1):
		if a % j == 0:
			l.append(j)
			a = a // j
			trigger += 1
		if trigger == 2:
			if a < original and l[0] != a and (l[1] != a) and (original % a == 0):
				l.append(a)
				print('YES')
				print(*l, sep=' ')
				d += 1
				break
	if d == 0:
		print('NO')


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	n = ii()
	fg = 0
	oans = [-1, -1, -1]
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ans = [-1, -1]
			for j in range(2, int((n // i) ** 0.5) + 1):
				if n // i % j == 0 and n // i // j != j and (j != i):
					ans[0] = j
					ans[1] = n // i // j
					break
			if not -1 in ans and ans[0] != ans[1] != i:
				oans[0] = ans[0]
				oans[1] = ans[1]
				oans[2] = i
				fg = 1
				break
	if fg:
		print('YES')
		print(*oans)
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	d = []
	cnt = 2
	(a, b, c) = (1, 1, 1)
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a = i
			break
	x = n // a
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0 and i != a:
			b = i
			break
	c = n // (a * b)
	if a < b < c and a * b * c == n and (min(a, b, c) > 1):
		print('YEs\n', a, b, c)
	else:
		print('NO')


import math
res = [1, 1, 1]

def del1(a, k, d):
	sqrtlam = lambda x: math.sqrt(x)
	for i in range(d, math.ceil(sqrtlam(a))):
		if a % i == 0:
			if k == 1:
				if int(a / i) != res[0]:
					res[1] = int(i)
					res[2] = int(a / i)
					return 1
			else:
				res[0] = i
				if del1(a / i, k + 1, i + 1):
					return 1
	return 0
n = int(input())
for i in range(n):
	res = [1, 1, 1]
	b = int(input())
	if del1(b, 0, 2) == 0:
		print('NO')
	else:
		print('YES')
		print(*res)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N):
	ans = []
	while len(ans) < 2:
		for i in range(ans[-1] + 1 if ans else 2, int(N ** 0.5) + 1):
			if N % i == 0:
				ans.append(i)
				N //= i
				break
		else:
			return 'NO'
	if len(ans) != 2:
		return 'NO'
	if N <= ans[-1]:
		return 'NO'
	ans.append(N)
	return 'YES\n' + ' '.join(map(str, ans))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


t = int(input())
MAX = 32000
primeSieve = [True] * MAX
primes = []
primeSieve[0] = primeSieve[1] = False
for i in range(2, MAX):
	if primeSieve[i] == True:
		primes.append(i)
		for j in range(i * i, MAX, i):
			primeSieve[j] = False
for _ in range(t):
	n = int(input())
	nums = []
	i = 0
	while i < len(primes) and n > 1:
		if n % primes[i] == 0:
			nums.append(primes[i])
			n //= primes[i]
			if len(nums) == 2:
				break
			if n % primes[i] ** 2 == 0:
				nums.append(primes[i] ** 2)
				n //= primes[i] ** 2
				break
		i += 1
	if len(nums) >= 2 and n not in nums + [1]:
		print('YES')
		print(*nums, n)
	else:
		print('NO')


import math

def solve(n):
	arr = []
	for i in range(2, int(math.sqrt(n)) + 1):
		while n % i == 0:
			arr.append(i)
			n = n // i
	if n > 1:
		arr.append(n)
	(s, c) = ([], 1)
	for i in arr:
		c *= i
		if len(s) < 3 and c not in s:
			s.append(c)
			c = 1
	s[-1] = s[-1] * c
	if len(s) < 3:
		print('NO')
	else:
		print('YES')
		print(f'{s[0]} {s[1]} {s[2]}')
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
for _ in range(RI()):
	inp = RI()
	answer = []
	i = 2
	while len(answer) < 2 and i * i < inp:
		if inp % i == 0:
			answer.append(i)
			inp //= i
		i += 1
	if len(answer) == 2 and inp not in answer:
		print('YES')
		print(*answer, inp)
	else:
		print('NO')


import math

class Solution:

	def __init__(self):
		self.arr = []

	def solution(self):
		n = int(input())
		for i in range(2, n):
			if n % i == 0:
				self.arr.append(i)
				n //= i
			if len(self.arr) == 2 or n < i * i:
				break
		if len(self.arr) == 2 and n != self.arr[0] and (n != self.arr[1]) and (n > 1):
			print('YES')
			print(self.arr[0], self.arr[1], n)
		else:
			print('NO')
for _ in range(int(input())):
	ob = Solution()
	ob.solution()


t = int(input())
import math
for i in range(t):
	n = int(input())
	res = []
	c = 0
	a = 0
	q = int(math.sqrt(n)) + 2
	for j in range(2, q):
		if n % j == 0:
			n = n // j
			res.append(j)
			a = j + 1
			c += 1
			break
	if c == 1:
		q = int(math.sqrt(n)) + 2
		for j in range(a, q):
			if n % j == 0:
				n = n // j
				res.append(j)
				c += 1
				break
	if c < 2 or res[0] == n or res[1] == n:
		print('No')
	else:
		print('Yes')
		print(res[0], res[1], n)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(2, int(n ** 0.5) + 2):
		if len(a) == 2:
			a.append(n)
			break
		if n % i == 0:
			a.append(i)
			n //= i
	a = list(set(a))
	if len(a) == 3 and a.count(1) == 0:
		print('YES')
		a.sort()
		print(a[0], a[1], a[2])
	else:
		print('NO')


import math
t = int(input())
while t:
	n = int(input())
	a = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a.append(i)
			n = n // i
		if len(a) == 2:
			break
	if len(a) == 2 and n != 1:
		if n not in a:
			print('YES')
			print(a[0], a[1], n)
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


pr = [1] * 40000
primes = []
for i in range(2, 40000):
	if pr[i]:
		primes.append(i)
		for j in range(i * i, 40000, i):
			pr[j] = 0

def sl(a, b, kkk):
	print('YES')
	print(a, b, kkk // (a * b))
n = int(input())
for i in range(n):
	k = int(input())
	kk = k
	f = []
	for p in primes:
		if k % p == 0:
			f.append([p, 1])
			k //= p
			while k % p == 0:
				f[-1][1] += 1
				k //= p
			if len(f) > 2:
				break
		if p * p >= kk:
			break
	if k != 1:
		f.append([k, 1])
	if len(f) >= 3:
		sl(f[0][0], f[1][0], kk)
	elif len(f) == 2:
		if f[0][1] >= 2 and f[1][1] >= 2:
			sl(f[0][0], f[1][0], kk)
		elif f[0][1] >= 3:
			sl(f[0][0], f[0][0] * f[0][0], kk)
		elif f[1][1] >= 3:
			sl(f[1][0], f[1][0] * f[1][0], kk)
		else:
			print('NO')
	elif f[0][1] >= 6:
		sl(f[0][0], f[0][0] * f[0][0], kk)
	else:
		print('NO')


import math

def ans(n):
	(a, b) = (-1, -1)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			break
	if a == -1:
		print('NO')
		return
	for i in range(a + 1, int(math.sqrt(n)) + 1):
		if (n % i == 0) & (n % (a * i) == 0):
			b = i
			break
	if b == -1:
		print('NO')
		return
	if (n / (a * b) != 1) & (n / (a * b) != a) & (n / (a * b) != b):
		print('YES')
		print(a, b, int(n / (a * b)))
		return
	print('NO')
	return
t = int(input())
while t:
	t = t - 1
	n = int(input())
	ans(n)


import math
try:

	def func1(t2, io):
		if len(io) >= 3 and len(t2) >= 3:
			y = t2[1]
			x = t2[0]
			z = n // (x * y)
			return [x, y, z]
		elif len(io) >= 6 and len(t2) == 1:
			y = pow(t2[0], 2)
			x = t2[0]
			z = n // pow(x, 3)
			return [x, y, z]
		elif len(io) >= 4 and len(t2) == 2:
			y = t2[1]
			x = t2[0]
			z = n // (y * x)
			return [x, y, z]
		else:
			return 'NO'

	def func2(l):
		io = []
		while l % 2 == 0:
			io.append(2)
			l = l // 2
		for p in range(3, int(math.sqrt(l)) + 1, 2):
			while l % p == 0:
				io.append(p)
				l = l // p
		if l > 2:
			io.append(l)
		return io
	tyu = int(input())
	for tyc in range(tyu):
		n = int(input())
		io = func2(n)
		t2 = list(set(io))
		gy = func1(t2, io)
		if gy == 'NO':
			print('NO')
		else:
			print('YES')
			print(*gy)
		continue
except:
	pass


import math

def check(count, n):
	a = int(math.sqrt(n))
	for i in range(count, a + 1):
		if n % i == 0:
			return i
	return 0
for i in range(int(input())):
	n = int(input())
	(a, b, c) = (0, 0, 0)
	while n != 0:
		if check(2, n) == 0:
			c = n
			n = 0
			break
		elif check(2, n) != 0:
			a = check(2, n)
			b = check(a + 1, n / a)
			if b == 0:
				break
			c = n / (a * b)
			break
	if c <= 1 or a <= 1 or b <= 1 or (a == b) or (b == c) or (c == a):
		print('NO')
		continue
	print('YES')
	print(a, ' ', b, ' ', int(c))


def product(n):
	a = int(min_divisor(2, n))
	if a == n:
		return False
	else:
		b = int(min_divisor(a + 1, n / a))
		if b == a or b == 1:
			return False
		else:
			c = int(n / (a * b))
			if c == a or c == b or c == 1:
				return False
			else:
				return (a, b, c)

def min_divisor(s, n):
	for i in range(s, int(n ** 0.5) + 1):
		if n % i == 0:
			return i
	else:
		return n
t = int(input())
for i in range(t):
	n = int(input())
	ans = product(n)
	if ans:
		print('YES')
		print(*list(ans))
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	i = 2
	rt = int(n ** 0.5)
	l = []
	dp = [True] * (int(n ** 0.5) + 1)
	while i <= rt and len(l) < 3:
		if n % i != 0:
			i += 1
		elif dp[i]:
			l.append(i)
			dp[i] = False
			if len(l) == 2:
				if l[0] != n // i and i != n // i:
					l.append(n // i)
			n = n // i
			rt = int(n ** 0.5)
			i = 2
		else:
			i += 1
	if len(l) == 3:
		print('YES')
		print(l[0], l[1], l[2])
	else:
		print('NO')


import sys
t_ = int(input())
while t_:
	t_ -= 1
	n = int(input())
	if n < 24:
		print('NO')
	else:
		i = 2
		a = b = c = 0
		while i * i < n:
			if n % i == 0:
				a = i
				n = n // i
				break
			i += 1
		if a == 0:
			print('NO')
		else:
			i = 3
			while i * i < n:
				if n % i == 0 and i != a:
					b = i
					c = n // i
					break
				i += 1
			if b < 2 or c < 2 or b == c:
				print('NO')
			else:
				print('YES')
				print(a, b, c)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = spf[1] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	n = int(input())
	ans = set()
	i = 2
	while i * i <= n:
		if len(ans) == 2 and n not in ans:
			ans.add(n)
			break
		if n % i == 0:
			if i not in ans:
				ans.add(i)
				n //= i
				i = 2
			else:
				i += 1
		else:
			i += 1
	if len(ans) == 3:
		print('YES')
		print(*list(ans))
	else:
		print('NO')


from functools import reduce

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

	def x(n):
		x = factors(n)
		counter = 1
		if len(x) < 5:
			return True
		else:
			x = x - set([1]) - set([n])
			x = list(x)
			for i in range(len(x) - 2):
				for j in range(i + 1, len(x) - 1):
					for k in range(j + 1, len(x)):
						if x[i] * x[j] * x[k] == n:
							print('YES')
							print(x[i], x[j], x[k])
							return False
		return True
	if x(n):
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = math.sqrt(n)
	a = int(a)
	c = []
	f = 0
	d = 0
	b = int(a)
	for j in range(2, a + 1, 1):
		if n % j == 0:
			f = 1
			x = j
			y = n // j
			break
	if f == 0:
		print('NO')
	else:
		f = 0
		for j in range(2, int(y ** (1 / 2)) + 1):
			if y % j == 0:
				if x != j and y // j != x and (y // j != j):
					z = j
					y = y // j
					f = 1
					break
		if f == 0:
			print('NO')
		else:
			print('YES')
			print(x, y, z)


t = int(input())
for i in range(t):
	n = int(input())
	p = []
	j = 2
	while j * j <= n:
		while n % j == 0:
			p.append(j)
			n //= j
		j += 1
	if n > 1:
		p.append(n)
	if len(p) < 3:
		print('NO')
	elif len(p) == 3:
		if p[0] != p[1] and p[1] != p[2] and (p[0] != p[2]):
			print('YES')
			print(p[0], p[1], p[2])
		else:
			print('NO')
	else:
		mult = 1
		for x in p:
			mult *= x
		a = p[0]
		b = -1
		for x in p:
			if x != a:
				b = x
				break
		if b != -1:
			print('YES')
			print(a, b, mult // a // b)
		elif len(p) >= 6:
			print('YES')
			print(p[0], p[1] * p[2], mult // p[0] // p[1] // p[2])
		else:
			print('NO')


import math
test_cases = int(input())

def process():
	n = int(input())
	for a in range(2, int(math.sqrt(n)) + 1):
		for b in range(a + 1, int(math.sqrt(n // a)) + 1):
			c = n // (a * b)
			if a * b * c == n and c != b and (c != a):
				print('YES')
				print(a, b, c)
				return
	print('NO')
for i in range(test_cases):
	process()


import math

def primeFactors(n):
	prime = []
	while n % 2 == 0:
		prime.append(2)
		n = n // 2
	i = 3
	while i <= math.sqrt(n):
		while n % i == 0:
			prime.append(i)
			n = n // i
		i += 2
	if n > 2:
		prime.append(n)
	return prime
te = int(input())
while te > 0:
	te -= 1
	n = int(input())
	factors = primeFactors(n)
	if len(factors) < 3:
		print('NO')
	else:
		if len(factors) == 3:
			(x, y, z) = factors
		else:
			x = factors[0]
			j = 3
			if factors[0] != factors[1]:
				y = factors[1]
				j = 2
			else:
				y = factors[1] * factors[2]
			z = 1
			while j < len(factors):
				z = z * factors[j]
				j += 1
		if x == y or y == z or x == z:
			print('NO')
		else:
			print('YES')
			print(x, y, z)


t = int(input())
for i in range(t):
	f = 0
	n = int(input())
	if n % 2 == 0:
		a = 2
		f = 1
	else:
		for j in range(3, int(n ** (1 / 3) + 2), 2):
			if n % j == 0:
				a = j
				f = 1
				break
	if f == 0:
		print('NO')
	else:
		n = n // a
		f = 0
		for j in range(a, int(n ** (1 / 2) + 2)):
			c = n // j
			if n % j == 0 and j != a and (c != 1):
				b = j
				f = 1
				break
		if f == 0 or b == c or a == c:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import math
import collections
import sys
import math

def primeFactors(n):
	l = []
	count = 0
	while n % 2 == 0:
		count += 1
		n = n // 2
	if count > 0:
		l.append([2, count])
		count = 0
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			count += 1
			n = n // i
		if count > 0:
			l.append([i, count])
			count = 0
	if n > 2:
		l.append([n, 1])
	return l
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = primeFactors(n)
	if len(l) >= 3:
		print('YES')
		(m1, m2, m3) = (1, 1, 1)
		m1 = l[0][0] ** l[0][1]
		m2 = l[1][0] ** l[1][1]
		for i in range(2, len(l)):
			m3 *= l[i][0] ** l[i][1]
		print(m1, m2, m3)
	elif len(l) == 1:
		if l[0][1] >= 6:
			print('YES')
			print(l[0][0] ** 1, l[0][0] ** 2, l[0][0] ** (l[0][1] - 3))
		else:
			print('NO')
	elif l[0][1] + l[1][1] >= 4:
		print('YES')
		print(l[0][0], l[1][0], l[0][0] ** (l[0][1] - 1) * l[1][0] ** (l[1][1] - 1))
	else:
		print('NO')


def solve():
	n = int(input())
	primes = {}
	i = 2
	while i * i <= n:
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n //= i
		i += 1
	if n > 1:
		primes[n] = primes.get(n, 1)
	k = list(primes.keys())
	v = list(primes.values())
	if len(primes) >= 3:
		print('YES')
		print(k[0] ** primes[k[0]], k[1] ** primes[k[1]], end=' ')
		third = 1
		for i in range(2, len(k)):
			third *= k[i] ** primes[k[i]]
		print(third)
	elif len(primes) == 1:
		if sum(v) >= 6:
			print('YES')
			print(k[0], k[0] ** 2, k[0] ** (v[0] - 3))
		else:
			print('NO')
	elif len(primes) == 2:
		if v[0] <= 1 and v[1] <= 1:
			print('NO')
		elif v[0] == 1 and v[1] == 2 or (v[0] == 2 and v[1] == 1):
			print('NO')
		else:
			print('YES')
			print(k[0], k[1], k[0] ** (v[0] - 1) * k[1] ** (v[1] - 1))
t = int(input())
while t > 0:
	solve()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	k = 1
	x = 1
	y = 1
	z = 1
	flag = 0
	while i * i <= n:
		if n % i == 0:
			if k == 1:
				x = i
				n = n // i
				k = 0
			elif n // i != i and x != i and (x != n // i):
				y = i
				z = n // i
				break
			else:
				flag = 1
				break
		i += 1
	if flag == 0 and x > 1 and (y > 1) and (z > 1):
		print('YES')
		print(x, y, z)
	else:
		print('NO')


import math
T = int(input())
for _ in range(0, T):
	N = int(input())
	n = 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)
	if len(L) < 3:
		print('NO')
	else:
		t1 = L[0]
		t2 = L[1]
		t3 = 1
		if L[1] == L[0]:
			t2 = L[1] * L[2]
			for j in range(3, len(L)):
				t3 *= L[j]
		else:
			for j in range(2, len(L)):
				t3 *= L[j]
		if t1 != t2 and t2 != t3 and (t1 != t3) and (t1 > 1) and (t2 > 1) and (t3 > 1):
			print('YES')
			print(t1, t2, t3)
		else:
			print('NO')


t = int(input())
for kek in range(t):
	n = int(input())
	i = 2
	s = list()
	while i < n ** (1 / 2) + 1:
		if n % i == 0:
			s.append(i)
			n //= i
		else:
			i += 1
	if n != 1:
		s.append(n)
	a = list()
	a.append(s[0])
	x = 1
	for i in range(1, len(s)):
		x *= s[i]
		if x not in a:
			a.append(x)
			x = 1
		else:
			continue
	a[-1] *= x
	if len(a) >= 3:
		x = 1
		for i in range(2, len(a)):
			x *= a[i]
		print('YES')
		print(a[0], a[1], x)
	else:
		print('NO')


def product_of_3_numbers(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			d = n // i
			for j in range(i + 1, int(d ** (1 / 2)) + 1):
				if d % j == 0 and j != d // j:
					print('YES')
					print(i, j, d // j)
					return
	print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	product_of_3_numbers(n)


from math import sqrt

def calcul(x, message):
	for j in range(2, int(sqrt(x))):
		if x % j == 0:
			m = x / j
			s = int(sqrt(m))
			if j + 1 > s:
				s = int(m / 2)
			for k in range(j + 1, s + 1):
				if m % k == 0 and int(m / k) != k and (int(m / k) != j):
					message = 'YES'
					print(message)
					print(j, ' ', k, ' ', int(m / k))
					return -1
n = int(input())
l = []
for i in range(0, n):
	l.append(int(input()))
for i in range(0, n):
	message = 'NO'
	if calcul(l[i], message) != -1:
		print(message)


nn = int(input())
import math

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

def isprime2(n):
	if n <= 3:
		return (False, 1)
	sqrt = int(math.sqrt(n)) + 1
	for i in range(2, sqrt):
		if n % i == 0:
			return (True, i)
	return (False, 1)
for dfdfdi in range(nn):
	v = int(input())
	if v <= 7:
		print('NO')
		continue
	(firstTrue, firstPrime) = isprime(v)
	if not firstTrue:
		print('NO')
		continue
	v = v // firstPrime
	(secondTrue, secondPrime) = isprime2(v)
	if not secondTrue:
		print('NO')
		continue
	final = v // secondPrime
	if firstPrime == secondPrime or secondPrime == final:
		(thirdTrue, thirdPrime) = isprime2(final)
		if not thirdTrue:
			print('NO')
		else:
			secondPrime *= thirdPrime
			final = final // thirdPrime
			if secondPrime == final or secondPrime == firstPrime or final == firstPrime:
				print('NO')
				continue
			else:
				print('YES')
				print(str(firstPrime) + ' ' + str(secondPrime) + ' ' + str(final))
	else:
		print('YES')
		print(str(firstPrime) + ' ' + str(secondPrime) + ' ' + str(final))


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
from random import randint
mo = 10 ** 9 + 7

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

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

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	k = inin()
	d = dd(int)
	sq = int(math.sqrt(k)) + 1
	c = 0
	ans = []
	f = 0
	for i in range(2, sq + 1):
		if k % i == 0:
			k = k // i
			c += 1
			ans += [i]
		if c == 2 and k != 1 and (k not in ans):
			f = 1
			break
	if f:
		print('YES')
		print(*ans, k)
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	try:
		a = list((i for i in range(2, int(n ** 0.5) + 1) if n % i == 0))[0]
		n //= a
		b = list((i for i in range(a + 1, int(n ** 0.5) + 1) if n % i == 0))[0]
		c = n // b
		if c <= b:
			raise
		print('YES')
		print(a, b, n // b)
	except:
		print('NO')


import math
from functools import reduce
t = int(input())
for cas in range(t):
	n = int(input())
	ans = []
	m = n
	for i in range(2, int(math.sqrt(m))):
		cal = 0
		if n == 1:
			break
		while n % i == 0 and n > 1:
			n //= i
			ans.append(i)
	if n > 1:
		ans.append(n)
	if len(ans) < 3:
		print('NO')
	elif len(ans) == 3:
		if len(set(ans)) < 3:
			print('NO')
		else:
			print('YES')
			print(ans[0], ans[1], ans[2])
	elif len(ans) == 4:
		if len(set(ans)) == 1:
			print('NO')
		else:
			print('YES')
			print(ans[0], ans[1] * ans[2], ans[3])
	elif len(ans) == 5:
		if len(set(ans)) == 1:
			print('NO')
		else:
			print('YES')
			print(ans[0], ans[1] * ans[2] * ans[3], ans[4])
	else:
		print('YES')
		print(ans[0], ans[1] * ans[2], reduce(lambda x, y: x * y, ans[3:]))


import math

def divisorGenerator(n):
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			yield i
			if i * i != n:
				large_divisors.append(int(n / i))
	for divisor in reversed(large_divisors):
		yield divisor
n = int(input())
for x in range(n):
	a = int(input())
	t = list(divisorGenerator(a))
	t.pop(-1)
	t.pop(0)
	b1 = False
	b2 = False
	if len(t) <= 2:
		print('NO')
		continue
	for z in range(0, len(t) - 2):
		for zz in range(z + 1, len(t) - 1):
			for zzz in range(zz + 1, len(t)):
				if t[z] * t[zz] * t[zzz] == a:
					print('YES')
					print(t[z], t[zz], t[zzz])
					b1 = True
					break
			if b1 == True:
				b2 = True
				break
		if b2 == True:
			break
	if b1 == False and b2 == False:
		print('NO')


import math
n = int(input())
for i in range(n):
	deb = t = int(input())
	divs = []
	for j in range(2, round(math.sqrt(t) + 1)):
		if t % j == 0 and j not in divs:
			divs.append(j)
			t //= j
			if len(divs) == 2:
				divs.append(t)
				break
	if len(set(divs)) == 3 and deb == divs[0] * divs[1] * divs[2]:
		print('YES')
		print(divs[0], divs[1], divs[2])
	else:
		print('NO')


t = int(input())
for t in range(t):
	n = int(input())
	d = 2
	cate = 0
	vec = [0] * 10
	while d * d <= n:
		if n % d == 0 and cate < 2:
			vec[cate] = d
			cate += 1
			n /= d
		if cate == 2:
			break
		d += 1
	if n > 1 and cate == 2:
		vec[cate] = n
		cate += 1
	if cate < 3 or vec[2] == vec[1]:
		print('NO')
	else:
		print('YES')
		print(int(vec[0]), int(vec[1]), int(vec[2]))


def kkk(n):
	for i in range(2, min(1000, n - 1)):
		if n % i == 0:
			return i
	return 1

def kkk2(n, p):
	for i in range(p, min(1000000, n - 1)):
		if n % i == 0:
			return i
	return 1
for i in range(int(input())):
	n = int(input())
	r = kkk(n)
	if r == 1:
		print('NO')
	else:
		n = n // r
		rr = kkk2(n, r + 1)
		if rr == 1 or rr * rr == n or r == n // rr:
			print('NO')
		else:
			print('YES')
			print(r, rr, n // rr)


for _ in range(int(input())):
	n = int(input())
	prime = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			prime.append(i)
			n //= i
	if n != 1:
		prime.append(n)
	if len(prime) < 3:
		print('NO')
	elif len(set(prime)) < 3:
		print('NO')
	else:
		ans = 1
		for i in prime[2:]:
			ans *= i
		print('YES')
		print(prime[0], prime[1], ans)


def Divisors(number):
	Div = set()
	sqr = int(number ** 0.5)
	for i in range(2, sqr + 1):
		if number % i == 0:
			Div = Div | {i}
			Div = Div | {number // i}
	return list(Div)

def getDiv(Number):
	D = list(Divisors(Number))
	D.sort()
	for i in range(len(D)):
		for j in range(i + 1, len(D)):
			m = D[i] * D[j]
			if m in D and Number // m != D[i] and (Number // m != D[j]):
				r = str(D[i]) + ' ' + str(D[j]) + ' ' + str(Number // m)
				r = 'YES\n' + r
				return r
	return 'NO'
Answers = []
n = int(input())
for i in range(n):
	a = int(input())
	Answers.append(getDiv(a))
for i in Answers:
	print(i)


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
num = int(z())
for _ in range(num):
	n = int(fast())
	x = int(n ** 0.5)
	lst = []
	for i in range(2, x + 1):
		if n % i == 0:
			lst.append(i)
			n //= i
		if len(lst) == 2:
			if lst[1] != n and lst[0] != n:
				lst.append(n)
				break
	if len(lst) == 3:
		print('YES')
		print(*lst)
	else:
		print('NO')


from functools import reduce

def factors(n):
	k = sorted(list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5 + 1)) if n % i == 0)))))
	return k[1:]
t = int(input())
for _ in range(0, t):
	n = int(input())
	f = factors(n)
	if len(f) < 3:
		print('NO')
	else:
		ans = 'NO'
		(a, b, c) = (-1, -1, -1)
		for i in range(0, len(f)):
			for j in range(i + 1, len(f)):
				temp = n // f[i]
				temp //= f[j]
				if temp in f and temp != f[i] and (temp != f[j]):
					(a, b, c) = (f[i], f[j], temp)
					ans = 'YES'
					break
			if ans == 'YES':
				break
		if ans == 'YES':
			print(ans)
			print(a, b, c)
		else:
			print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	k = n
	l = []
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			l.append(j)
			break
	if len(l) != 0:
		n = n // l[0]
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			if j not in l:
				l.append(j)
				break
	if len(l) == 2:
		if k % (l[0] * l[1]) == 0:
			c = k // (l[0] * l[1])
		if c not in l:
			print('YES')
			print(l[0], l[1], c)
		else:
			print('NO')
	else:
		print('NO')


def mind(n):
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0 and i not in [a, b, c]:
			return i
	return n
for _ in range(int(input())):
	n = int(input())
	(a, b, c) = (1, 1, 1)
	a = mind(n)
	n //= a
	b = mind(n)
	n //= b
	c = n
	q = set([a, b, c])
	if 1 not in q and len(q) == 3:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import sys
from collections import defaultdict
from math import sqrt
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	nn = n
	d = defaultdict(int)
	while n % 2 == 0:
		d[2] += 1
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			d[i] += 1
			n //= i
	if n > 1:
		d[n] = 1
	if len(d) == 1 and sum(d.values()) < 6:
		print('NO')
		continue
	if len(d) == 1:
		a = list(d.keys())[0]
		b = a * 2
		c = nn // (a * b)
		print('YES')
		print(a, b, c)
		continue
	if len(d) == 2 and sum(d.values()) < 4:
		print('NO')
		continue
	x = list(d.keys())
	a = x[0]
	b = x[1]
	c = nn // (a * b)
	print('YES')
	print(a, b, c)


from sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	cases = rll()
	for line in stdin:
		n = int(line)
		ans = []
		f1 = 2
		while f1 ** 2 <= n:
			if n % f1 == 0:
				ans.append(f1)
				break
			f1 += 1
		if len(ans) == 0:
			stdout.write('NO\n')
			continue
		m = n // f1
		f2 = f1 + 1
		while f2 ** 2 <= m:
			if m % f2 == 0:
				ans.append(f2)
				break
			f2 += 1
		if len(ans) == 1:
			stdout.write('NO\n')
			continue
		f3 = n // (f1 * f2)
		if f3 not in {f1, f2}:
			stdout.write('YES\n')
			stdout.write(' '.join((str(x) for x in [f1, f2, f3])))
			stdout.write('\n')
		else:
			stdout.write('NO\n')
	stdout.close()
main()


t = int(input())
while t:
	n = int(input())
	flag = 1
	arr = []
	i = 2
	while i * i < n:
		if n % i == 0 and i not in arr:
			arr.append(i)
			n //= i
			break
		i += 1
	i = 2
	while i * i < n:
		if n % i == 0 and i not in arr:
			arr.append(i)
			n //= i
			break
		i += 1
	if n not in arr:
		arr.append(n)
	if len(arr) < 3:
		print('NO')
	else:
		print('YES')
		print(*arr)
	t -= 1


t = int(input())

def prime_decomposition(n):
	table = []
	for i in range(2, int(n ** 0.5) + 1):
		while n % i == 0:
			table += [i]
			n //= i
		if n == 1:
			break
	if n != 1:
		table += [n]
	return table
for i in range(t):
	n = int(input())
	s = prime_decomposition(n)
	s.sort()
	flg = 0
	if len(s) < 3:
		print('NO')
		continue
	for j in range(1, len(s)):
		for k in range(j + 1, len(s)):
			z = s[0]
			x = 1
			y = 1
			for a in s[j:k]:
				x *= a
			for b in s[k:]:
				y *= b
			if x != y and y != z and (x != z):
				print('YES')
				print(z, x, y)
				flg = 1
				break
		if flg == 1:
			break
	if flg == 0:
		print('NO')


from math import *
for i in range(int(input())):
	num = int(input())
	if 2 * 3 * 4 > num:
		print('NO')
	else:
		(a, b) = (0, 0)
		for i in range(2, int(sqrt(num)) + 1):
			if num % i == 0:
				a = i
				num //= i
				break
		for i in range(2, int(sqrt(num)) + 1):
			if num % i == 0 and i != a:
				b = i
				num //= i
				break
		if a == 0 or b == 0 or num == b or (num == a):
			print('NO')
		else:
			print('YES')
			print(a, b, num)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	cuben = int(n ** (1.0 / 3))
	(a, b, c) = (0, 0, 0)
	ispossible = False
	for i in range(2, cuben + 1):
		if n % i == 0:
			num = int(n / i)
			sqn = int(num ** (1.0 / 2))
			for j in range(i + 1, sqn + 1):
				if num % j == 0:
					k = int(num / j)
					if not j == k:
						a = i
						b = j
						c = k
						ispossible = True
						break
		if ispossible:
			break
	if ispossible:
		print('YES\n' + str(a) + ' ' + str(b) + ' ' + str(c))
	else:
		print('NO')


INF = 10 ** 10

def main():
	n = get_int()
	factors = prime_factors(n)
	keys = list(factors.keys())
	if len(factors) >= 2:
		(a, b) = keys[:2]
		c = n // (a * b)
		if c == a or c == b or c < 2:
			print('NO')
			return
	elif factors[keys[0]] > 5:
		a = keys[0]
		b = keys[0] ** 2
	else:
		print('NO')
		return
	c = n // (a * b)
	print('YES')
	print(a, b, c)

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


for _ in range(int(input())):
	n = int(input())
	i = 2
	ans = []
	while i * i < n:
		if n % i == 0:
			ans.append(i)
			n = n // i
		if len(ans) == 2 and n not in ans:
			ans.append(n)
			break
		i += 1
	if len(ans) == 3:
		print('YES')
		print(*ans)
	else:
		print('NO')


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

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

def iinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def solve(adj, colors, n):
	pass

def root(parent, a):
	while parent[a] != a:
		parent[a] = parent[parent[a]]
		a = parent[a]
	return a

def union(parent, size, a, b):
	(roota, rootb) = (root(parent, a), root(parent, b))
	if roota == rootb:
		return
	parent[rootb] = roota
	size[roota] += size[rootb]
	size[rootb] = 0

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for i in range(iinput()):
	n = iinput()
	temp1 = factors(n)
	temp = list(factors(n))
	temp.sort()
	l = len(temp)
	flag = True
	for i in range(1, l - 1):
		for j in range(i + 1, l - 1):
			if n % (temp[i] * temp[j]) == 0:
				s = n / (temp[i] * temp[j])
				if s != temp[i] and s != temp[j] and (s != 1) and (s != n) and (s in temp1):
					print('YES')
					print(temp[i], temp[j], int(s))
					flag = False
					break
		if not flag:
			break
	if flag:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	ans = [-1, -1, -1]
	i = 2
	now = 0
	while i ** 2 <= n:
		if n % i == 0:
			ans[now] = i
			n //= i
			if now == 1:
				break
			now += 1
		i += 1
	if n >= 2:
		ans[2] = n
	if ans[1] != -1 and ans[2] == n and (ans[1] != ans[2]):
		print('YES')
		print(*ans)
	else:
		print('NO')


def find(num):
	a = 0
	b = 0
	i = 2
	while i * i <= num:
		if num % i == 0:
			if a == 0:
				a = i
			elif b == 0:
				b = i
			num = num // i
		if a > 0 and b > 0:
			return [a, b]
		i += 1
	return None
for i in range(int(input())):
	n = int(input())
	A = find(n)
	if not A or n <= 2:
		print('NO')
	else:
		a = A[0]
		b = A[1]
		c = a * b
		if n % a == 0 and n // a != a and (n // a != b) and (a * b * (n // a) == n):
			print('YES')
			print(a, b, n // a)
		if n % b == 0 and n // b != a and (n // b != b) and (a * b * (n // b) == n):
			print('YES')
			print(a, b, n // b)
		elif n % c == 0 and n // c != a and (n // c != b) and (a * b * (n // c) == n):
			print('YES')
			print(a, b, n // c)
		else:
			print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(2, math.ceil(math.sqrt(n)) + 2):
		if n % i == 0:
			n //= i
			a.append(i)
			if len(a) == 2:
				break
	else:
		print('NO')
		continue
	if n == 1 or n == a[0] or n == a[1]:
		print('NO')
	else:
		print('YES')
		print(a[0], a[1], n)


import math

def func(N, x):
	val = N ** 0.5
	val = int(val) + 1
	tem = 0
	for i in range(x + 1, val):
		if N % i == 0:
			if N // i > 1 and N // i != i:
				print('YES')
				print(x, i, N // i)
				tem = 1
				break
	if tem == 0:
		print('NO')
for _ in range(int(input())):
	N = int(input())
	val = N ** 0.5
	val = int(val) + 1
	temp = 0
	for i in range(2, val):
		if N % i == 0:
			if N // i != i:
				temp = 1
				func(N // i, i)
				break
	if temp == 0:
		print('NO')


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	out = [0, 0, 0]
	for i in range(2, int(ceil(sqrt(n)))):
		if n % i == 0:
			n //= i
			out[0] = i
			break
	else:
		ans = 'NO'
	if ans == 'YES':
		for j in range(2, int(ceil(sqrt(n)))):
			if j == out[0]:
				continue
			if n % j == 0:
				n //= j
				if n == out[0]:
					continue
				(out[1], out[2]) = (j, n)
				break
		else:
			ans = 'NO'
	if ans == 'NO':
		print(ans)
	else:
		print(ans)
		print(*out)


def petit(a, k):
	for i in range(a + 1, int(k ** 0.5) + 1):
		if k % i == 0:
			return (i, k // i)
	return (-1, -1)
n = int(input())
for i in range(n):
	k = int(input())
	(a1, k2) = petit(1, k)
	if a1 == -1:
		print('NO')
	else:
		(a2, a3) = petit(a1, k2)
		if a2 == -1:
			print('NO')
		elif a2 == a3 or a3 == a1:
			print('NO')
		else:
			print('YES')
			print(a1, a2, a3)


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

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

def iinp():
	return int(input())

def test():
	return int(input())

def inp():
	return input()

def find(n, x):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			k = n // i
			if i != x and k != x and (i != k):
				return (True, i, k)
	return (False, 1, n)

def solve():
	n = iinp()
	(t, a, b) = find(n, 1)
	if t:
		(t1, a1, b1) = find(a, b)
		if t1:
			print('YES')
			print(a1, b1, b)
			return 'YES'
		(t2, a2, b2) = find(b, a)
		if t2:
			print('YES')
			print(a, a2, b2)
			return 'YES'
		print('NO')
		return 'NO'
	else:
		print('NO')
		return 'NO'

def main():
	for _ in range(test()):
		solve()
main()


import math

def solve(unique, arr):
	if len(unique) >= 3 and len(arr) >= 3:
		(a, b) = (unique[0], unique[1])
		c = n // (a * b)
		return [a, b, c]
	elif len(unique) == 1 and len(arr) >= 6:
		(a, b) = (unique[0], pow(unique[0], 2))
		c = n // pow(a, 3)
		return [a, b, c]
	elif len(unique) == 2 and len(arr) >= 4:
		(a, b) = (unique[0], unique[1])
		c = n // (a * b)
		return [a, b, c]
	else:
		return 'NO'

def sieve(n):
	arr = []
	while n % 2 == 0:
		arr.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			arr.append(i)
			n = n // i
	if n > 2:
		arr.append(n)
	return arr
for _ in range(int(input())):
	n = int(input())
	arr = sieve(n)
	unique = list(set(arr))
	f = solve(unique, arr)
	if f == 'NO':
		print('NO')
	else:
		print('YES')
		print(*f)


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	if n < 24:
		print('NO')
	else:
		for i in range(2, ceil(n ** (1 / 3)) + 1):
			if n % i == 0:
				ans.append(i)
				break
		if len(ans) == 0:
			print('NO')
		else:
			n1 = n // ans[0]
			for j in range(ans[0] + 1, ceil(n ** (1 / 2)) + 1):
				if n1 % j == 0:
					ans.append(j)
					break
			if len(ans) != 2:
				print('NO')
			else:
				n2 = n1 // ans[1]
				if n2 <= ans[1]:
					print('NO')
				else:
					print('YES')
					print(f'{ans[0]} {ans[1]} {n2}')


from math import sqrt
N = int(input())
for i in range(N):
	n = int(input())
	res = []
	is_good = False
	for i in range(2, n // 6 + 1):
		if i > sqrt(n):
			break
		if n % i == 0:
			res.append(i)
			n /= i
			if len(res) == 2:
				if n > i:
					is_good = True
				break
	if is_good:
		print(f'YES\n{res[0]} {res[1]} {int(n)}')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())

	def fun(n):
		i = 2
		while i * i * i <= n:
			if n % i == 0:
				t = n // i
				j = 2
				while j * j <= t:
					if t % j == 0:
						k = t // j
						if i != j and i != k and (k != j):
							print('YES')
							print(i, j, k)
							return
					j += 1
			i += 1
		print('NO')
	fun(n)


def pro(j):
	for a in range(2, int(j ** (1 / 3)) + 1):
		if j % a == 0:
			for b in range(a + 1, int(j ** (1 / 2))):
				if j // a % b == 0 and j // a // b != a and (j // a // b != int((j // a) ** (1 / 2))):
					print('YES')
					print(a, b, j // a // b)
					return
	print('NO')
	return
t = int(input())
l = []
for i in range(t):
	n = int(input())
	l.append(n)
for j in l:
	pro(j)


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	if n < 24:
		print('NO')
		continue
	a = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			n //= i
			a.append(i)
			break
	if len(a) == 1:
		for i in range(a[0] + 1, int(n ** 0.5) + 1):
			if n % i == 0:
				n //= i
				a.append(i)
				break
	a.append(n)
	if len(a) == 3 and a[1] < a[2]:
		print('YES')
		print(*a)
	else:
		print('NO')


import math

def deliteli_chisla(cur):
	mas = []
	ot = 'NO'
	n = cur
	for i in range(2, math.ceil(cur ** 0.5)):
		if n % i == 0:
			mas.append(i)
	for i in range(len(mas)):
		del1 = mas[i]
		nn = n // del1
		s = nn
		for j in range(i, len(mas)):
			nn = s
			if nn % mas[j] == 0:
				nn = nn // mas[j]
				del2 = mas[j]
				if del1 * del2 != n and n % (del1 * del2) == 0:
					if del1 != del2 and del2 != n // del1 // del2 and (del1 != n // del1 // del2):
						ot = 'YES\n' + str(del1) + ' ' + str(del2) + ' ' + str(n // del1 // del2)
						return ot
for t in range(int(input())):
	n = int(input())
	if deliteli_chisla(n) is None:
		print('NO')
	else:
		print(deliteli_chisla(n))


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda : list(map(int, stdin.readline().split()))
ei = lambda : map(int, stdin.readline().split())
ip = lambda : int(stdin.readline().strip())

def primeFactors(N, li):
	while N % 2 == 0:
		li.append(2)
		N //= 2
	for i in range(3, int(math.sqrt(N)) + 1, 2):
		while N % i == 0:
			li.append(i)
			N //= i
	if N > 2:
		li.append(N)
	return li
n = ip()
for i in range(n):
	pf = primeFactors(ip(), [])
	if len(set(pf)) == 3 and len(pf) == 3:
		print('YES')
		print(*pf)
	elif len(pf) < 3:
		print('NO')
	else:
		(a, b, c) = (pf[0], 1, 1)
		for i in range(1, len(pf)):
			if b <= a:
				b *= pf[i]
			else:
				c *= pf[i]
		if c != b and c != a and (c != 1):
			print('YES')
			print(a, b, c)
		else:
			print('NO')


for j in range(int(input())):
	n = int(input())
	flag = False
	for i in range(2, int(n ** (1 / 3)) + 1):
		if n % i == 0:
			z = n // i
			for k in range(i + 1, int(z ** 0.5) + 1):
				if z % k == 0 and k * k != z:
					flag = True
					print('YES')
					print(i, k, z // k)
					break
		if flag == True:
			break
	if flag == False:
		print('NO')


import math
t = int(input())
for i in range(t):
	f = False
	a = -1
	b = -1
	c = -1
	n = int(input())
	primes = set()
	st = math.ceil(n ** 0.5) + 1
	p = [True] * st
	for i in range(2, st):
		if p[i]:
			primes.add(i)
			for j in range(i, st, i):
				p[j] = False
	for i in range(2, st):
		if f:
			break
		if n % i == 0:
			a = i
			bc = n // i
			st1 = math.ceil(bc ** 0.5) + 1
			if bc not in primes:
				for j in range(2, st1):
					if j == a:
						continue
					if bc % j == 0:
						if bc // j == a or j == bc // j:
							continue
						b = j
						c = bc // j
						f = True
						break
	if f:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	k = []
	for i in range(2, 10000):
		if n % i == 0:
			k.append(i)
			n = n // i
			break
	for j in range(2, 10000):
		if n % j == 0:
			if j not in k:
				k.append(j)
				n = n // j
				break
	if len(k) == 2:
		if n != 1 and n != k[0] and (n != k[1]):
			print('YES')
			print(k[0], k[1], n)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	ans = []
	i = 2
	top = 10 ** 6
	while len(ans) < 2 and i <= n and (i <= top):
		if n % i == 0:
			n //= i
			ans.append(i)
		i += 1
	if len(ans) < 2 or n == 1 or n in ans:
		print('NO')
	else:
		print('YES')
		ans.append(n)
		for i in ans:
			print(i, end=' ')
		print()


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

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

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

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2
from math import *

def is_prime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return 0
	return 1
for _ in range(int(input())):
	n = int(input())
	ans = set()
	for j in range(2):
		i = 2
		while i * i <= n:
			if n % i == 0 and (not i in ans):
				ans.add(i)
				n //= i
				break
			i += 1
	if len(ans) < 2 or n == 1 or n in ans:
		print('NO')
	else:
		print('YES')
		ans = list(ans)
		ans.append(n)
		print(*ans)


for _ in range(int(input())):
	N = int(input())
	Factors = []
	FLAG = 0
	for i in range(2, int(pow(N, 0.5)) + 1):
		if N % i == 0:
			X = i
			Z = N // i
			for j in range(2, int(pow(Z, 0.5)) + 1):
				if Z % j == 0:
					X1 = Z // j
					if X1 != j and X1 != X and (j != X):
						print('YES')
						print(X1, j, X)
						FLAG = 1
						break
			if FLAG == 1:
				break
	if FLAG == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = [0, 0, 0]
	tmp = 0
	m = n
	i = 2
	while i ** 2 <= m and tmp < 2:
		if n % i == 0:
			n //= i
			l[tmp] = i
			tmp += 1
		i += 1
	if tmp == 2 and n > l[1]:
		print('YES')
		l[2] = n
		print(*l)
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	ans = []
	o = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if n // i == i:
				continue
			ans.append(i)
			o = n // i
			break
	for i in range(2, int(o ** 0.5) + 1):
		if o % i == 0:
			if i not in ans:
				if i == o // i:
					continue
				ans.append(i)
				ans.append(o // i)
				break
	if len(ans) == 3:
		print('YES')
		print(*ans)
		continue
	print('NO')


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]

def fact(n):
	res = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	if int(n ** 0.5) ** 2 == n:
		res.pop()
	return res

def sol():
	n = rri()
	f = fact(n)
	if len(f) < 3:
		print('NO')
		return
	f.sort()
	a = f[0]
	d = n // a
	for i in range(1, len(f)):
		for j in range(i + 1, len(f)):
			if f[i] * f[j] == d:
				print('YES')
				print(a, f[i], f[j])
				return
	print('NO')
	return
t = rri()
for _ in range(t):
	sol()


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = set()
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0 and (not list(s).count(j)):
			s.add(j)
			n /= j
			break
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0 and (not list(s).count(k)):
			s.add(k)
			n /= k
			break
	if len(s) < 2 or list(s).count(n) or n == 1:
		print('NO')
	else:
		print('YES')
		s.add(int(n))
		print(*list(s), sep=' ')


def f(n):
	d = {}
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			d[i] = 0
			while n % i == 0:
				d[i] = d[i] + 1
				n = n // i
	if n != 1:
		d[n] = 1
	return d
final = []
t = int(input())
for i in range(0, t):
	n = int(input())
	d = f(n)
	values = list(d.values())
	keys = list(d.keys())
	if len(keys) >= 3:
		ans = 'YES'
		x = n // (keys[0] * keys[1])
		final = [x, keys[0], keys[1]]
	elif len(keys) == 2:
		if values[0] == 2 and values[1] == 2:
			ans = 'YES'
			final = [keys[0], keys[1], keys[0] * keys[1]]
		elif values[0] >= 3 or values[1] >= 3:
			ans = 'YES'
			if d[keys[0]] >= 3:
				final = [keys[0], keys[0] ** (d[keys[0]] - 1), keys[1] ** d[keys[1]]]
			else:
				final = [keys[1], keys[1] ** (d[keys[1]] - 1), keys[0] ** d[keys[0]]]
		else:
			ans = 'NO'
	elif len(keys) == 0:
		ans = 'NO'
	elif values[0] >= 6:
		ans = 'YES'
		final = [keys[0], keys[0] ** 2, n // keys[0] ** 3]
	else:
		ans = 'NO'
	if ans == 'NO':
		print(ans)
	else:
		print(ans)
		for i in range(0, len(final)):
			print(final[i], end=' ')
		print()


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

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

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

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

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

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

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

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

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

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

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

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

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

def sieve(a):
	for i in range(3, 10 ** 5 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 5 + 1, 2):
		for j in range(i * i, 10 ** 5 + 1, i):
			a[j] = 0
	a[2] = 1
	return a
a = [0] * (10 ** 5 + 1)
a = sieve(a)

def solve():
	n = int(inp())
	i = 3
	f = 0
	while i * i < n:
		if n % i == 0:
			f = 1
			break
		i += 2
	if n % 2 == 0:
		f = 1
	if f == 0:
		print('NO')
	else:
		i = 2
		div = []
		cnt = 0
		while i * i < n:
			if n % i == 0:
				div.append(i)
				n = n // i
				cnt += 1
			if cnt == 2:
				break
			i += 1
		if cnt == 2:
			if n > div[1]:
				print('YES')
				print(div[0], div[1], n)
			else:
				print('NO')
		else:
			print('NO')
testcase(int(inp()))


import math
n = int(input())
num = []
for i in range(n):
	num.append(int(input()))
for x in num:
	flag = 0
	counter = 0
	y = int(math.sqrt(x))
	for j in range(2, y + 1):
		if flag == 1:
			break
		elif x % j == 0:
			a = int(j)
			nu = int(x / j)
			z = int(math.sqrt(nu))
			for k in range(j + 1, z + 1):
				if nu % k == 0:
					b = int(k)
					c = int(nu / k)
					if b == c or a == c:
						counter = 0
					else:
						print('YES')
						print(a, b, c)
						flag = 1
						counter = 1
						break
	if counter == 0:
		print('NO')


def div(n):
	s = set()
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0:
			s.add(i)
			s.add(n // i)
	return s
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(div(n))
	s.sort()
	if len(s) > 2:
		found = 0
		a = b = c = 0
		d = len(s)
		for i in range(d):
			for j in range(i + 1, d):
				if n % (s[i] * s[j]) == 0:
					g = n // (s[i] * s[j])
					if g != s[i] and g != s[j] and (g >= 2):
						found = 1
						a = s[i]
						b = s[j]
						c = g
						break
			if found:
				break
		if found:
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	i = 2
	val = []
	while i * i <= n:
		if n % i == 0:
			n = n // i
			val.append(i)
			break
		i += 1
	i = 2
	while i * i <= n:
		if n % i == 0 and i != val[0]:
			n = n // i
			val.append(i)
			break
		i += 1
	if len(val) < 2 or n == 1 or val[-1] == n:
		print('NO')
	else:
		print('YES')
		val.append(n)
		print(*val)


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = None
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0:
			a = i
			break
	if a == None:
		print('NO')
		continue
	b = None
	for j in range(2, int(math.sqrt(n))):
		if n // i % j == 0 and j != a:
			b = j
			break
	if b == None:
		print('NO')
		continue
	if n // (a * b) != a and n // (a * b) != b and (n // (a * b) != 1):
		c = n // (a * b)
	else:
		print('NO')
		continue
	print('YES')
	print(a, b, c)


t = int(input())
for k in range(t):
	x = int(input())
	A = []
	start = 2
	while start ** 2 < x:
		if len(A) == 2:
			break
		if x % start == 0:
			x /= start
			A.append(start)
		start += 1
	if len(A) == 2:
		print('YES')
		print(int(A[0]), end=' ')
		print(int(A[1]), end=' ')
		print(int(x))
	else:
		print('NO')


from math import sqrt
for i in range(int(input())):
	a = int(input())
	for j in range(2, int(sqrt(a)) + 1):
		if a % j == 0:
			a = a // j
			for k in range(j + 1, int(sqrt(a)) + 1):
				if a % k == 0:
					a = a // k
					if a > k:
						print('YES')
						print(j, k, a)
						break
					else:
						print('NO')
						break
			else:
				print('NO')
				break
			break
	else:
		print('NO')


from collections import Counter

def primes(n):
	primfac = []
	d = 2
	while d * d <= n:
		while n % d == 0:
			primfac.append(d)
			n //= d
		d += 1
	if n > 1:
		primfac.append(n)
	return primfac
for _ in range(int(input())):
	n = int(input())
	a = primes(n)
	if len(a) < 3:
		print('NO')
	else:
		c = Counter(a)
		y = list(c.keys())
		if len(c) >= 3:
			print('YES')
			x = 1
			for i in a[2:]:
				x *= i
			print(y[0], y[1], n // (y[0] * y[1]))
		elif len(c) == 1:
			if c[y[0]] > 5:
				print('YES')
				print(a[0], a[0] * a[1], n // (a[0] * a[0] * a[0]))
			else:
				print('NO')
		elif c[y[0]] + c[y[1]] >= 4:
			print('YES')
			print(y[0], y[1], n // (y[0] * y[1]))
		else:
			print('NO')


import math

def printDivisors(n):
	i = 2
	l = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def find3(A, arr_size, s):
	A.sort()
	p = 0
	for i in range(0, arr_size - 2):
		l = i + 1
		r = arr_size - 1
		while l < r:
			if A[i] * A[l] * A[r] == s:
				print('YES')
				print(A[i], A[l], A[r])
				p = 1
				break
			elif A[i] * A[l] * A[r] < s:
				l += 1
			else:
				r -= 1
		if p == 1:
			break
	if p == 0:
		print('NO')
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = printDivisors(n)
	find3(l, len(l), n)


import math

def div(n):
	y = n
	c = 0
	ans = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if y % i == 0:
			c += 1
			y = y // i
			ans.append(i)
			if c >= 2:
				break
	print('YES' if c >= 2 and y not in ans else 'NO')
	if c >= 2 and y not in ans:
		print(*ans + [y])
for _ in range(int(input())):
	n = int(input())
	div(n)


from math import ceil, sqrt
T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	end = False
	add = []
	lim = ceil(sqrt(n)) + 1
	for a in range(2, lim):
		if n % a == 0:
			for b in range(a + 1, lim):
				c = n / a / b
				if int(c) == c and c != b and (c != a) and (c != 1):
					answer += 'YES\n'
					c = int(n / a / b)
					answer += '{} {} {}\n'.format(a, b, c)
					end = True
					break
		if end:
			break
	if not end:
		answer += 'NO\n'
print(answer)


def read():
	n = int(input())
	return n

def first_factor(n, from_factor):
	for i in range(from_factor, int(n ** 0.5) + 1):
		if n % i == 0:
			return i
	return None

def solve(n):
	result = [0] * 3
	from_factor = 2
	for i in range(2):
		d = first_factor(n, from_factor)
		if d is not None:
			result[i] = d
			from_factor = d + 1
			n = n // d
		else:
			return None
	if n == result[1]:
		return None
	else:
		result[2] = n
	return result
for t in range(int(input())):
	result = solve(read())
	if result:
		print('YES')
		print(*result)
	else:
		print('NO')


def else1(N):
	for a in range(2, int(N ** (1.0 / 3)) + 1):
		for b in range(a + 1, int((N // a) ** 0.5) + 1):
			c = N // a // b
			if a * b * c == N and c != a and (c != b):
				print('YES')
				print(a, b, c)
				return
	else:
		print('NO')

def main():
	t = int(input())
	for i in range(t):
		N = int(input())
		L = []
		if N ** (1.0 / 3) < 0.9:
			print('NO')
		else:
			else1(N)
main()


def solve(n):
	(a, b, c) = (None, None, None)
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a = i
			n = n / i
			break
	else:
		return None
	for i in range(a + 1, int(n ** 0.5) + 1):
		if n % i == 0:
			b = i
			c = int(n / i)
			break
	else:
		return None
	if b != c and a != c:
		return (a, b, c)
	else:
		return None
t = int(input())
for _ in range(t):
	n = int(input())
	res = solve(n)
	if res:
		print('YES')
		print(*res)
	else:
		print('NO')


for i in range(int(input())):
	k = set()
	a = int(input())
	for i in range(2, 10000):
		if len(k) < 2:
			if a % i == 0:
				a = a // i
				k.add(i)
		elif len(k) == 2 and a > 2:
			k.add(a)
	if len(k) == 3:
		print('YES')
		for i in sorted(k):
			print(i, end=' ')
		print()
	else:
		print('NO')


from math import *
t = int(input())

def check(x):
	count = 0
	flag = 0
	for i in range(2, floor(sqrt(x)) + 1):
		if x % i == 0:
			flag = 1
			break
	if flag != 0:
		for j in range(2, floor(sqrt(x / i)) + 1):
			if j != i and x / i % j == 0:
				count = 1
				break
		if count != 0:
			if x / (i * j) != i and x / (i * j) != 1 and (x / (i * j) != j):
				return 'YES\n' + str(i) + ' ' + str(j) + ' ' + str(int(x / (i * j)))
	return 'NO'
for _ in range(t):
	x = int(input())
	print(check(x))


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
primes = [2]
for j in range(3, 10 ** 5):
	indy = min(bisect.bisect_left(primes, math.ceil(math.sqrt(j))), len(primes) - 1)
	broke = False
	for s in range(indy + 1):
		if j % primes[s] == 0:
			broke = True
			break
	if broke == False:
		primes.append(j)
minny = len(primes)
testcases = int(input())
for j in range(testcases):
	n = int(input())
	indy = min(bisect.bisect_left(primes, math.ceil(math.sqrt(n))), minny - 1)
	facs = []
	for s in range(indy + 1):
		if n % primes[s] == 0:
			facs.append(primes[s])
	exi = True
	if len(facs) >= 3:
		(a, b, c) = (facs[0], facs[1], n // (facs[0] * facs[1]))
	elif len(facs) == 2:
		(a, b, c) = (facs[0], facs[1], n // (facs[0] * facs[1]))
		if c == 0 or c == 1 or c == a or (c == b):
			exi = False
	elif len(facs) == 1:
		(a, b, c) = (facs[0], facs[0] ** 2, n // facs[0] ** 3)
		if c == 0 or c == 1 or c == a or (c == b):
			exi = False
	elif len(facs) == 0:
		(a, b, c) = (0, 0, 0)
		exi = False
	if a * b * c == n and exi == True:
		print('YES')
		print(str(a) + ' ' + str(b) + ' ' + str(c))
	else:
		print('NO')


import math

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

def print_factors(x):
	num = 0
	fac = 1
	li = []
	tri = x
	for i in range(2, int(math.sqrt(x)) + 1):
		if tri % i == 0:
			num += 1
			fac = fac * i
			li.append(i)
			tri = tri / i
			if num == 2:
				break
	if x % fac == 0:
		if int(x / fac) > i:
			li.append(int(x / fac))
	return li
isp = False
num = int(input())
for i in range(num):
	lis = []
	a = int(input())
	if a >= 2:
		isp = isPrime(a)
		if isp == True:
			print('NO')
		else:
			lis = print_factors(a)
			if len(lis) == 3:
				print('YES')
				for i in range(2):
					print(lis[i], end=' ')
				print(lis[i + 1])
			else:
				print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	y = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			x = n // i
			for j in range(i + 1, int(n ** 0.5) + 1):
				if x % j == 0:
					if x // j != i and x // j > 1 and (x // j != j):
						print('YES')
						print(i, j, n // (i * j))
						y = 1
						break
			if y == 1:
				break
	if y == 0:
		print('NO')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	res = set()
	start_i = 2
	for _ in range(2):
		for i in range(start_i, int(n ** 0.5) + 1):
			if not n % i:
				n //= i
				start_i = i + 1
				res.add(i)
				break
	res.add(n)
	if len(res) == 3:
		print('YES')
		[print(a, end=' ') for a in res]
		print()
	else:
		print('NO')


def isPrime(n: int):
	if n == 1:
		return False
	if n == 2:
		return True
	else:
		for i in range(2, n // 2):
			if n % i == 0:
				return False
		return True
t = int(input())
for i in range(t):
	n = int(input())
	y = n
	res = []
	k = 2
	for k in range(2, int(y ** 0.5) + 1):
		if n % k == 0:
			res.append(k)
			n = n // k
		k += 1
		if len(res) == 2:
			break
	if len(res) == 2 and res[-1] < n:
		print('YES')
		print(*res, n)
	else:
		print('NO')


import math
for tt in range(int(input())):
	nvar = int(input())
	flag = False
	for i in range(2, int(math.sqrt(nvar)) + 1):
		if nvar % i == 0:
			x = i
			yy = nvar // i
			for j in range(i + 1, int(math.sqrt(yy)) + 1):
				if yy % j == 0:
					y = j
					z = yy // j
					if z >= 2 and z != y and (z != x):
						flag = True
						l = [x, y, z]
						print('YES')
						print(*l)
						break
			if flag:
				break
	if flag == False:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	(a, b, c) = (1, 1, 1)
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0:
			a = i
			break
	if a == 1:
		print('NO')
		continue
	n //= a
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0 and i != a:
			b = i
			break
	if b == 1:
		print('NO')
		continue
	n //= b
	if n not in [1, a, b]:
		print('YES')
		print(a, b, n)
	else:
		print('NO')


import math

def primeFactors(n):
	li = []
	while n % 2 == 0:
		li.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			li.append(i)
			n = n // i
	if n > 2:
		li.append(n)
	return li
for _ in range(int(input())):
	n = int(input())
	li = primeFactors(n)
	d = dict()
	for i in li:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	if len(d) == 1:
		x = li[0]
		if d[x] >= 6:
			print('YES')
			print(x, x * x, pow(x, d[x] - 3))
		else:
			print('NO')
	if len(d) >= 3:
		x = 1
		lee = []
		for i in d:
			lee.append((i, d[i]))
		a = pow(lee[0][0], lee[0][1])
		b = pow(lee[1][0], lee[1][1])
		c = 1
		for i in range(2, len(d)):
			c = c * pow(lee[i][0], lee[i][1])
		print('YES')
		print(a, b, c)
	if len(d) == 2:
		lee = []
		for i in d:
			lee.append((i, d[i]))
		if lee[0][1] >= 3:
			print('YES')
			x = lee[0][1]
			print(lee[0][0], pow(lee[0][0], lee[0][1] - 1), pow(lee[1][0], lee[1][1]))
		elif lee[1][1] >= 3:
			print('YES')
			x = lee[1][1]
			print(pow(lee[0][0], lee[0][1]), lee[1][0], pow(lee[1][0], lee[1][1] - 1))
		elif lee[0][1] == 2 and lee[1][1] == 2:
			print('YES')
			print(lee[0][0], lee[0][0] * lee[1][0], lee[1][0])
		else:
			print('NO')


import math
t = int(input())
while t > 0:
	n = int(input())
	fact = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if i * int(n / i) == n:
			if i != int(n / i):
				fact.append(i)
				fact.append(int(n / i))
			else:
				fact.append(i)
	fact.sort()
	flag = 0
	for i in range(len(fact) - 1):
		for j in range(i + 1, len(fact)):
			if fact[i] * fact[j] < n and n % (fact[i] * fact[j]) == 0:
				num = int(n / (fact[i] * fact[j]))
				if num != fact[i] and num != fact[j]:
					flag = 1
					break
		if flag == 1:
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		print(fact[i], fact[j], num)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	tf = False
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			a = i
			b = n // i
			tf = True
			break
	if tf:
		tf = False
		for i in range(2, int(b ** (1 / 2)) + 1):
			if b % i == 0:
				if i != a and b // i != a and (b // i != i):
					c = b // i
					b = i
					tf = True
					break
		if tf:
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())

def fd(n):
	a = []
	for i in range(2, 1 + int(n ** 0.5)):
		if n % i == 0:
			a.append(i)
			a.append(n // i)
	return list(set(a))
for _ in range(t):
	n = int(input())
	found = False
	d = fd(n)
	for i in d:
		tt = fd(n // i)
		if len(tt) > 1 and tt[0] != tt[-1] and (tt[0] != i) and (tt[-1] != i) and (tt[0] * tt[-1] * i == n):
			print('YES')
			print(tt[0], tt[-1], i)
			found = True
			break
	if not found:
		print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
from math import ceil, sqrt
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 li():
	return list(mi())
mod = 1000000007
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)]
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}
abc = 'abcdefghijklmnopqrstuvwxyz'

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):
	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 fact(n):
	f = 1
	for i in range(1, n + 1):
		f *= i
	return f

def f(n):
	a = []
	a.append(1)
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			if i == n // i:
				a.append(i)
			else:
				a.append(i)
				a.append(n // i)
	return a
t = ii()
while t:
	t -= 1
	n = ii()
	f = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			a = []
			a.append(i)
			x = n // i
			for j in range(2, int(sqrt(x)) + 1):
				if x % j == 0 and j not in a:
					a.append(j)
					a.append(x // j)
					if len(set(a)) == 3:
						print('YES')
						print(*a)
						f = 1
						break
			if f == 1:
				break
			a = []
			a.append(n // i)
			x = i
			for j in range(2, int(sqrt(x)) + 1):
				if x % j == 0 and j not in a:
					a.append(j)
					a.append(x // j)
					if len(set(a)) == 3:
						print('YES')
						print(*a)
						f = 1
						break
			if f == 1:
				break
	if f == 0:
		print('NO')


import functools
import heapq as hp
import collections
import bisect
import math

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int, rev=False):
	return sorted(map(func, input().split()), reverse=rev)

def ml_unpack(n):
	return [int(input()) for i in range(n)]

def range_n():
	return range(int(input()))

def getint():
	return int(input())

def counter(a):
	d = {}
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	return d

def main():
	for _ in range_n():
		n = getint()
		d = {}
		i = 2
		while i * i <= n:
			if i > n:
				break
			if not n % i:
				d[i] = 0
			while not n % i:
				n //= i
				d[i] += 1
			if len(d) == 2:
				break
			i += 1
		if n > 1:
			d[n] = 1
		key = list(d)
		if len(key) == 1 and d[key[0]] > 5:
			k = key[0]
			(a, b, c) = (k, k ** 2, k ** (d[k] - 3))
		elif len(key) == 2:
			(a, b) = key
			if d[a] > 2:
				b = b ** d[b]
				c = a ** (d[a] - 1)
			elif d[b] > 2:
				a = a ** d[a]
				c = b ** (d[b] - 1)
			elif d[a] == d[b] == 2:
				c = a * b
			else:
				print('NO')
				continue
		elif len(key) == 3:
			(a, b, c) = key
			(a, b, c) = (a ** d[a], b ** d[b], c ** d[c])
		else:
			print('NO')
			continue
		print('YES')
		print(a, b, c)
main()


def compute_problem(n):
	if n < 24:
		print('NO')
	elif n % 10 == 0:
		a = 2
		n_div_10 = int(n / 10)
		b = min(5, n_div_10)
		c = max(5, n_div_10)
		if b != c:
			print('YES')
			print(a, b, c, sep=' ')
		else:
			print('NO')
	else:
		result_found = False
		max_a = int(n ** (1.0 / 3.0)) + 1
		for a in range(2, max_a):
			if not n % a == 0:
				continue
			max_b = int((int(n / a) + 1) ** (1.0 / 2.0)) + 1
			for b in range(a + 1, max_b):
				prod_ab = a * b
				c = int(n / prod_ab)
				result_found = n % prod_ab == 0 and prod_ab != n and (c != a) and (c != b)
				if result_found:
					print('YES')
					print(a, b, c, sep=' ')
					break
			if result_found:
				break
		if not result_found:
			print('NO')
num_tests = int(input())
for test_num in range(0, num_tests):
	test_case = input()
	if test_case:
		aim_num = int(test_case)
		compute_problem(aim_num)


for nt in range(int(input())):
	n = int(input())
	if n < 24:
		print('NO')
		continue
	p = []
	curr = 2
	while curr * curr < n:
		if n % curr == 0:
			n = n // curr
			p.append(curr)
		if len(p) == 2:
			break
		curr += 1
	if len(p) <= 1:
		print('NO')
		continue
	if n not in p:
		print('YES')
		print(p[0], p[1], n)
	else:
		print('NO')


import math
t = int(input())
while t:
	n = int(input())
	nn = n
	a = 0
	b = 0
	c = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			n /= i
			break
	for i in range(a + 1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			b = i
			n /= i
			break
	if a and b:
		c = int(nn / (a * b))
	if a * b * c == nn and b != c:
		print('YES')
		print(a, b, c, end=' ')
		print()
	else:
		print('NO')
	t -= 1


def my_def(x):
	(a, b, c) = (1, 1, 1)
	for j in range(2, int(x ** 0.5) + 2):
		while x % j == 0:
			if a == 1:
				a = j
			elif b == 1 or b == a:
				b *= j
			else:
				return (a, b, x)
			x //= j
	return (a, b, x)
n = int(input())
for i in range(n):
	x = int(input())
	(a, b, c) = my_def(x)
	if a != b and b != c and (a != c) and (a != 1) and (b != 1) and (c != 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	d = set()
	for i in range(2, int(math.sqrt(n)) + 1):
		if len(d) >= 2:
			break
		if n % i == 0:
			d.add(i)
			n = n // i
	if len(d) < 2 or n == 1 or n in d:
		print('NO')
	else:
		print('YES')
		for t in d:
			print(t, end=' ')
		print(n)


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
for _ in range(int(input())):
	n = int(input())
	ans = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and i not in ans:
			n //= i
			ans.append(i)
			break
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and i not in ans:
			n //= i
			ans.append(i)
			break
	if len(ans) < 2 or n == 1 or n in ans:
		print('NO')
	else:
		ans.append(n)
		print('YES')
		print(ans[0], ans[1], ans[2])


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(2, int(n ** (1 / 2) + 1)):
		if n % i == 0:
			n = n // i
			a.append(i)
		if len(a) == 2:
			if n not in a:
				a.append(n)
				break
			else:
				break
	if len(a) == 3:
		print('YES')
		for i in range(3):
			a[i] = str(a[i])
		print(' '.join(a))
	else:
		print('NO')


import atexit
import io
import sys
import math
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def find(n, x):
	for c in range(x, int(math.sqrt(n)) + 1):
		if n % c == 0:
			return c
	return 0
for _ in range(int(input())):
	n = int(input())
	a = find(n, 2)
	if a:
		b = find(n // a, a + 1)
		if b:
			c = n // (a * b)
	if (a and b and c) and a != b != c != a and (a * b * c == n):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


def P(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
t = int(input())
for i in range(t):
	x = int(input())
	p = P(x)
	if len(p) > 2:
		a = p[0]
		b = p[1]
		c = 1
		for i in range(2, len(p)):
			if a == b:
				b = b * p[i]
			else:
				c *= p[i]
		if c != 1 and a != b and (b != c) and (c != a):
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		print('NO')


def factor(n):
	a = []
	for x in range(2, int(n ** 0.5) + 1):
		if n % x == 0 and x != n // x:
			a.append([x, n // x])
	return a
t = int(input())
while t:
	t = t - 1
	found = False
	n = int(input())
	for f in range(2, int(n ** 0.5) + 1):
		if n % f == 0:
			j = factor(n // f)
			for x in j:
				if x[0] != f and x[1] != f:
					print('YES')
					print(f, x[0], x[1])
					found = True
					break
		if found:
			break
	if found == False:
		print('NO')


from math import sqrt

def fatores(n):
	fat = {}
	for p in range(2, int(sqrt(n) + 1)):
		while n % p == 0:
			n /= p
			if not fat.get(p):
				fat[p] = 0
			fat[p] += 1
		p += 1
	if n > 1:
		fat[int(n)] = 1
	return fat
for _ in range(int(input())):
	n = int(input())
	f = [list(i) for i in fatores(n).items()]
	q = 0
	ans = [1, 1, 1]
	for i in range(len(f)):
		(p, m) = f[i]
		cont = 1
		while cont <= f[i][1]:
			f[i][1] -= cont
			ans[q] *= f[i][0] ** cont
			cont += 1
			q += 1
			if q == 3:
				break
		if q == 3:
			break
	for i in f:
		ans[2] *= i[0] ** i[1]
	if ans[0] != ans[1] and ans[0] != ans[2] and (ans[1] != ans[2]) and (min(ans) >= 2):
		print('YES')
		print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	list_of_nums = [1]
	for i in range(2, int(pow(num, 0.5) + 1)):
		if num % i == 0:
			num = num // i
			list_of_nums.append(i)
			break
	for i in range(2, int(pow(num, 0.5)) + 1):
		if num % i == 0 and i not in list_of_nums:
			num //= i
			list_of_nums.append(i)
			break
	if num not in list_of_nums and len(list_of_nums) > 2:
		print('YES')
		list_of_nums = [str(x) for x in list_of_nums]
		print(num, ' '.join(list_of_nums[1:]))
	else:
		print('NO')


import math

def factors(n):
	num = int(math.sqrt(n)) + 1
	fac = []
	for i in range(2, num):
		if n % i == 0:
			fac.append(i)
			n = n // i
			if len(fac) == 2:
				break
	if len(fac) == 2 and n > fac[1]:
		print('YES')
		print(fac[0], fac[1], n)
	else:
		print('NO')
for _ in range(int(input())):
	n = int(input())
	if n <= 23:
		print('NO')
	else:
		factors(n)


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

def get_n_ints(n):
	result = []
	i = 0
	while i < n:
		val = input().rstrip('\n')
		result.append(int(val))
		i += 1
	return result

def problem(number):
	seen = list()
	i = 2
	while i * i <= number:
		if i not in seen:
			if number % i == 0:
				seen.append(i)
				number = number // i
		if len(seen) == 2 and number > seen[-1]:
			seen.append(number)
			print('YES')
			print(*seen)
			return
		i += 1
	print('NO')
n = inp()
arr = get_n_ints(n)
for i in range(n):
	problem(arr[i])


t = int(input())
for i in range(t):
	n = int(input())
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			break
		else:
			d += 1
	if len(Ans) == 0:
		Ans.append(n)
	n //= Ans[-1]
	while d * d <= n:
		if n % d == 0 and Ans[-1] != d:
			Ans.append(d)
			break
		else:
			d += 1
	if len(Ans) == 1:
		Ans.append(1)
	if len(Ans) >= 2:
		c = n // Ans[-1]
		if c >= 2 and Ans[0] >= 2 and (Ans[1] >= 2) and (c != Ans[-1] != Ans[-2]):
			Ans.append(c)
			print('YES')
			print(*Ans)
		else:
			print('NO')
	else:
		print('NO')


import math
primes = [2]
for n in range(3, math.ceil(math.sqrt(1000000000.0)), 2):
	is_prime = True
	sqrt_n = math.sqrt(n)
	for p in primes:
		if p > sqrt_n:
			break
		if n % p == 0:
			is_prime = False
			break
	if is_prime:
		primes.append(n)
t = int(input())
for _ in range(t):
	n = int(input())
	_n = n
	factors = {}
	for p in primes:
		while _n % p == 0:
			if p not in factors:
				factors[p] = 0
			factors[p] += 1
			_n /= p
	if _n != 1:
		factors[_n] = 1
	f1 = None
	f2 = None
	if len(factors) == 1:
		[f] = list(factors)
		if factors[f] >= 6:
			f1 = f
			f2 = f * f
	elif len(factors) == 2:
		[_f1, _f2] = list(factors)
		if factors[_f1] + factors[_f2] >= 4:
			f1 = _f1
			f2 = _f2
	elif len(factors) >= 3:
		[_f1, _f2] = list(factors)[:2]
		f1 = _f1
		f2 = _f2
	if f1 != None and f2 != None:
		print('YES')
		print(f'{int(f1)} {int(f2)} {int(n / (f1 * f2))}')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	i = 2
	a = 0
	while i * i <= n:
		if n % i == 0:
			a = i
			n = n / i
			break
		i += 1
	i = 2
	b = 0
	while i * i <= n:
		if n % i == 0 and a != i:
			b = i
			n = n / i
			c = n
			break
		i += 1
	if a >= 2 and b >= 2 and (c >= 2) and (c != b) and (c != a):
		print('YES')
		print(int(a), int(b), int(c))
	else:
		print('NO')
	t -= 1


from math import *
for _ in range(int(input())):
	n = int(input())
	nn = n
	l = []
	now = 2
	m = []
	sq = int(sqrt(n))
	while n > 1:
		if n % now == 0:
			while n % now == 0:
				l.append(now)
				n //= now
		else:
			now += 1
		if now > sq:
			break
	if len(l) < 2:
		print('NO')
		continue
	m.append(l[0])
	if l[0] != l[1]:
		m.append(l[1])
	elif len(l) == 2:
		print('NO')
		continue
	else:
		m.append(l[1] * l[2])
	t = nn // (m[0] * m[1])
	if t == 1 or t in m:
		print('NO')
		continue
	else:
		print('YES')
		print(m[0], m[1], t)


def factorization(num):
	pn = []
	while num % 2 == 0:
		pn.append(2)
		num //= 2
	while num % 3 == 0:
		pn.append(3)
		num //= 3
	fg = False
	for i in range(5, int(num ** 0.5) + 1, 6):
		if fg:
			if i > int(num ** 0.5):
				break
			fg = False
		while num % i == 0:
			pn.append(i)
			num //= i
			fg = True
		i += 2
		if fg:
			if i > int(num ** 0.5):
				break
			fg = False
		while num % i == 0:
			pn.append(i)
			num //= i
			fg = True
	if num > 1:
		pn.append(num)
	return pn

def calculation():
	if len(ns) < 3:
		return (0, 0, 0)
	n1 = ns[0]
	n2 = ns[1]
	n3 = 0
	for i in range(2, len(ns)):
		if n2 == n1:
			n2 *= ns[i]
			break
		i -= 1
		break
	if len(ns) > i + 1:
		n3 = ns[i + 1]
	else:
		return (0, 0, 0)
	for i in range(i + 2, len(ns)):
		n3 *= ns[i]
	if n1 != n2 and n2 != n3 and (n1 != n3):
		return (n1, n2, n3)
	return (0, 0, 0)
t = int(input())
for _ in range(t):
	n = int(input())
	if n > 23:
		ns = factorization(n)
		(n1, n2, n3) = calculation()
		if n1 > 0:
			print('YES')
			print(n1, n2, n3)
		else:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	d = []
	temp = n
	while n % 2 == 0:
		d.append(2)
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			d.append(i)
			n //= i
	if n > 2:
		d.append(n)
	if len(d) < 3:
		print('NO')
	elif len(d) == 3 and (d[0] == d[1] or d[1] == d[2]):
		print('NO')
	else:
		a = d[0]
		if d[1] == d[0]:
			b = d[1] * d[2]
			c = int(temp / (a * b))
		else:
			b = d[1]
			c = int(temp / (a * b))
		if a == b or a == c or b == c:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


from math import sqrt
T = int(input())
for z in range(T):
	N = int(input())
	num = N
	i = 2
	nums = []
	found = 0
	s = int(sqrt(N))
	while i <= s:
		if num % i == 0:
			nums.append(i)
			num = num // i
			found += 1
			if found == 2:
				if num not in nums:
					found = 3
					nums.append(num)
					break
		i += 1
	if found == 3:
		print('YES')
		print(*nums)
	else:
		print('NO')


import math
from collections import defaultdict

def primeFactors(n):
	d = defaultdict(int)
	while n % 2 == 0:
		d[2] += 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			d[i] += 1
			n = n / i
	if n > 2:
		d[n] += 1
	return d
t = int(input())
for i in range(t):
	n = int(input())
	d = primeFactors(n)
	if len(d.keys()) >= 3:
		print('YES')
		s = []
		ww = 1
		for j in list(d.keys())[:2]:
			s.append(int(j))
			ww *= j ** (d[j] - 1)
		for j in list(d.keys())[2:]:
			ww *= int(j ** d[j])
		s.append(ww)
		print(*s)
	elif len(list(d.keys())) == 1:
		(w, w1) = (int(list(d.keys())[0]), int(d[list(d.keys())[0]]))
		if w1 >= 6:
			print('YES')
			ans = '{} {} {}'.format(w, w ** 2, w ** (w1 - 3))
			print(ans)
		else:
			print('NO')
	elif len(list(d.keys())) == 2:
		keys = list(map(int, list(d.keys())))
		value = list(map(int, list(d.values())))
		if sum(value) >= 4:
			print('YES')
			ans = '{} {} {}'.format(keys[0], keys[1], keys[0] ** (value[0] - 1) * keys[1] ** (value[1] - 1))
			print(ans)
		else:
			print('NO')


for i in range(int(input())):
	n = int(input())
	m = []
	i = 2
	while i ** 2 < n and len(m) != 2:
		if n % i == 0:
			m.append(i)
			n = n / i
		i += 1
	if len(m) != 2 or n == 1:
		print('NO')
		continue
	m.append(int(n))
	print('YES')
	for i in m:
		print(i, end=' ')
	print()


import math
n = int(input())

def sd(n, notin):
	i = 2
	while i * i < n:
		if n % i == 0 and i not in notin:
			return i
		i += 1
	return n
for i in range(n):
	a = int(input())
	aa = a
	sq = int(math.sqrt(a)) + 1
	divisor = []
	while True:
		s = sd(a, divisor)
		if s == a:
			print('NO')
			break
		a = a // s
		divisor.append(s)
		if len(divisor) == 2:
			if a != divisor[0] and a != divisor[1]:
				print('YES')
				print(divisor[0], divisor[1], a)
			else:
				print('NO')
			break


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 24:
		print('NO')
	else:
		l = []
		temp = n
		for i in range(2, math.ceil(math.sqrt(n)) + 1):
			if temp % i == 0:
				l.append(i)
				temp = temp // i
			if len(l) == 2:
				break
		if len(l) == 2 and temp > l[1]:
			print('YES')
			print(l[0], l[1], temp)
		else:
			print('NO')


import sys
from collections import defaultdict as dc
import math
from bisect import bisect, bisect_left, bisect_right
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	i = 2
	f = 0
	while i <= math.sqrt(n):
		if n % i == 0:
			f = 1
			break
		i += 1
	if f == 0:
		print('NO')
	else:
		f = 0
		n = n // i
		j = 2
		while j <= math.sqrt(n):
			if j not in [1, i] and n % j == 0:
				f = 1
				break
			j += 1
		if f == 0:
			print('NO')
		else:
			n = n // j
			if i != j and n != i and (n != j):
				print('YES')
				print(i, j, n)
			else:
				print('NO')


R = lambda : map(int, input().split(' '))
from math import sqrt

def divs(n):
	(a, b, c) = (2, 2, 2)
	while a <= sqrt(n):
		if n % a == 0:
			n //= a
			break
		a += 1
	b = a + 1
	while b <= sqrt(n):
		if n % b == 0:
			c = n // b
			if c == a or c == b:
				break
			print('YES')
			print(a, b, c)
			n //= b
			return
		b += 1
	print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	divs(n)


t = int(input())
for i in range(t):
	n = int(input())
	a = 1
	for i in range(2, 1001):
		if n % i == 0:
			a = i
			break
	if a == 1:
		print('NO')
		continue
	n //= a
	b = 1
	c = 1
	for i in range(a + 1, int(n ** 0.5) + 1):
		if n % i == 0 and i ** 2 != n:
			b = i
			c = n // i
			break
	if b == 1:
		print('NO')
		continue
	print('YES')
	print(a, b, c)


import os, sys, math, random

def dep(a):
	a0 = a
	res = []
	for b in range(2, int(a ** (1 / 3)) + 1):
		if a % b == 0:
			res.append(b)
			break
	if len(res) == 0:
		return 'NO'
	a /= res[0]
	for b in range(2, int(a ** (1 / 2)) + 1):
		if a % b == 0 and b != res[0]:
			res.append(b)
			break
	if len(res) == 1:
		return 'NO'
	c = int(a0 / res[0] / res[1])
	if c == 1 or c == res[0] or c == res[1]:
		return 'NO'
	res.append(c)
	return 'YES\n' + ' '.join(map(str, res))
T = int(input())
for _ in range(T):
	a = int(input())
	print(dep(a))


def factor(n):
	dict1 = {}
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			if i not in dict1:
				dict1[i] = 1
			if n // i not in dict1:
				dict1[n // i] = 1
	return dict1
for t in range(int(input())):
	n = int(input())
	dict1 = factor(n)
	dict1 = sorted(dict1)
	a = 0
	b = 0
	c = -1
	for i in dict1:
		if a == 0:
			a = i
		else:
			b = i
			d = n // (a * b)
			if d != a and d != b and (d in dict1):
				c = d
				break
	if c == -1:
		print('NO')
	else:
		print('YES')
		print(a, b, c, sep=' ')


from math import sqrt, floor
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 24:
		print('NO')
	else:
		m = floor(sqrt(n)) + 1
		d = 0
		divs = []
		for i in range(2, m):
			if n % i == 0:
				d += 1
				divs.append(i)
				n //= i
				break
		if d == 0:
			print('NO')
		else:
			m = floor(sqrt(n)) + 1
			for i in range(divs[0] + 1, m):
				if n % i == 0:
					d += 1
					divs.append(i)
					n //= i
					break
			if d == 2:
				if n in divs:
					print('NO')
				else:
					divs.append(n)
					ans = map(str, divs)
					print('YES')
					print(' '.join(ans))
			else:
				print('NO')


import math

def divisors(n):
	divs = list()
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			divs.extend([i, n // i])
	return list(sorted(set(divs)))

def valid(first, second, third, result):
	return third > 1 and third != first and (third != second) and (first * second * third == result)
n = int(input())
for _ in range(n):
	value = int(input())
	divs = divisors(value)
	temp = value
	if len(divs) == 0:
		print('NO')
		continue
	if len(divs) == 1:
		first = divs[0]
		second = first * first
		third = value // (first * second)
		if valid(first, second, third, value):
			print('YES')
			print(first, second, third)
		else:
			print('NO')
		continue
	found = False
	for i in range(len(divs)):
		for j in range(i + 1, len(divs)):
			(first, second) = (divs[i], divs[j])
			if valid(first, second, value // (first * second), value):
				print('YES')
				print(first, second, value // (first * second))
				found = True
			elif valid(first, first * first, value // first ** 3, value):
				print('YES')
				print(first, first * first, value // first ** 3)
				found = True
			if found:
				break
		if found:
			break
	if not found:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ok = False
	c = 2
	while not ok and c * c * c <= n:
		if n % c != 0:
			c += 1
			continue
		b = c + 1
		while not ok and b * b <= n // c:
			if n // c % b != 0:
				b += 1
				continue
			a = n // (c * b)
			if a > b:
				print('YES')
				print(a, b, c)
				ok = True
			b += 1
		c += 1
	if not ok:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	flag = False
	if n < 24:
		print('NO')
	elif n == 24:
		print('YES')
		print(2, 3, 4)
	else:
		for a in range(2, int(math.sqrt(n)) + 1):
			if n % a == 0:
				tn = int(n / a)
				for b in range(a + 1, int(math.sqrt(tn)) + 1):
					if tn % b == 0:
						c = int(tn / b)
						if c != b and a != c:
							print('YES')
							print(a, b, c)
							flag = True
							break
			if flag is True:
				break
		if flag is False:
			print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	t = n
	a1 = []
	while n % 2 == 0:
		(a1.append(2),)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			(a1.append(int(i)),)
			n = n / i
	if n > 2:
		a1.append(int(n))
	l = len(a1)
	a = list(set(a1))
	p = len(a)
	if p == 1 and l >= 6:
		if a[0] != t // a[0] ** 3 and a[0] ** 2 != t // a[0] ** 3:
			print('YES')
			print(a[0], a[0] ** 2, t // a[0] ** 3)
		else:
			print('NO')
	elif p >= 2 and l >= 3:
		if a[0] != t // (a[0] * a[1]) and a[1] != t // (a[0] * a[1]):
			print('YES')
			print(a[0], a[1], t // (a[0] * a[1]))
		else:
			print('NO')
	else:
		print('NO')


import sys
from math import sqrt
inp = sys.stdin.readline
for i in range(int(inp())):
	n = int(inp())
	arr = ''
	c = 0
	flag = 0
	for i in range(2, round(sqrt(n)) + 1):
		if n % i == 0:
			c += 1
			arr += str(i) + ' '
			n = n // i
			if c == 2 and n > i:
				flag = 1
				arr += str(n)
				break
	if flag:
		print('YES\n' + arr)
	else:
		print('NO')


from math import sqrt
t = int(input())
while t > 0:
	d = list()
	n = int(input())
	imp = int(n)
	ctr = 0
	for i in range(2, int(sqrt(n))):
		while n % i == 0:
			n //= i
			d.append(i)
	if n > 1:
		d.append(n)
	if len(set(d)) == 2 and len(d) >= 4:
		print('YES')
		print(d[0], d[-1], int(imp / (d[0] * d[-1])))
		ctr += 1
	if len(set(d)) >= 3 or (len(d) >= 6 and ctr != 1):
		print('YES')
		if len(set(d)) >= 3:
			print(d[0], d[-1], int(imp / (d[0] * d[-1])))
			ctr += 1
		else:
			print(d[0], d[0] ** 2, int(imp / d[0] ** 3))
			ctr += 1
	if ctr == 0:
		print('NO')
	t -= 1


import sys
import os
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')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def findFactor(n):
	lst = set()
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			lst.add(i)
			lst.add(n // i)
	return list(lst)

def solve(n):
	for i in findFactor(n):
		for j in findFactor(i):
			a = j
			b = i // j
			c = n // i
			if a != b and b != c and (a != c):
				print('YES')
				return str(a) + ' ' + str(b) + ' ' + str(c)
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


def prime(n):
	if n < 3:
		return not n & 1
	res = True
	i = 2
	while i * i <= n:
		if n % i == 0:
			res = False
			break
		i += 1
	return res

def sieve(n):
	num = [True] * (n + 1)
	i = 2
	primes = []
	while i * i < n + 1:
		if num[i]:
			j = i * i
			while j <= n:
				num[j] = False
				j += i
		i += 1
	for i in range(2, n + 1):
		if num[i]:
			primes.append(i)
	return primes
primes = sieve(10 ** 6)

def factor(n, i=0):
	if n == 1:
		return ' '
	if prime(n):
		return str(n) + ':' + '1' + '  '
	while primes[i] <= n:
		if n % primes[i] == 0:
			l = 0
			while n % primes[i] == 0:
				n //= primes[i]
				l += 1
			return str(primes[i]) + ':' + str(l) + ' ' + factor(n, i + 1)
		i += 1

def main():
	for _ in range(int(input())):
		n = int(input())
		s = factor(n)
		s = s.split(' ')
		s.pop(-1)
		s.pop(-1)
		s = [list(map(int, e.split(':'))) for e in s]
		a = s[0][0]
		s[0][1] -= 1
		if s[0][1] >= 2:
			b = s[0][0] ** 2
			s[0][1] -= 2
			c = n // (a * b)
		else:
			try:
				b = s[0][0] ** s[0][1] * s[1][0]
				s[1][1] -= 1
				c = n // (a * b)
			except:
				b = s[0][0] ** s[0][1]
				c = 1
		res = a > 1 and b > 1 and (c > 1) and (a != b) and (b != c) and (a != c)
		if res:
			print('YES')
			print(a, b, c)
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	fac = []
	rem = 1
	if n % 2 == 0:
		n /= 2
		fac.append(2)
		tot = 1
		tot *= 2
		added = 2
		x = 1
		while n > 1 and n % 2 == 0:
			x *= 2
			n /= 2
			tot *= 2
			if fac[-1] < x:
				fac.append(x)
				added *= x
				x = 1
			if len(fac) >= 3:
				rem *= n
				n = 1
				break
		rem *= tot / added
	i = 3
	while n > 1:
		if n % i == 0:
			n /= i
			fac.append(i)
			tot = 1
			tot *= i
			added = i
			x = 1
			while n > 1 and n % i == 0:
				x *= i
				n /= i
				tot *= i
				if fac[-1] < x:
					fac.append(x)
					added *= x
					x = 1
				if len(fac) >= 3:
					break
			rem *= tot / added
			if len(fac) >= 3:
				rem *= n
				n = 1
				break
		if i * i >= n:
			if n > 1 and n not in fac:
				fac.append(n)
			else:
				rem *= n
			n = 1
			break
		i += 2
	if len(fac) >= 3:
		a = fac[0]
		b = fac[1]
		c = fac[2]
		for x in fac[3:]:
			c *= x
		c *= rem
		print('YES')
		print(int(a), int(b), int(c))
	elif len(fac) >= 2 and rem > 1 and (rem not in fac):
		a = fac[0]
		b = fac[1]
		c = rem
		print('YES')
		print(int(a), int(b), int(c))
	else:
		print('NO')


import math
t = int(input())

def get_fac(n, cr, ml):
	for i in range(2, ml + 1):
		if not cr[i]:
			continue
		if n % i == 0:
			cr[i] = False
			return i
		else:
			for j in range(1, ml // i):
				cr[i * j] = False
for _ in range(t):
	n = int(input())
	ml = int(pow(n, 1 / 3) // 1)
	cr = [True for _ in range(ml + 1)]
	a = get_fac(n, cr, ml)
	if not a:
		print('NO')
		continue
	nml = int(pow(int(n / a), 1 / 2))
	cr = [True for _ in range(nml + 1)]
	if a <= nml:
		cr[a] = False
	b = get_fac(int(n / a), cr, nml)
	if not b:
		print('NO')
		continue
	c = n // (a * b)
	if c == a or c == b:
		print('NO')
		continue
	print('YES')
	print(a, b, c)


from math import sqrt

def main():
	for _ in range(int(input())):
		n = int(input())
		d = n
		ret = []
		for i in range(2, int(sqrt(n))):
			if d % i == 0:
				d /= i
				ret.append(i)
			if len(ret) == 2:
				break
		if len(ret) < 2:
			print('NO')
			continue
		(a, b) = ret
		c = n // (a * b)
		if a == c or b == c or a * b * c != n:
			print('NO')
			continue
		print('YES')
		print(a, b, c)
main()


from math import sqrt
n = int(input())
for i in range(n):
	q = int(input())
	qq = q
	for i in range(2, int(sqrt(q)) + 1):
		if q % i == 0:
			a = i
			q //= i
			break
	else:
		print('NO')
		continue
	for i in range(a + 1, int(sqrt(q)) + 1):
		if q % i == 0:
			b = i
			c = qq // (a * b)
			break
	else:
		print('NO')
		continue
	if a == b or b == c or a == c:
		print('NO')
		continue
	print('YES')
	print(a, b, c)


for _ in range(int(input())):
	n = int(input())
	ans = False
	for i in range(2, int(n ** 0.5) + 1):
		a = i
		if n % i == 0:
			div = n // i
			for j in range(2, int(div ** 0.5) + 1):
				if div % j == 0 and j != a:
					div2 = div // j
					if div2 != 1 and div2 != j and (div2 != a):
						ans = True
						break
			if ans:
				break
	if ans:
		print('YES')
		print(a, div // div2, div2)
	else:
		print('NO')


def facts(n):
	l = []
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			l.append(i)
			l.append(n // i)
	return list(set(l))
for _ in range(int(input())):
	n = int(input())
	l = facts(n)
	l.sort()
	d = {}
	for i in l:
		d[i] = 0
	flag = 0
	for i in range(len(l)):
		for j in range(i + 1, len(l)):
			(a, b) = (l[i], l[j])
			c = n // (a * b)
			try:
				if d[c] == 0 and a != c and (b != c):
					print('YES')
					print(a, b, c)
					flag = 1
			except:
				continue
			if flag:
				break
		if flag:
			break
	if not flag:
		print('NO')


from sys import stdin
import math
t = int(stdin.readline().rstrip())
while t > 0:
	n = int(stdin.readline().rstrip())
	p = int(math.floor(math.sqrt(n)))
	l = []
	(a, b) = (-1, -1)
	for i in range(2, p + 1):
		if n % i == 0:
			a = i
			n //= a
			break
	for i in range(2, p + 1):
		if n % i == 0 and i != a:
			b = i
			n //= b
			break
	f = 0
	if n == 1 or n == a or n == b:
		f = 1
	if a == -1 or b == -1:
		f = 1
	if f == 0:
		print('YES')
		print(str(a) + ' ' + str(b) + ' ' + str(n))
	else:
		print('NO')
	t -= 1


t = int(input())

def factorization(n):
	ind = []
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			ind.append(cnt)
			arr.append(i)
	if temp != 1:
		ind.append(1)
		arr.append(temp)
	if arr == []:
		ind.append(1)
		arr.append(n)
	return (arr, ind)
for i in range(t):
	n = int(input())
	(arr, ind) = factorization(n)
	if len(arr) == 1:
		if ind[0] >= 6:
			print('YES')
			print(arr[0], arr[0] ** 2, arr[0] ** (ind[0] - 3))
		else:
			print('NO')
	elif len(arr) == 2:
		if ind[0] >= 3:
			print('YES')
			print(arr[0], arr[0] ** 2, arr[0] ** (ind[0] - 3) * arr[1] ** ind[1])
		elif ind[1] >= 3:
			print('YES')
			print(arr[1], arr[1] ** 2, arr[1] ** (ind[1] - 3) * arr[0] ** ind[0])
		elif ind[0] >= 2 and ind[1] >= 2:
			print('YES')
			print(arr[0], arr[1], arr[0] ** (ind[0] - 1) * arr[1] ** (ind[1] - 1))
		else:
			print('NO')
	else:
		print('YES')
		print(arr[0], arr[1], n // arr[0] // arr[1])


import math

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors
t = int(input())
for q in range(t):
	n = int(input())
	factor = primeFactors(n)
	if len(factor) < 3:
		print('NO')
		continue
	(a, b, c) = (0, 0, 0)
	a = factor[0]
	b = 1
	c = 1
	for i in range(1, len(factor)):
		b *= factor[i]
		if b != a:
			cin = i
			break
	for i in range(cin + 1, len(factor)):
		c *= factor[i]
	if len(set([a, b, c])) == 3 and a >= 2 and (b >= 2) and (c >= 2):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	ans = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			cnt += 1
			ans.append(i)
		if cnt == 2 and n % (ans[0] * ans[1]) == 0 and (n // (ans[0] * ans[1]) != ans[0]) and (n // (ans[0] * ans[1]) != ans[1]):
			break
		if cnt == 2 and n % (ans[0] * ans[1]) != 0:
			del ans[1]
			cnt -= 1
	if cnt == 2:
		if n % (ans[0] * ans[1]) == 0 and n // (ans[0] * ans[1]) != ans[0] and (n // (ans[0] * ans[1]) != ans[1]):
			ans.append(n // (ans[0] * ans[1]))
	if len(ans) == 3:
		print('YES')
		print(*ans)
	else:
		print('NO')


from collections import Counter

def min_del(n, mn):
	for x in range(max(2, mn), int(n ** 0.5) + 1):
		if n % x == 0:
			return x
	return n
for _ in range(int(input())):
	n = int(input())
	a = min_del(n, 1)
	ab = n // a
	b = min_del(ab, a + 1)
	c = n // b // a
	if c != a and c != b and (c > 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = n
	i = 2
	while i ** 2 < n:
		if n % i == 0:
			a = i
			n //= i
			break
		i += 1
	if a == n:
		print('NO')
		continue
	b = n
	i = a + 1
	while i ** 2 < n:
		if n % i == 0:
			b = i
			n //= i
			break
		i += 1
	if b == n:
		print('NO')
		continue
	print('YES')
	print(a, b, n)


import math
t = int(input())
for i in range(t):
	n = int(input())
	flag = 0
	for j in range(2, int(pow(n, 0.5) + 1)):
		if n % j == 0:
			n1 = n // j
			for k in range(j + 1, int(pow(n1, 0.5) + 1)):
				n2 = n1 // k
				if n1 % k == 0 and n2 != k:
					flag = 1
					n2 = n1 // k
					print('YES')
					print(j, end=' ')
					print(k, end=' ')
					print(n2)
					break
			break
	if flag == 0:
		print('NO')


import os
import math

def f(n):
	result = []
	now = 2
	while len(result) < 2 and now < math.sqrt(n):
		if n % now == 0:
			result.append(now)
			n //= now
		now += 1
	if len(result) == 2 and n not in result:
		return f'YES\n{result[0]} {result[1]} {n}'
	else:
		return 'NO'
if os.environ.get('DEBUG', False):
	print(f'{f(64)} = 2 4 8 ')
	print(f'{f(32)} = NO')
	print(f'{f(97)} = NO')
	print(f'{f(2)} = NO')
	print(f'{f(12345)} = 3 5 823')
else:
	for _ in range(int(input())):
		print(f(int(input())))


import sys

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

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

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

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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

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

def factorize(num: int) -> dict:
	from math import sqrt
	from collections import Counter
	d = Counter()
	for i in range(2, int(sqrt(num)) + 1):
		while num % i == 0:
			num //= i
			d[i] += 1
		if num == 1:
			break
	if num != 1:
		d[num] += 1
	return d
for _ in range(INT()):
	N = INT()
	primes = sorted(factorize(N).items())
	ans = [1] * 3
	if len(primes) == 1:
		(k, v) = primes[0]
		if v < 6:
			NO()
			continue
		ans[0] = k
		ans[1] = k ** 2
		ans[2] = k ** (v - 3)
	elif len(primes) == 2:
		(k1, v1) = primes[0]
		(k2, v2) = primes[1]
		if v1 == 1 and v2 <= 2 or (v1 <= 2 and v2 == 1):
			NO()
			continue
		ans[0] = k1
		ans[1] = k2
		ans[2] = k1 ** (v1 - 1) * k2 ** (v2 - 1)
	else:
		for (i, (k, v)) in enumerate(primes):
			if i < 2:
				ans[i] = k ** v
			else:
				ans[2] *= k ** v
	YES()
	print(*ans)


import math

def primeFactors(n):
	f = []
	while n % 2 == 0:
		(f.append(2),)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			(f.append(i),)
			n = n / i
	if n > 2:
		f.append(n)
	return f
t = int(input())
while t > 0:
	n = int(input())
	l = primeFactors(n)
	s = list(set(l))
	ss = len(s)
	sl = len(l)
	if sl <= 2:
		print('NO')
	elif ss == 1 and sl < 6:
		print('NO')
	elif ss == 2 and sl < 4:
		print('NO')
	elif ss >= 2:
		l1 = [int(s[0]), int(s[1]), int(n / (s[0] * s[1]))]
		print('YES')
		print(*l1)
	else:
		l2 = [int(s[0]), int(s[0] * s[0]), int(n / (s[0] * s[0] * s[0]))]
		print('YES')
		print(*l2)
	t -= 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	sq = int(math.sqrt(n))
	l = []
	f = 0
	for j in range(2, sq):
		if n % j == 0:
			n = n // j
			l.append(j)
			f = j
			if len(l) == 2:
				break
			elif j > n:
				break
			else:
				f = j
	if len(l) == 2:
		if n > j:
			l.append(n)
			print('YES')
			for x in l:
				print(x, end=' ')
			print()
		else:
			print('NO')
	else:
		print('NO')


import math

def pr(a, m):
	n = len(a)
	d = {}
	l = []
	for i in range(n):
		d[a[i]] = i
	c = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if a[i] * a[j] <= m and a[i] * a[j] != 0 and (m % (a[i] * a[j]) == 0):
				check = m // (a[i] * a[j])
				if check != 1 and check != a[i] and (check != a[j]) and (check in d) and (d[check] > i) and (d[check] > j):
					l = [a[i], a[j], check]
					return l

def p(n):
	l = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				if i != 1:
					l.append(i)
			else:
				if i != 1:
					l.append(i)
				if n // i != 1:
					l.append(n // i)
		i = i + 1
	return l
for _ in range(int(input())):
	x = int(input())
	l = p(x)
	l.sort()
	aa = pr(l, x)
	if aa == None:
		print('NO')
	else:
		print('YES')
		aa.sort()
		print(*aa)


def factors(n):
	factor = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			factor.append(i)
	return factor
t = int(input())
for l in range(t):
	n = int(input())
	x = 0
	factor = factors(n)
	lenfactor = len(factor)
	for i in range(lenfactor):
		for j in range(i + 1, lenfactor):
			k = n / (factor[i] * factor[j])
			if k % 1 == 0 and k != factor[i] and (k != factor[j]):
				print('YES')
				print(str(factor[i]) + ' ' + str(factor[j]) + ' ' + str(int(k)))
				x = 1
				break
		if x == 1:
			break
	if x == 0:
		print('NO')


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	primes = {}
	if not n & 1:
		primes[2] = 0
		while not n & 1:
			n >>= 1
			primes[2] += 1
	f = 3
	lim = int(n ** 0.5) + 1
	while f < lim and f <= n:
		if n % f == 0:
			primes[f] = 0
			while n % f == 0:
				n //= f
				primes[f] += 1
		f += 2
	if n > 1:
		primes[n] = 1
	if len(primes) > 2:
		ans = []
		f = 1
		i = 0
		for (i, (k, p)) in enumerate(primes.items()):
			f *= pow(k, p)
			if i < 2:
				ans.append(f)
				f = 1
		ans.append(f)
		print('YES')
		print(*ans)
	elif len(primes) == 1:
		for (k, p) in primes.items():
			if p > 5:
				ans = [k, k * k, pow(k, p - 3)]
				print('YES')
				print(*ans)
			else:
				print('NO')
	else:
		powers = sum(primes.values())
		if powers > 3:
			fs = []
			for (k, p) in primes.items():
				fs.extend([k] * p)
			ans = []
			if fs[0] != fs[1]:
				ans.append(fs[0])
				ans.append(fs[1])
				rest = 2
			else:
				ans.append(fs[0])
				ans.append(fs[1] * fs[2])
				rest = 3
			c = 1
			for f in fs[rest:]:
				c *= f
			ans.append(c)
			print('YES')
			print(*ans)
		else:
			print('NO')


def func(n):
	l = []
	cnt = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			cnt += 1
			n //= i
			l.append(i)
		if cnt == 2:
			if n > i:
				return 'YES\n' + str(l[0]) + ' ' + str(l[1]) + ' ' + str(n)
			else:
				return 'NO'
	return 'NO'
t = int(input())
f = []
for i in range(t):
	n = int(input())
	a = func(n)
	f.append(a)
for x in f:
	print(x)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

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

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		lis = []
		for i in range(2, int(math.sqrt(n))):
			if n % i == 0:
				lis.append(i)
				n //= i
			if len(lis) == 2:
				lis.append(n)
				break
		lis = list(set(lis))
		lis.sort()
		if len(lis) == 3:
			print('YES')
			print(*lis)
		else:
			print('NO')
main()


import math
n = int(input())

def check_prime(n, k):
	for i in range(k, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			return (0, i)
	return (1, -1)
e = {}
for j in range(n):
	m = int(input())
	d = []
	k = 2
	for _ in range(2):
		x = check_prime(m, k)
		if x[0] != 0:
			break
		else:
			m /= x[1]
			k = x[1] + 1
			d.append(str(x[1]) + ' ')
	if len(d) == 2 and x[1] != m:
		d.append(str(int(m)))
		e[j] = d
for k in range(n):
	if k in e.keys():
		print('YES')
		print(''.join(e[k]))
	else:
		print('NO')


from math import floor, sqrt
try:
	long
except NameError:
	long = int

def fac(n):
	step = lambda x: 1 + (x << 2) - (x >> 1 << 1)
	maxq = long(floor(sqrt(n)))
	d = 1
	q = 2 if n % 2 == 0 else 3
	while q <= maxq and n % q != 0:
		q = step(d)
		d += 1
	return [q] + fac(n // q) if q <= maxq else [n]
for _ in range(int(input())):
	n = int(input())
	l = fac(n)
	l.sort()
	k = len(l)
	if k > 3:
		if len(set([l[0], l[1] * l[2], n // (l[0] * l[1] * l[2])])) == 3:
			print('YES')
			print(l[0], l[1] * l[2], n // (l[0] * l[1] * l[2]))
		elif len(set([l[0], l[1] * l[-1], n // (l[0] * l[1] * l[-1])])) == 3:
			print('YES')
			print(l[0], l[1] * l[-1], n // (l[0] * l[1] * l[-1]))
		elif len(set([l[1], l[0] * l[2], n // (l[0] * l[1] * l[2])])) == 3:
			print('YES')
			print(l[1], l[0] * l[2], n // (l[0] * l[1] * l[2]))
		elif len(set([l[2], l[0] * l[1], n // (l[0] * l[1] * l[2])])) == 3:
			print('YES')
			print(l[2], l[0] * l[1], n // (l[0] * l[1] * l[2]))
		else:
			print('NO')
	elif k == 3 and len(set(l)) == 3:
		print('YES')
		print(l[0], l[1], l[2])
	else:
		print('NO')


def nonprime(number, start=2):
	from math import sqrt
	for i in range(start, int(sqrt(number)) + 1):
		if number % i == 0:
			return [True, i]
	return [False]
testcases = int(input())
for k in range(testcases):
	numbertobetested = int(input())
	initial = nonprime(numbertobetested)
	if initial[0]:
		k = nonprime(numbertobetested // initial[1], start=initial[1] + 1)
		if k[0] and (initial[1] != k[1] and initial[1] != numbertobetested // initial[1] // k[1] and (k[1] != numbertobetested // initial[1] // k[1])):
			print('YES')
			print(str(initial[1]) + ' ' + str(k[1]) + ' ' + str(numbertobetested // initial[1] // k[1]))
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	for a in range(2, int(n ** 0.5) + 1):
		if n % a == 0:
			break
	else:
		print('NO')
		continue
	ne = n // a
	for b in range(2, int(ne ** 0.5) + 1):
		if b == a:
			continue
		if ne % b == 0:
			break
	else:
		print('NO')
		continue
	if ne // b in (a, b):
		print('NO')
	else:
		print('YES')
		print(a, b, ne // b)


t = int(input())
for q in range(t):
	n = int(input())
	i1 = 1
	j1 = 1
	k1 = 1
	q = int(n ** 0.5)
	for i in range(2, q):
		if n % i == 0:
			i1 = i
			break
	if i1 != 1:
		n = n // i1
		for j in range(i1 + 1, q):
			if n % j == 0:
				j1 = j
				break
		if j1 != 1:
			n = n // j1
			if n > j1 and n > i1:
				print('YES')
				print(i1, j1, n)
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
for xx in range(t):
	n = int(input())
	i = 2
	fl = 0
	divs = []
	while i * i <= n:
		if n % i == 0:
			divs.append(i)
			n //= i
		if len(divs) == 2:
			break
		i += 1
	if len(divs) < 2:
		fl = 1
	if fl == 1:
		print('NO')
		continue
	kr = n
	if kr == 1 or kr == divs[0] or kr == divs[1]:
		print('NO')
		continue
	else:
		divs.append(kr)
		print('YES')
		print(' '.join([str(v) for v in divs]))


from math import sqrt
t = int(input())
for test in range(t):
	n = int(input())
	k = int(sqrt(n))
	a = 0
	b = 0
	c = 0
	for j in range(2, k + 1):
		if n % j == 0:
			n = n // j
			a = j
			break
	k = int(sqrt(n))
	for j in range(2, k + 1):
		if n % j == 0 and (not j == a) and (not a == n // j):
			n = n // j
			b = j
			break
	c = n
	if c > 1 and a > 0 and (b > 0) and (not c == b):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
di = dict()

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

def countofmul(n):
	li = list()
	i = 2
	val = 0
	while n >= 2:
		i = couns(i, n)
		if i != 1:
			li.append(i)
			n = n // i
			if len(li) == 3:
				li[-2] *= li[-1]
				li.remove(li[-1])
			if len(li) == 2:
				if li[0] != li[1] and li[1] != n and (li[0] != n) and (n != 1):
					li.append(n)
					return li
		else:
			return []
	return []
n = int(input())
for i in range(n):
	x = int(input())
	r = countofmul(x)
	if len(r) >= 3:
		a = r[0]
		b = r[1]
		c = r[2]
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	(ans, ind) = ([], 2)
	while len(ans) < 2 and ind < n ** (1 / 2):
		if not n % ind:
			n = n // ind
			ans.append(ind)
		ind += 1
	return ans + [n]
for _ in range(int(input())):
	sol = solve()
	if len(sol) == 3:
		print('YES')
		print(' '.join(list(map(str, sol))))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	nd = n
	count2 = 0
	ar = []
	flag = True
	spcount = 0
	while n % 2 == 0:
		spcount += 1
		n //= 2
	if spcount < 3 and spcount >= 1:
		count2 += 1
		ar.append(2)
	elif spcount < 6 and spcount >= 1:
		count2 += 2
		ar.append(2)
		ar.append(4)
	elif spcount >= 6 and spcount >= 1:
		print('YES')
		flag = False
		print(2, 4, nd // 8)
	if flag:
		for i in range(3, int(nd ** (1 / 2)) + 1, 2):
			if n % i == 0:
				n //= i
				count2 += 1
				ar.append(i)
			if count2 >= 2:
				le = nd // (ar[0] * ar[1])
			if count2 >= 2 and le != ar[0] and (le != ar[1]):
				flag = False
				print('YES')
				print(ar[0], ar[1], nd // (ar[0] * ar[1]))
				break
	if flag:
		print('NO')


import math
ts = int(input())
while ts > 0:
	ts = ts - 1
	n = int(input())
	flag = 0
	(a, b, c) = (0, 0, 0)
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			a = i
			n = int(n / a)
			break
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0 and i != a:
			b = i
			n = int(n / b)
			break
	if a != 0 and b != 0:
		c = n
	if c != a and c != b and (c != 1) and (c != 0):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math

def printDivisors(n):
	i = 2
	c = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				c.append(n // i)
			else:
				c.extend([i, n // i])
		i = i + 1
	return c

def countTriplets(arr, n, m):
	count = 0
	arr.sort()
	for end in range(n - 1, 1, -1):
		start = 0
		mid = end - 1
		while start < mid:
			prod = arr[end] * arr[start] * arr[mid]
			if prod > m:
				mid -= 1
			elif prod < m:
				start += 1
			elif prod == m:
				print('YES')
				print(arr[end], arr[start], arr[mid])
				count += 1
				mid -= 1
				start += 1
				return count
	return count
for _ in range(int(input())):
	n = int(input())
	a = printDivisors(n)
	if countTriplets(a, len(a), n) == 0:
		print('NO')


t = int(input())
while t:
	n = int(input())
	cnt = 0
	i = 2
	ans = []
	while True:
		while i * i < n:
			if n % i == 0:
				ans.append(i)
				cnt += 1
				if cnt == 2:
					ans.append(int(n / i))
					break
				n = n / i
			i += 1
		if i * i >= n or cnt == 2:
			break
	if cnt == 2:
		print('YES')
		print(*ans, sep=' ')
	else:
		print('NO')
	t -= 1


T = int(input())
for _ in range(T):
	n = int(input())
	c = 0
	x = []
	_n = n
	end = int(n ** 0.5) + 1
	for i in range(2, end):
		if _n % i == 0:
			c += 1
			_n //= i
			x.append(i)
			if c >= 2:
				break
	if c >= 2 and (not _n in x):
		print('YES')
		print(*x[:2], _n)
	else:
		print('NO')


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	temp = n
	for j in range(2, int(sqrt(n)) + 1):
		if temp % j == 0:
			l.append(j)
			temp = temp // j
		if len(l) == 2:
			break
	if len(l) < 2:
		print('NO')
		continue
	l.append(n // (l[0] * l[1]))
	l.sort()
	(a, b, c) = (l[0], l[1], l[2])
	if a * b * c != n or a == b or b == c or (c == a) or (a == 1) or (b == 1) or (c == 1):
		print('NO')
	else:
		print('YES')
		print(a, b, c)


from math import sqrt
n = int(input())
for i in range(n):
	t = int(input())
	if t < 24:
		print('NO')
		continue
	else:
		(a, b) = (0, 0)
		for j in range(2, int(sqrt(t)) + 1):
			if t % j == 0:
				a = j
				t //= j
				break
		for j in range(2, int(sqrt(t)) + 1):
			if t % j == 0 and j != a:
				b = j
				t //= j
				break
		if a == 0 or b == 0 or t == b or (t == a) or (t < 2):
			print('NO')
		else:
			print('YES')
			print(a, b, t)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	nn = n
	fact = dict()
	i = 2
	while i <= math.sqrt(nn):
		if n % i == 0:
			n //= i
			try:
				fact[i] += 1
			except:
				fact[i] = 1
		else:
			i += 1
	if n != 1:
		fact[n] = 1
	if len(fact) == 0:
		print('NO')
		continue
	if len(fact) > 3:
		k = list(fact.keys())
		print('YES')
		print(k[0] ** fact[k[0]], k[1] ** fact[k[1]], end=' ')
		num = 1
		for i in range(2, len(k)):
			num *= k[i] ** fact[k[i]]
		print(num)
	if len(fact) == 3:
		print('YES')
		(a, b, c) = list(fact.keys())
		print(a ** fact[a], b ** fact[b], c ** fact[c])
	if len(fact) == 1:
		k = list(fact.keys())[0]
		if fact[k] < 6:
			print('NO')
		else:
			print('YES')
			print(k, k * k, k ** (fact[k] - 3))
		continue
	if len(fact) == 2:
		(a, b) = list(fact.keys())
		if fact[a] >= 2 and fact[b] >= 2:
			print('YES')
			print(a, b, a ** (fact[a] - 1) * b ** (fact[b] - 1))
		elif fact[a] == 1 and fact[b] >= 3:
			print('YES')
			print(a, b, b ** (fact[b] - 1))
		elif fact[b] == 1 and fact[a] >= 3:
			print('YES')
			print(a, b, a ** (fact[a] - 1))
		else:
			print('NO')
		continue


import math
from collections import Counter

def pf(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(int(i))
			n = n / i
	if n > 2:
		ans.append(int(n))
	l = len(ans)
	if l <= 2:
		return 'NO'
	(a, b, c) = (0, 0, 0)
	a = ans[0]
	if ans[0] == ans[1]:
		b = ans[1] * ans[2]
		i = 3
	else:
		b = ans[1]
		i = 2
	s = 1
	while i < len(ans):
		s *= ans[i]
		i += 1
	c = s
	if a != b and c != b and (a != c) and (c != 1):
		return [a, b, c]
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = pf(n)
	if a != 'NO':
		print('YES')
		print(*a)
	else:
		print('NO')


from math import *
for _ in range(int(input())):
	n = int(input())
	pos = False
	for a in range(2, int(pow(n, 1 / 3)) + 1):
		if n % a == 0:
			z = n // a
			for b in range(a + 1, int(sqrt(z)) + 1):
				if z % b == 0 and b * b != z:
					pos = True
					print('YES')
					print(a, b, z // b)
					break
		if pos:
			break
	if not pos:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	factors = []
	for factor in range(2, int(math.sqrt(n))):
		if n <= factor:
			break
		if n % factor == 0:
			if n // factor <= factor:
				break
			factors.append(factor)
			n = n // factor
			if len(factors) == 2:
				break
	if len(factors) == 2:
		factors.append(n)
		print('YES')
		print(' '.join(map(str, factors)))
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	n = int(input())
	s = set()
	aqn = n
	for i in range(2, int(math.sqrt(n)) + 1):
		if aqn % i == 0:
			s.add(i)
			aqn = int(aqn / i)
			if len(s) == 2:
				break
	s.add(aqn)
	if len(s) == 3:
		print('YES')
		for i in s:
			print(i, end=' ')
		print()
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	nn = n
	fac = []
	i = 2
	while i * i <= n:
		cnt = 0
		while n % i == 0:
			cnt += 1
			n //= i
		if cnt:
			fac.append((i, cnt))
		i += 1
	if n > 1:
		fac.append((n, 1))
	ok = False
	ans = None
	if len(fac) > 2 or (len(fac) == 2 and fac[0][1] + fac[1][1] > 3):
		ok = True
		ans = (fac[0][0], fac[1][0])
	elif len(fac) == 1 and fac[0][1] >= 6:
		ok = True
		ans = (fac[0][0], int(fac[0][0] ** 2))
	if not ok:
		print('NO')
	else:
		print('YES')
		print(ans[0], ans[1], nn // ans[0] // ans[1])


import math
T = int(input())

def check(n, p):
	ans = -1
	for i in range(p + 1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			ans = i
			break
	return ans
for i in range(T):
	l = []
	n = int(input())
	ans = 'YES'
	hello = 1
	for i in range(3):
		hello = check(n, hello)
		if hello == -1 and n < 2:
			ans = 'NO'
			break
		else:
			if hello == -1 or i == 2:
				hello = n
				if len(l) > 0 and l[-1] == hello:
					ans = 'NO'
					break
			n = n // hello
			l.append(hello)
	print(ans)
	if ans == 'YES':
		print(str(l[0]) + ' ' + str(l[1]) + ' ' + str(l[2]))


for i in range(int(input())):
	n = int(input())
	c = 0
	x = []
	y = n
	for i in range(2, int(n ** 0.5) + 1):
		if y % i == 0:
			c += 1
			y = y // i
			x.append(i)
			if c >= 2:
				break
	print('YES' if c >= 2 and y not in x else 'NO')
	if c >= 2 and y not in x:
		print(*x[:2], y)


import math

def primeFactors(n):
	li = []
	while n % 2 == 0:
		li.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			li.append(i)
			n = n / i
	if n > 2:
		li.append(int(n))
	return li
t = int(input())
for i in range(t):
	n = int(input())
	p = primeFactors(n)
	k = set(p)
	w = list(k)
	if len(w) == 1:
		if p.count(w[0]) > 5:
			print('YES')
			a = p[0]
			b = p[1] * p[2]
			c = 1
			for i in range(3, len(p)):
				c = c * p[i]
			print(str(a) + ' ' + str(b) + ' ' + str(c))
		else:
			print('NO')
	elif len(w) == 2:
		if len(p) <= 3:
			print('NO')
		elif len(p) == 5:
			print('YES')
			a = p[0]
			b = p[1] * p[2] * p[3]
			c = p[4]
			print(str(a) + ' ' + str(b) + ' ' + str(c))
		else:
			print('YES')
			a = p[0]
			b = p[1] * p[2]
			c = 1
			for i in range(3, len(p)):
				c = c * p[i]
			print(str(a) + ' ' + str(b) + ' ' + str(c))
	elif len(w) == 0:
		print('NO')
	elif len(p) == 3:
		print('YES')
		a = p[0]
		b = p[1]
		c = p[2]
		print(str(a) + ' ' + str(b) + ' ' + str(c))
	else:
		print('YES')
		a = p[0]
		b = p[1] * p[2]
		c = 1
		for i in range(3, len(p)):
			c = c * p[i]
		print(str(a) + ' ' + str(b) + ' ' + str(c))


t = int(input())

def find_one_factor(num, a):
	for i in range(2, int(num ** 0.5) + 1):
		if num % i == 0:
			if a == i:
				continue
			return (i, num // i)
	return (-1, -1)
while t:
	t -= 1
	n = int(input())
	flag = True
	factors = []
	(a, num) = find_one_factor(n, 0)
	if a == -1:
		print('NO')
		continue
	(b, num) = find_one_factor(num, a)
	if b == -1:
		print('NO')
		continue
	elif b == num:
		print('NO')
		continue
	c = num
	print('YES')
	print('{} {} {}'.format(a, b, c))


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

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

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

def MAP2():
	return map(float, input().split())

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

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
for tt in range(INT()):
	n = INT()
	x = []
	c = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			x.append(i)
			n //= i
			c += 1
			if c == 2:
				break
	if len(x) < 2:
		print('NO')
	else:
		if x[0] != n and x[1] != n:
			x.append(n)
		if len(x) == 3:
			print('YES')
			print(*x)
		else:
			print('NO')


import math

def divisorGenerator(n):
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			yield i
			if i * i != n:
				large_divisors.append(n / i)
	for divisor in reversed(large_divisors):
		yield divisor

def solver(k):
	divs = list(divisorGenerator(k))[1:-1]
	if len(divs) > 0:
		a = int(divs[0])
		second_divs = [el for el in list(divisorGenerator(k // a))[1:-1] if el > a]
		if len(second_divs) > 0:
			b = int(second_divs[0])
			c = int(k // b // a)
			if k % (b * a) == 0 and c > b:
				print('yes')
				print(f'{a} {b} {c}')
			else:
				print('no')
		else:
			print('no')
	else:
		print('no')
n = int(input())
for i in range(n):
	k = int(input())
	solver(k)


for _ in range(int(input())):
	n = int(input())
	a = []
	f = n
	i = 2
	while len(a) < 2 and i * i <= n:
		if n % i == 0:
			a.append(i)
			n = n // i
		i += 1
	if len(a) < 2 or n in a:
		print('NO')
	else:
		print('YES')
		print(*a, n)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

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

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

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 divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

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):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for i in range(ii()):
	n = ii()
	r = sieve(int(n ** 0.5))
	if prime(n):
		print('NO')
		continue
	else:
		a = []
		for i in r:
			if n % i == 0:
				a.append(i)
				n = n // i
				break
		i = 2
		while i < n ** 0.5:
			if n % i == 0 and i not in a:
				if n // i != i:
					a.append(i)
					a.append(n // i)
					break
			i += 1
		if len(a) == 3:
			print('YES')
			print(a[0], a[1], a[2])
		else:
			print('NO')


def s(a, b):
	i = b + 1
	c = int(a ** 0.5)
	while 1:
		if a % i == 0:
			return i
		elif i < c:
			i += 1
		else:
			return 1
for _ in range(int(input())):
	n = int(input())
	a = s(n, 1)
	if a == 1 or a == n:
		print('NO')
	else:
		a1 = n // a
		a2 = s(a1, a)
		if a2 == 1 or a2 == a1:
			print('NO')
		else:
			a3 = a1 // a2
			b = sorted([a, a2, a3])
			if len(set(b)) == 3:
				print('YES')
				print(b[0], b[1], b[2])
			else:
				print('NO')


import math
from collections import Counter

def primeFactors(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(int(i))
			n = n / i
	if n > 2:
		l.append(int(n))
	return (l, Counter(l))
for _ in range(int(input().strip())):
	n = int(input().strip())
	(ll, pf) = primeFactors(n)
	ll.sort()
	if len(pf) >= 3:
		print('YES')
		a = ll[0]
		b = ll[-1]
		c = 1
		for i in range(1, len(ll) - 1):
			c *= ll[i]
		print(int(a), int(b), int(c))
	elif len(pf) == 2:
		if len(ll) >= 4:
			print('YES')
			a = ll[0]
			b = ll[-1]
			c = 1
			for i in range(1, len(ll) - 1):
				c *= ll[i]
			print(int(a), int(b), int(c))
		else:
			print('NO')
	elif len(ll) >= 6:
		print('YES')
		tot = ll[0] ** len(ll)
		print(ll[0], ll[0] ** 2, tot // (ll[0] * (ll[0] * ll[0])))
	else:
		print('NO')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
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 inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()

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
for _ in range(inp()):
	n = inp()
	pp = prime_factorize(n)
	c = Counter(pp)
	bad = False
	if len(c.keys()) == 1 and len(pp) < 6 or (len(c.keys()) == 2 and len(pp) < 4):
		print('NO')
	else:
		keys = list(c.keys())
		if len(c.keys()) > 1:
			a = keys[0]
			c[keys[0]] -= 1
			b = keys[1]
			c[keys[1]] -= 1
			C = 1
			for key in keys:
				if c[key] == 0:
					continue
				C *= key ** c[key]
		else:
			a = keys[0] * 1
			b = keys[0] ** 2
			C = keys[0] ** (c[keys[0]] - 3)
		print('YES')
		print(a, b, C)


from sys import stdin

def factorize(n):
	result = {}
	rest = 1
	for i in [2, 3, 5]:
		while n % i == 0:
			if i not in result:
				result[i] = 1
			else:
				rest *= i
				if rest not in result:
					result[rest] = 1
					rest = 1
			n //= i
			if len(result) == 2:
				if n * rest > 1 and n * rest not in result:
					return list(result.keys()) + [n * rest]
				else:
					return []
	increments = [4, 2, 4, 2, 4, 6, 2, 6]
	d = 7
	inc = 0
	while d * d <= n:
		while n % d == 0:
			if d not in result:
				result[d] = 1
			else:
				rest *= d
				if rest not in result:
					result[rest] = 1
					rest = 1
			n //= d
			if len(result) == 2:
				if n * rest > 1 and n * rest not in result:
					return list(result.keys()) + [n * rest]
				else:
					return []
		d += increments[inc]
		inc += 1
		if inc == 8:
			inc = 0
	return []
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	res = factorize(n)
	if len(res) > 1:
		print('YES')
		print(*res)
	else:
		print('NO')


import math

def sf(s, n):
	for i in range(s, int(math.sqrt(n) + 1)):
		if n % i == 0:
			n = n // i
			return (i, n)
	return (1, n)
t = int(input())
for _ in range(t):
	(a, b, c) = (1, 1, 1)
	n = int(input())
	(a, n) = sf(2, n)
	(b, n) = sf(a + 1, n)
	c = n
	if a != b and b != c and (c != 1) and (a != c) and (a != 1) and (b != 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	sn = n
	l = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			l.append(i)
			n = n // i
			c = i
			break
	else:
		print('NO')
		continue
	for i in range(c + 1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			l.append(i)
			n = n // i
			break
	else:
		print('NO')
		continue
	if sn // (l[0] * l[1]) != 1 and sn // (l[0] * l[1]) not in l:
		l.append(sn // (l[0] * l[1]))
		print('YES')
		print(*l)
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	flag = 0
	a = []
	count = 0
	for j in range(2, 31623):
		if n % j == 0:
			count += 1
			a.append(j)
			n = n // j
		if count == 2:
			if a[0] != n and a[1] != n and (n != 1):
				flag = 1
				a.append(n)
				break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		for j in range(3):
			print(a[j], end=' ')
		print()


import math

def countDivisors(n):
	cnt = 0
	for i in range(1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if n / i == i:
				cnt = cnt + 1
			else:
				cnt = cnt + 2
	return cnt
t = int(input())
for i in range(t):
	n = int(input())
	x = 0
	w = 1
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			r = countDivisors(n // j)
			if r > 3:
				for k in range(2, int(math.sqrt(n // j)) + 1):
					if n // j % k == 0 and j != k and (k != n // j // k) and (j != n // j // k):
						print('YES')
						print(j, k, n // j // k)
						w = 0
					if w == 0:
						break
		if w == 0:
			break
	if w == 1:
		print('NO')


import math
n = int(input())
Resulting_bool_list = []
Resulting_factor_list = []
for i in range(0, n):
	factor_list = []
	temp = []
	num = int(input())
	lim = math.floor(math.sqrt(num))
	for i in range(2, lim + 1):
		if num % i == 0:
			factor_list.append(i)
	len_ = len(factor_list)
	if len_ < 3:
		Resulting_bool_list.append('NO')
		Resulting_factor_list.append([])
	else:
		Resulting_bool_list.append('YES')
		temp.append(factor_list[0])
		num = num / factor_list[0]
		for j in range(1, len_):
			if num % factor_list[j] == 0:
				temp.append(factor_list[j])
				temp.append(int(num / factor_list[j]))
				break
		Resulting_factor_list.append(temp)
for i in range(0, n):
	if Resulting_bool_list[i] == 'NO':
		print(Resulting_bool_list[i])
	else:
		print(Resulting_bool_list[i])
		for j in Resulting_factor_list[i]:
			print(j, end=' ')
		print('')


def fact(n):
	i = 2
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i not in l:
			return i
	return 0
for _ in range(int(input())):
	l = []
	n = int(input())
	a = fact(n)
	l.append(a)
	if a != 0:
		b = fact(n / a)
	else:
		print('NO')
		continue
	if b != 0:
		z = n // (a * b)
	else:
		print('NO')
		continue
	if z != a and z != b and (z != 1):
		print('YES')
		print(a, b, z)
	else:
		print('NO')


import math

def num_divisors(n):
	div = []
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0:
			div.append(i)
			for j in range(i + 1, int(math.sqrt(n / i)) + 1):
				if n / i % j == 0:
					if n / i != j * j:
						div.extend([j, n / (i * j)])
						print('YES')
						print(' '.join([str(round(d)) for d in div]))
						return
			div.remove(i)
	print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	num_divisors(n)


from collections import defaultdict as dd
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	br = 0
	for i in range(2, int(n ** 0.5) + 1):
		fl = 0
		if n % i == 0:
			fl = 1
			x = i
			for j in range(2, int(i ** 0.5) + 1):
				if i % j == 0 and len(set([j, i // j, n // i])) == 3:
					br = 1
					print('YES')
					print(j, i // j, n // i)
					break
			if br:
				break
			for j in range(2, int((n // i) ** 0.5) + 1):
				if n // i % j == 0 and len(set([i, n // i // j, j])) == 3:
					br = 1
					print('YES')
					print(i, n // i // j, j)
					break
			if br:
				break
	if br:
		continue
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep=' ')

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

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
g = II()
for j in range(g):
	n = II()
	fl = 0
	i = 2
	used = set()
	while i * i * i < n:
		if n % i == 0:
			used.add(i)
			n //= i
			break
		i += 1
	if len(used) == 0:
		print('NO')
		continue
	i += 1
	while i * i < n:
		if n % i == 0:
			used.add(i)
			n //= i
			break
		i += 1
	if len(used) == 1:
		print('NO')
		continue
	if n not in used:
		used.add(n)
		print('YES')
		p2D(used)
	else:
		print('NO')


from math import sqrt
t = int(input())
for w in range(t):
	n = int(input())
	c = 0
	ans = []
	for i in range(2, int(sqrt(n)) + 1):
		if n == 1 or c == 2:
			break
		if n % i == 0:
			ans.append(i)
			n = n // i
			c += 1
	if c < 2 or n == ans[1] or n == ans[0]:
		print('NO')
	else:
		print('YES')
		print(ans[0], ans[1], n)


import math
t = int(input())
for i in range(t):
	n = int(input())
	(L, a, r) = ([], n, [])
	m = math.ceil(math.sqrt(n))
	f = False
	for j in range(2, m + 1):
		if a % j == 0:
			c = 0
			while a % j == 0:
				a //= j
				c += 1
			L.append((j, c))
			if c >= 3:
				if c >= 6:
					if j not in r:
						r.append(j)
					if j * j not in r:
						r.append(j * j)
					if j ** 3 not in r:
						r.append(j ** 3)
					a *= j ** (c - 6)
				else:
					if j not in r:
						r.append(j)
					if j * j not in r:
						r.append(j * j)
					a *= j ** (c - 3)
			else:
				if j not in r:
					r.append(j)
				a *= j ** (c - 1)
			if len(r) > 3:
				c = 1
				for k in range(3, len(r)):
					c *= r[k]
				r[2] *= c
				while len(r) > 3:
					r.pop()
			if len(r) == 3:
				r[2] *= a
				f = True
				break
			elif len(r) == 2 and a > 1 and (a != r[0]) and (a != r[1]):
				r.append(a)
				f = True
				break
	if f:
		print('YES')
		print(r[0], r[1], r[2])
	else:
		print('NO')


from math import sqrt, ceil, prod

def primeFac(x):
	arr = []
	flag = True
	while flag:
		flag = False
		for i in range(2, ceil(sqrt(x) + 1)):
			if not x % i:
				arr.append(i)
				x = int(x / i)
				flag = True
				break
	if x != 1:
		arr.append(x)
	return arr

def distPrim(xs):
	arr = []
	dist = 0
	for x in xs:
		if x not in arr:
			dist += 1
			arr.append(x)
	return dist
for _q in range(int(input())):
	arr = primeFac(int(input()))
	nprim = distPrim(arr)
	if nprim == 1 and len(arr) <= 5:
		print('NO')
	elif nprim == 2 and len(arr) <= 3:
		print('NO')
	elif len(arr) < 3:
		print('NO')
	else:
		print('YES')
		if nprim == 1:
			print(arr[0], arr[1] * arr[2], prod(arr[3:]))
		elif nprim == 2:
			if arr[1] * arr[2] != prod(arr[3:]):
				print(arr[0], arr[1] * arr[2], prod(arr[3:]))
			elif arr[0] == arr[1]:
				print(arr[0] * arr[1], arr[2], prod(arr[3:]))
			else:
				print(arr[0], arr[1], prod(arr[2:]))
		elif len(arr) == 3:
			print(arr[0], arr[1], prod(arr[2:]))
		elif arr[1] * arr[2] != prod(arr[3:]):
			print(arr[0], arr[1] * arr[2], prod(arr[3:]))
		else:
			print(arr[0] * arr[1], arr[2], prod(arr[3:]))


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

def ai():
	a = list(map(int, input().split()))
	return a

def mi():
	a = map(int, input().split())
	return a
from math import sqrt

def fact(n):
	lst = []
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			a = i
			b = n // i
			for j in range(2, int(sqrt(b)) + 1):
				if b % j == 0 and j != a and (b // j != a) and (j != b // j):
					lst.append(a)
					lst.append(j)
					lst.append(b // j)
					return lst
for _ in range(ii()):
	n = ii()
	lst = fact(n)
	if lst:
		print('YES')
		print(*lst)
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	n_root = int(math.sqrt(n))
	ans = []
	count = 0
	for i in range(2, n_root + 1):
		if n % i == 0:
			ans.append(i)
			count += 1
			n //= i
		if count == 2 and n > ans[-1]:
			count += 1
			ans.append(n)
			break
	if count == 3:
		print('YES')
		print(*ans)
	else:
		print('NO')


from sys import stdin, stdout
from math import sqrt

def solve():
	n = int(input())
	st = set()
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0 and i not in st:
			st.add(i)
			n /= i
			break
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0 and i not in st:
			st.add(i)
			n /= i
			break
	if n == 1 or n in st or len(st) < 2:
		print('NO')
		return 0
	else:
		print('YES')
		A = []
		for i in st:
			A.append(int(i))
		A.append(int(n))
		print(A[0], A[1], A[2])
	return 0
t = int(input())
for i in range(t):
	solve()


n = int(input())
for k in range(n):
	z = int(input())
	l = []
	for i in range(2, z):
		if z % i == 0:
			l.append(i)
			z = z // i
			break
		if i * i > z:
			break
	for j in range(2, z):
		if z % j == 0 and j not in l:
			l.append(j)
			z = z // j
			break
		if j * j > z:
			break
	if len(l) < 2 or z == 1 or z in l:
		print('NO')
	else:
		print('YES')
		print(l[0], l[1], z)


for _ in range(int(input())):
	n = int(input())
	i = 1
	c = 2
	l = []
	y = n
	while i <= 2:
		if n % c == 0:
			n = n // c
			i = i + 1
			l.append(c)
		if c >= y ** 0.5:
			break
		c = c + 1
	if l == [] or len(l) == 1:
		print('NO')
	elif y % (l[0] * l[1]) == 0:
		x = y // (l[0] * l[1])
		if x not in l and x != 1:
			print('YES')
			l.append(x)
			for i in range(len(l)):
				if i == len(l) - 1:
					print(l[i])
				else:
					print(l[i], end=' ')
		else:
			print('NO')
	else:
		print('NO')


import math
from collections import defaultdict as dq

def primeFactors(n):
	d = dq(int)
	while n % 2 == 0:
		d[2] += 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			d[i] += 1
			n = n // i
	if n > 1:
		d[n] += 1
	return d
for _ in range(int(input())):
	n = int(input())
	s = primeFactors(n)
	if len(s) > 2:
		c = 0
		li = []
		for i in s.keys():
			li.append(i)
			c += 1
			if c == 2:
				break
		print('YES')
		print(li[0], li[1], n // (li[0] * li[1]))
	if len(s) == 1:
		for i in s.keys():
			c = i
		if s[c] >= 6:
			print('YES')
			print(c, c * c, n // (c * c * c))
		else:
			print('NO')
	if len(s) == 2:
		li = []
		for i in s.keys():
			li.append(i)
		if n // (li[0] * li[1]) in s.keys() or n // (li[0] * li[1]) == 1:
			print('NO')
		else:
			print('YES')
			print(li[0], li[1], n // (li[0] * li[1]))


t = int(input())
for i in range(t):
	n = int(input())
	(a, x, d) = ([], 0, 2)
	while d * d <= n and x < 2:
		if n % d == 0:
			a.append(d)
			n = n // d
			x += 1
		d += 1
	if n >= d and x == 2:
		a.append(n)
		print('YES')
		res = ' '.join(map(str, a))
		print(res)
	else:
		print('NO')


import math

def dell(num):
	global ans
	for i in range(2, 2 + int(math.sqrt(num))):
		if num % i == 0:
			ans.append(i)
			return dell(num // i)
	if num >= 2:
		ans.append(num)
t = int(input())
for _ in range(t):
	num = int(input())
	ans = []
	dell(num)
	ans = sorted(ans)
	if len(ans) < 3:
		print('NO')
		continue
	ch1 = ans[0]
	ch2 = ans[1]
	ind = 2
	if ch2 == ch1:
		ch2 *= ans[2]
		ind = 3
	ch3 = 1
	for j in range(ind, len(ans)):
		ch3 *= ans[j]
	if min(ch3, ch1, ch2) >= 2 and ch1 != ch2 and (ch1 != ch3) and (ch2 != ch3):
		print('YES')
		print(ch1, ch2, ch3)
	else:
		print('NO')


import math

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

def issquare(n):
	if int(math.sqrt(n)) * int(math.sqrt(n)) == n:
		return True
	else:
		return False

def solve(n):
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0:
			if not isprime(i):
				x = i
				y = int(n / i)
				for j in range(2, int(math.sqrt(x)) + 1):
					if x % j == 0 and j != y and (x / j != y) and (j != x / j):
						print('YES')
						print(str(j) + ' ' + str(int(x / j)) + ' ' + str(y))
						return
			elif not isprime(n / i):
				x = n / i
				y = i
				for j in range(2, int(math.sqrt(x)) + 1):
					if x % j == 0 and j != y and (x / j != y) and (j != x / j):
						print('YES')
						print(str(j) + ' ' + str(int(x / j)) + ' ' + str(y))
						return
	print('No')
t = int(input())
while t:
	n = int(input())
	solve(n)
	t -= 1


t = int(input())

def yes(factors):
	print('YES')
	print(' '.join(map(str, factors)))

def no():
	print('NO')
for _ in range(t):
	temp = n = int(input())
	factors = []
	i = 2
	found = False
	while i <= pow(n, 1 / 2):
		while n % i == 0:
			if len(factors) == 0 or i not in factors[-1]:
				factors.append({i: 1})
			else:
				factors[-1][i] += 1
			n //= i
		i += 1
	if len(factors) >= 3:
		rv = [list(factors[0].keys())[0], list(factors[1].keys())[0]]
		temp //= rv[0]
		temp //= rv[1]
		rv.append(temp)
		yes(rv)
	elif len(factors) == 2:
		rv = [list(factors[0].keys())[0], list(factors[1].keys())[0]]
		temp //= rv[0]
		temp //= rv[1]
		if temp == rv[0] or temp == rv[1] or temp == 1:
			no()
		else:
			rv.append(temp)
			yes(rv)
	elif len(factors) == 1:
		factor = list(factors[0].keys())[0]
		if factors[0][factor] < 6:
			if factors[0][factor] < 3:
				no()
			else:
				rv = [factor, factor * factor]
				temp //= rv[0]
				temp //= rv[1]
				if temp == rv[0] or temp == rv[1] or temp == 1:
					no()
				else:
					rv.append(temp)
					yes(rv)
		else:
			rv = [factor, factor * factor]
			temp //= rv[0]
			temp //= rv[1]
			rv.append(temp)
			yes(rv)
	else:
		no()


for t in range(int(input())):
	n = int(input())
	(p, q) = (0, 0)
	for i in range(2, int(pow(n, 1 / 2) + 1)):
		if n % i == 0:
			p = i
			n = n / i
			break
	for i in range(2, int(pow(n, 1 / 2) + 1)):
		if n % i == 0 and p != i:
			q = i
			n = n / i
			break
	n = int(n)
	if p != 0 and q != 0 and (n != 1) and (n != p) and (n != q):
		print('YES')
		print(p, q, int(n))
	else:
		print('NO')


import math
x = int(input())
for _ in range(x):
	n = int(input())
	c = 0
	lol = set()
	f = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			k = i
			while n % k == 0:
				n //= k
				lol.add(k)
				c += 1
				k *= i
				if len(lol) == 2:
					f = 1
					break
			if f:
				break
	if n >= 2:
		lol.add(n)
	if f and len(lol) == 3:
		print('YES')
		print(*lol)
	else:
		print('NO')


import math

def main():
	t = int(input())
	out_lst = []
	if t <= 100 and t >= 1:
		for i in range(t):
			n = int(input())
			div_n = n
			lst = []
			n_rang = int(math.sqrt(n))
			for j in range(2, n_rang):
				if div_n % j == 0:
					div_n = div_n / j
					lst.append(j)
					if len(lst) == 2:
						if int(div_n) not in lst:
							lst.append(int(div_n))
						break
			if len(lst) == 3 and 1 not in lst:
				out_lst.append('YES')
				out_lst.append('{} {} {}'.format(lst[0], lst[1], lst[2]))
			else:
				out_lst.append('NO')
		for k in out_lst:
			print(k)
	else:
		return False
main()


def SieveOfEratosthenes(n):
	data = []
	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] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			data.append(p)
	return data
l = SieveOfEratosthenes(10 ** 6)
for t in range(int(input())):
	data = []
	n = int(input())
	d = n
	for i in l:
		if i * i > n:
			break
		if n % i == 0:
			while n % i == 0:
				data.append(i)
				n = n / i
	if n > 1:
		data.append(n)
	(a, b, c) = (data[0], 0, 0)
	if len(data) <= 2:
		print('NO')
	else:
		b = data[1]
		if a == data[1]:
			b = data[1] * data[2]
		c = d // (a * b)
		if c == 1 or c == b or c == a:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import math as mt

def func(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n // 2
	for i in range(3, mt.ceil(mt.sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n // i
			a.append(i)
	if n > 2:
		a.append(n)
	return a
t = int(input())
for i in range(t):
	n = int(input())
	C = list(func(n))
	X = []
	j = C[0]
	X.append(C[0])
	h = 1
	k = 1
	while k < len(C) and h <= j:
		h = h * C[k]
		k += 1
	X.append(h)
	p = 1
	if k > len(C):
		print('NO')
	else:
		for i in range(k, len(C)):
			p = p * C[i]
		if p != 1 and p != X[0] and (p != X[1]):
			X.append(p)
		if len(set(X)) == 3:
			print('YES')
			print(*X)
		else:
			print('NO')


import math
t = int(input())
for i in range(t):
	s = int(input())
	s1 = 0
	d = 0
	f = 0
	for j in range(2, int(math.sqrt(s)) + 1):
		if s % j == 0:
			s1 = j
			d = s / j
			for k in range(2, int(math.sqrt(d)) + 1):
				if d % k == 0:
					s2 = k
					s3 = d / k
					if s2 != s3 and s3 != s1 and (s2 != s1):
						print('YES')
						print(int(s1), int(s2), int(s3))
						f = 1
						break
			if f == 1:
				break
			for k in range(2, int(math.sqrt(s1)) + 1):
				if s1 % k == 0:
					s2 = k
					s3 = s1 / k
					if s2 != s3 and s3 != d and (s2 != d):
						print('YES')
						print(int(s1), int(s2), int(s3))
						f = 1
						break
			if f == 1:
				break
	if f == 0:
		print('NO')


import math
t = int(input())

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

def generate_factors(prime_factors_list, n):
	a = 1
	b = 1
	c = 1
	for i in range(len(prime_factors_list)):
		if a == 1:
			a *= prime_factors_list[i]
		elif b == 1 or a == b:
			b *= prime_factors_list[i]
		else:
			c *= prime_factors_list[i]
	return (a, b, c)
for tt in range(t):
	n = int(input())
	prime_factors = primefactorize(n)
	(a, b, c) = generate_factors(prime_factors, n)
	if (a != 1 and b != 1 and (c != 1)) and (a != b and b != c and (a != c)):
		print('YES')
		print(str(int(a)) + ' ' + str(int(b)) + ' ' + str(int(c)))
	else:
		print('NO')


def solution():
	temp = [True] * 31623
	for i in range(2, 31623):
		if temp[i]:
			for j in range(i + i, 31623, i):
				temp[j] = False
	er = [i for (i, v) in enumerate(temp) if v][2:]
	for _ in range(int(input())):
		n = int(input())
		ans = set()
		er_iter = er.__iter__()
		current = er_iter.__next__()
		l = 1
		while current < n:
			if n % current == 0:
				if current in ans:
					if l == 1:
						l = current
					else:
						ans.add(current * l)
						l = 1
				else:
					ans.add(current)
				n //= current
				if len(ans) == 2 and n not in ans:
					break
			else:
				try:
					current = er_iter.__next__()
				except StopIteration:
					break
		if l:
			n *= l
		if len(ans) == 2 and n not in ans:
			print('YES')
			ans.add(n)
			print(*ans)
		else:
			print('NO')
solution()


t = int(input())
for i in range(t):
	n = int(input())
	m = [0, 0, 0]
	k = 0
	for j in range(2, int(n ** 0.5) + 1):
		if n % j == 0 and j not in m:
			m[k] = j
			k += 1
			n //= j
		if k == 2 or j > n:
			break
	if k == 2 and n not in m:
		m[2] = n
	if m[0] and m[1] and m[2]:
		print('YES')
		print(m[0], m[1], m[2])
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	d = dict()
	i = 2
	while i * i <= n:
		if i not in d and n % i == 0:
			d[i] = i
			n //= i
			break
		i += 1
	j = 2
	while j * j <= n:
		if j not in d and n % j == 0:
			d[j] = j
			n //= j
			break
		j += 1
	if len(d) < 2 or n in d or 1 in d:
		print('NO')
	else:
		print('YES')
		d[n] = 1
		print(' '.join((str(a) for a in d)))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

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

def factors(n):
	ans = []
	while n % 2 == 0:
		ans.append(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			ans.append(i)
			n = n // i
	if n > 2:
		ans.append(n)
	return ans
for _ in range(Int()):
	n = Int()
	f = factors(n)
	if len(f) < 3:
		print('NO')
		continue
	a = f[0]
	b = f[1]
	i = 2
	while i < len(f) and b == a:
		b *= f[i]
		i += 1
	c = n // (a * b)
	if c != a and c != b and (a != b) and (c > 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import sys
import math
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
from functools import reduce
sys.setrecursionlimit(10 ** 6)

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

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

def listt():
	return [int(i) for i in inputt().split()]

def gcd(a, b):
	return math.gcd(a, b)

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

def factors(n):
	step = 2 if n % 2 else 1
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(math.sqrt(n)) + 1, step) if n % i == 0)))

def comb(n, k):
	factn = math.factorial(n)
	factk = math.factorial(k)
	fact = math.factorial(n - k)
	ans = factn // (factk * fact)
	return ans

def is_prime(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n > 2 and n % 2 == 0:
		return False
	max_div = math.floor(math.sqrt(n))
	for i in range(3, 1 + max_div, 2):
		if n % i == 0:
			return False
	return True

def maxpower(n, x):
	B_max = int(math.log(n, x)) + 1
	return B_max

def sf(s, n):
	for i in range(s, int(math.sqrt(n) + 1)):
		if n % i == 0:
			n = n // i
			return (i, n)
	return (1, n)
t = int(inputt())
for _ in range(t):
	(a, b, c) = (1, 1, 1)
	n = int(inputt())
	(a, n) = sf(2, n)
	(b, n) = sf(a + 1, n)
	c = n
	if a != b and b != c and (c != 1) and (a != c) and (a != 1) and (b != 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	d = {}
	x = int(math.sqrt(n))
	ans = []
	flag = 0
	product = 1
	for i in range(2, x + 1):
		if n % i == 0:
			product *= i
			if n % product == 0:
				ans.append(i)
			else:
				product /= i
			flag = 1
		if len(ans) == 2:
			break
	if flag == 1 and len(ans) >= 2:
		y = n // (ans[-1] * ans[-2])
		if y in ans or n % y != 0:
			print('NO')
		else:
			print('YES')
			ans.append(y)
			for i in ans:
				print(i, end=' ')
			print()
	else:
		print('NO')


import sys
from math import sqrt

def solution(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			a = i
			n_a = n // i
			for j in range(2, int(sqrt(n_a)) + 1):
				if n_a % j == 0 and j != a:
					(ra, rb, rc) = (a, j, n // (a * j))
					if ra != rb and rb != rc and (rc != ra):
						return f'YES\n{ra} {rb} {rc}'
	return 'NO'
for line in sys.stdin:
	t = int(line)
	break
for line in sys.stdin:
	n = int(line)
	print(solution(n))


def solve():
	ans = []
	n = int(input())
	for j in range(2, int(n ** (1 / 2)) + 1):
		if n % j == 0:
			ans.append(j)
			ans.append(n // j)
	ans = list(set(ans))
	if len(ans) < 3:
		print('NO')
	else:
		for j in range(len(ans)):
			for g in range(j + 1, len(ans)):
				for k in range(g + 1, len(ans)):
					if ans[j] * ans[g] * ans[k] == n:
						print('YES')
						print(ans[j], ans[g], ans[k])
						return
		print('NO')
t = int(input())
for i in range(t):
	solve()


import math

def divisor(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			k = n // i
			for j in range(2, int(math.sqrt(k)) + 1):
				if j != i and k % j == 0:
					t = k // j
					if t != i and t != j:
						return ['YES', i, j, t]
	return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	if divisor(n) == 'NO':
		print('NO')
	else:
		print(divisor(n)[0])
		print(*divisor(n)[1:])


def dividened(number, dict1):
	for i in range(2, int(number ** (1 / 2)) + 1):
		if number % i == 0 and dict1.get(i) == None:
			dict1[i] = 1
			return (number // i, i, dict1)
	return (1, number, dict1)
for _ in range(int(input())):
	number = int(input())
	d = []
	case = True
	dict1 = {}
	for i in range(2):
		(number, op, dict1) = dividened(number, dict1)
		if number == 1:
			print('NO')
			case = False
			break
		else:
			d.append(op)
	if dict1.get(number) == None:
		d.append(number)
	else:
		case = False
		print('NO')
	if case:
		print('YES')
		print(*d)


from math import sqrt
T = int(input())
for case in range(T):
	n = int(input())
	ans = False
	move = True
	for i in range(2, int(sqrt(n)) + 1):
		if move is False:
			break
		if n % i == 0:
			a = i
			b = int(n / a)
			for j in range(a + 1, int(sqrt(n)) + 1):
				if b % j == 0:
					b = b // j
					c = j
					if c == b or c == a or a == b:
						ans = False
					else:
						move = False
						ans = True
						break
	if ans is True:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for queries in range(t):
	n = int(input())
	m = n
	r = 2
	array = []
	while r <= 25000:
		if n % r == 0:
			array.append(r)
			n //= r
		r += 1
		if len(array) == 2:
			break
	if len(array) == 2 and n > array[1]:
		print('YES')
		print(array[0], array[1], m // array[0] // array[1])
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	d = 2
	while len(a) < 2 and d * d <= n:
		if 0 == n % d:
			a += (d,)
			n //= d
		d += 1
	if a and n > a[-1]:
		a += (n,)
	if len(a) < 3:
		print('NO')
	else:
		print('YES')
		print(*a)


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

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

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())

def solve():
	n = itg()
	ans = []
	a = 2
	while a * a <= n:
		if not n % a:
			ans.append(a)
			n //= a
			if len(ans) == 2:
				ans.append(n)
				break
		a += 1
	if len(ans) == 3 and ans[0] < ans[1] < ans[2]:
		print('YES')
		print(*ans)
	else:
		print('NO')

def main():
	for _ in range(itg()):
		solve()
DEBUG = 0
URL = ''
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
else:
	if DEBUG != 3:
		(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	if DEBUG:
		_print = print

		def print(*args, **kwargs):
			_print(*args, **kwargs)
			sys.stdout.flush()
	main()


import math
for _ in range(int(input())):
	n = int(input())
	m = n
	ans = False
	l = []
	for i in range(2, int(math.sqrt(n))):
		if m % i == 0:
			l.append(i)
			m = m // i
			if len(l) == 2:
				if l[1] != m and l[0] != m:
					ans = True
				break
	if ans:
		print('YES')
		for i in range(2):
			print(l[i], end=' ')
		print(m)
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			ans.append(j)
			n //= j
			if len(ans) == 2:
				ans.append(n)
				break
	if len(ans) != 3:
		print('NO')
	elif ans[1] >= ans[2]:
		print('NO')
	else:
		print('YES')
		print(*ans)


for _ in ' ' * int(input()):
	n = int(input())
	m = n
	p = []
	d = 2
	ln = 0
	x = 0
	while d * d <= n:
		if n % d == 0:
			p.append(d)
			n //= d
			ln += 1
		else:
			d += 1
	if n > 1:
		p.append(n)
		ln += 1
	if ln > 2:
		a = p[0]
		if p[1] == p[0]:
			b = p[1] * p[2]
			if ln > 3 and b != m // b // a and (a != m // b // a):
				print('YES\n', a, b, m // b // a)
			else:
				print('NO')
		elif p[1] != m // p[1] // a and a != m // p[1] // a:
			b = p[1]
			print('YES\n', a, b, m // b // a)
		else:
			print('NO')
	else:
		print('NO')


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

def read_int():
	return int(input())

def factors(n):
	factors_p = dict()
	twos = 0
	while n % 2 == 0:
		n //= 2
		twos += 1
	if twos > 0:
		factors_p[2] = twos
	d = 3
	while d * d <= n:
		p = 0
		while n % d == 0:
			p += 1
			n //= d
		if p > 0:
			factors_p[d] = p
		d += 2
	if n > 1:
		factors_p[n] = 1
	return factors_p
t = read_int()
for _ in range(t):
	n = read_int()
	primes = factors(n)
	p_sum = 0
	abc = []
	for (k, v) in primes.items():
		p_sum += v
	if len(primes) < 1:
		print('No')
		continue
	elif len(primes) == 1:
		if p_sum < 6:
			print('No')
			continue
		else:
			print('Yes')
			d = list(primes.keys())[0]
			abc = [d, d ** 2, n // d ** 3]
	elif len(primes) == 2:
		psum = 0
		for (k, v) in primes.items():
			psum += v
		if psum < 4:
			print('No')
			continue
		print('Yes')
		(p1, p2) = list(primes.keys())[:2]
		abc = [p1, p2, n // (p1 * p2)]
	elif len(primes) >= 3:
		print('Yes')
		(p1, p2) = list(primes.keys())[:2]
		abc = [p1, p2, n // (p1 * p2)]
	print(*abc)


import math
for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			t = n
			l.append(i)
			t = t // i
			for j in range(2, int(math.sqrt(t) + 1)):
				if t % j == 0:
					l.append(j)
					l.append(t // j)
					if len(set(l)) == 3:
						break
		if len(set(l)) == 3:
			break
		else:
			l = []
	if len(l) == 3:
		print('YES')
		print(l[0], l[1], l[2])
	else:
		print('NO')


import math

def ld(a, last):
	found = False
	for div in range(last, int(math.sqrt(a)) + 1):
		if a % div == 0:
			found = True
			return div
	if not found:
		return False

def do(int):
	x = ld(int, 2)
	if x:
		y = ld(int // x, x + 1)
		if y:
			z = int // (x * y)
			if x != y and x != z and (y != z):
				print('Yes')
				print(x, y, z)
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')
t = int(input())
a = []
for inp in range(0, t):
	inp = int(input())
	a.append(inp)
for element in a:
	do(element)


import sys
input = sys.stdin.readline
t = int(input())
import math
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for i in range(t):
	n = int(input())
	ffactor = factors(n)
	ffactor2 = list(set(ffactor))
	ffactor2.sort()
	ok = False
	for i in range(len(ffactor2)):
		for j in range(i + 1, len(ffactor2)):
			for k in range(j + 1, len(ffactor2)):
				if ffactor2[i] >= 2 and ffactor2[j] >= 2 and (ffactor2[k] >= 2):
					if ffactor2[i] * ffactor2[j] * ffactor2[k] == n:
						ok = True
						f = ffactor2[i]
						s = ffactor2[j]
						t = ffactor2[k]
						break
			if ok == True:
				break
		if ok == True:
			break
	if ok == True:
		print('YES')
		print(int(f), int(s), int(t))
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for j in range(2, int(n ** 0.5) + 1):
		if n % j == 0:
			a.append(j)
			n = n / j
			break
	if len(a) == 1:
		for k in range(j + 1, int(n ** 0.5) + 1):
			if n % k == 0:
				a.append(k)
				n = int(n / k)
				break
	if len(a) == 2:
		if n != a[0] and n != a[1]:
			print('YES')
			print(a[0], end=' ')
			print(a[1], end=' ')
			print(int(n))
		else:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	li = []
	n_ = math.ceil(n ** 0.5)
	for j in range(2, n_):
		if n % j == 0:
			li.append(j)
			n = n // j
	if n != 1:
		li.append(n)
	if len(li) <= 2:
		print('NO')
	else:
		w1 = li[0]
		w2 = li[1]
		w3 = 1
		for k in range(2, len(li)):
			w3 = w3 * li[k]
		if w1 != w2 and w2 != w3 and (w3 != w1):
			print('YES')
			print(str(w1) + ' ' + str(w2) + ' ' + str(int(w3)))
		else:
			print('NO')


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'

def f(n):
	(ret, x) = (defaultdict(int), [])
	for i in range(2, int(n ** 0.5) + 1):
		while n % i == 0:
			ret[i] += 1
			x.append(i)
			n //= i
	if n != 1:
		ret[n] += 1
		x.append(n)
	return (ret, x)
for _ in range(int(input())):
	try:
		n = int(input())
		(arr, x) = f(n)
		if len(arr) >= 3:
			((x, xcnt), (y, ycnt), *c) = list(arr.items())
			z = 1
			for (i, j) in c:
				z *= i ** j
			print(YES)
			print(x ** xcnt, y ** ycnt, z)
			go()
		if len(arr) == 2:
			((x, xcnt), (y, ycnt)) = arr.items()
			if xcnt + ycnt <= 3:
				print(NO)
				go()
			if xcnt == 2 and ycnt == 2:
				print(YES)
				print(x, y, x * y)
				go()
			if xcnt >= 3:
				print(YES)
				print(x, x ** (xcnt - 1), y ** ycnt)
				go()
			if ycnt >= 3:
				print(YES)
				print(y, y ** (ycnt - 1), x ** xcnt)
				go()
		if len(arr) == 1:
			(x, xcnt) = list(arr.items())[0]
			if xcnt <= 5:
				print(NO)
				go()
			else:
				print(YES)
				print(x, x * x, x ** (xcnt - 3))
				go()
	except Exception as e:
		continue


import math
from math import sqrt

def primeFactors(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n / i
	if n > 2:
		a.append(n)
	return a
t = int(input())
for _ in range(t):
	n = int(input())
	s = set([])
	x = int(sqrt(n)) + 2
	for i in range(2, x):
		if n % i == 0:
			s.add(i)
			n = n // i
			break
	x = int(sqrt(n)) + 2
	for i in range(2, x):
		if n % i == 0 and i not in s:
			s.add(i)
			s.add(n // i)
			break
	a = list(s)
	if len(a) == 3:
		print('YES')
		print(*a)
	else:
		print('NO')


import sys, itertools, math
T = int(sys.stdin.readline())

def solve(n):
	for a in range(2, int(math.sqrt(n)) + 1):
		if n % a != 0:
			continue
		for b in range(a + 1, int(math.sqrt(n)) + 1):
			r = a * b
			c = n // r
			if n % r == 0 and c != a and (c != b):
				print('YES')
				print(a, b, c)
				return
	print('NO')
for _ in range(T):
	n = int(sys.stdin.readline())
	solve(n)


def getSmallestFactor(n, d):
	for i in range(2, int(n ** 0.5) + 1):
		if i not in d and n % i == 0:
			return i
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	sm1 = getSmallestFactor(n, {})
	if sm1 != -1:
		sm2 = getSmallestFactor(n // sm1, {sm1})
		sm3 = n // (sm1 * sm2)
		if sm2 != -1 and sm3 not in [sm1, sm2, 1]:
			print('YES')
			print(sm1, sm2, sm3)
		else:
			print('NO')
	else:
		print('NO')


(a, i) = (int(input()), 0)

def pro(a):
	(p, i) = (0, 2)
	while i * i <= a:
		if a % i == 0:
			p = i
			break
		i = i + 1
	return p

def f1(k, ak, a):
	(i, t) = (2, 0)
	while i * i <= ak:
		if a % i == 0:
			if ak // i != i and i != k and (ak // i * i * k == a):
				print('YES')
				print(int(ak / i), int(i), int(k))
				t = 1
				break
		i = i + 1
	if t == 0:
		print('NO')
	return 0

def ff(a):
	k = pro(a)
	if k == 0:
		print('NO')
	else:
		f1(k, a / k, a)
	return 0
while i != a:
	x = int(input())
	ff(x)
	i = i + 1


t = int(input())
j = 0
while j < t:
	n = int(input())
	i = 1
	var1 = 'NO'
	var2 = 'NO'
	while i < n ** (1 / 3) and var1 == 'NO':
		i += 1
		if n % i == 0:
			var1 = 'YES'
	a = i
	if var1 == 'YES':
		product = n / a
		i = a + 1
		while i < product ** 0.5 and var2 == 'NO':
			if product % i == 0:
				var2 = 'YES'
				b = i
				c = product / b
			i += 1
	if var1 == 'YES' and var2 == 'YES':
		print('YES')
		print(a, b, int(c))
	else:
		print('NO')
	j += 1


import math
t = int(input())
for i in range(t):
	n = int(input())
	original = n
	a = set()
	i = 2
	a2 = 0
	b2 = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a.add(i)
			n //= i
			a2 = i
			break
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and i != a2:
			a.add(i)
			n //= i
			b2 = i
			break
	if len(a) == 2:
		if n * a2 * b2 == original and n != a2 and (n != b2):
			print('YES')
			print(n, a2, b2)
		else:
			print('NO')
	else:
		print('NO')


import math

def primefactorisation(n):
	p = []
	while n % 2 == 0:
		n //= 2
		p.append(2)
	i = 3
	while i <= math.sqrt(n):
		while n % i == 0:
			n //= i
			p.append(i)
		i += 2
	if n > 2:
		p.append(n)
	return p
for _ in range(int(input())):
	n = int(input())
	A = primefactorisation(n)
	if len(A) >= 3:
		a = A[0]
		b = A[1]
		if b == a:
			b = A[1] * A[2]
		c = n // (a * b)
		if c == a or c == b or c == 1:
			print('NO')
		else:
			print('YES')
			print(a, ' ', b, ' ', c)
	else:
		print('NO')


def solveOne(n):
	ret = []
	d = 2
	while d * d < n and len(ret) < 3:
		if n % d == 0:
			ret.append(d)
			n //= d
			dd = 2
			while dd * dd < n:
				if n % dd == 0 and dd not in ret and (n // dd not in ret):
					ret.extend((dd, n // dd))
					break
				dd += 1
		d += 1
	return 'YES\n%s' % ' '.join(map(str, ret)) if len(ret) == 3 else 'NO'
for _ in range(int(input())):
	print(solveOne(int(input())))


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

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

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	n = int(input())
	p = 0
	for i in range(2, math.ceil(math.sqrt(n))):
		count = 0
		ans = []
		if n % i == 0:
			count += 1
			no = n // i
			ans.append(i)
			for j in range(2, math.ceil(math.sqrt(no))):
				if i == j:
					continue
				if no % j == 0:
					val = no // j
					if val != i and val != j:
						ans.append(val)
						ans.append(j)
					if len(ans) == 3:
						print('YES')
						print(*ans)
						p += 1
						count = 3
						break
		if count == 3:
			break
	if p == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	f = 2
	li = []
	c = 0
	while c < 2 and n >= f * f:
		if n % f == 0:
			n = n // f
			c += 1
			li.append(f)
		if c == 2:
			if n not in li and n >= 2:
				li.append(n)
		f += 1
	if len(li) == 3:
		print('YES')
		print(li[0], li[1], li[2])
	else:
		print('NO')


t = int(input())
import math
while t:
	n = int(input())
	s = int(math.sqrt(n) + 10)
	ans = []
	for i in range(s)[2:]:
		if n % i == 0 and len(ans) < 2:
			ans.append(i)
			n //= i
	if len(ans) == 2 and ans[1] < n:
		ans.append(n)
	if len(ans) == 3:
		print('YES')
		print(ans[0], ans[1], ans[2], sep=' ')
	else:
		print('NO')
	t -= 1


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	n = Read.int()
	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0:
			t = n / i
			for j in range(2, math.ceil(math.sqrt(t))):
				if t % j == 0:
					res = math.ceil(t / j)
					if res == i or i == j or j == res:
						continue
					print('YES')
					print('{} {} {}'.format(i, j, res))
					return
	print('NO')
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


import math

def product(n):
	products = [0, 0, 0]
	i = 2
	for s in range(2):
		result = getSmallestPrime(i, n)
		if result > 1:
			products[s] = result
			n = int(n / result)
			i = result + 1
		else:
			products[0] = 0
			break
	products[-1] = n
	if n > 1 and products[1] < products[-1]:
		products[-1] = n
	else:
		products[0] = 0
	return products

def getSmallestPrime(i, n):
	for num in range(i, round(math.sqrt(n + 1) + 1)):
		if n % num == 0:
			return num
	return 0

def main():
	size = int(input())
	keyboard = []
	while size > 0:
		keyboard.append(int(input()))
		size = size - 1
	for num in keyboard:
		rtList = product(num)
		if rtList[0] == 0:
			print('NO')
		else:
			print('YES')
			print(rtList[0], rtList[1], rtList[2])
main()


def prime_decomposition(n):
	i = 2
	table = []
	while i * i <= n:
		while n % i == 0:
			n /= i
			table.append(i)
		i += 1
	if n > 1:
		table.append(n)
	return table
t = int(input())
for _ in range(t):
	n = int(input())
	ansl = []
	pl = prime_decomposition(n)
	k = 1
	for p in pl:
		k *= p
		if k not in ansl and len(ansl) < 2:
			ansl.append(int(k))
			k = 1
	else:
		if k in ansl or k == 1:
			print('NO')
			continue
		ansl.append(int(k))
	if len(ansl) < 3:
		print('NO')
	else:
		print('YES')
		print(str(ansl[0]) + ' ' + str(ansl[1]) + ' ' + str(ansl[2]))


import math
from collections import Counter

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

def prod(a):
	ans = 1
	for i in a:
		ans *= i
	return ans
for _ in range(int(input())):
	n = int(input())
	a = primeFactors(n)
	if len(a) < 3:
		print('NO')
	else:
		c = Counter(a)
		if len(set(a)) < 3:
			if len(c) == 1:
				if c[a[0]] >= 6:
					print('YES')
					print(a[0], a[0] * a[0], a[0] ** (c[a[0]] - 3))
				else:
					print('NO')
			elif len(a) >= 4:
				print('YES')
				print(a[0], a[-1], prod(a[1:-1]))
			else:
				print('NO')
		else:
			w = list(set(a))
			print('YES')
			print(w[0], w[1], prod(a) // (w[0] * w[1]))


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(input())
	fac = []
	for i in range(2, int(n ** 0.5)):
		if n % i == 0:
			fac.append((i, n // i))
			break
	if len(fac) != 0:
		x = fac[0][1]
		for i in range(2, int(x ** 0.5) + 1):
			if x % i == 0 and i != fac[0][0] and (i != x // i):
				ans += 'YES\n'
				ans += '{} {} {}\n'.format(fac[0][0], i, x // i)
				break
		else:
			ans += 'NO\n'
	else:
		ans += 'NO\n'
print(ans)


def prime_factors(n):
	factors = []
	while n % 2 == 0:
		n //= 2
		factors.append(2)
	for i in range(3, int(n ** 0.5 + 1), 2):
		while n % i == 0:
			n //= i
			factors.append(i)
	if n != 1:
		factors.append(n)
	return factors

def solve():
	n = int(input())
	f = prime_factors(n)
	(a, b, c) = (1, 1, 1)
	for i in f:
		if a == 1:
			a = i
		elif b == 1 or a == b:
			b *= i
		else:
			c *= i
	sol = False
	if a * b * c == n and a != b and (b != c) and (a != c) and (b > 1) and (c > 1):
		sol = True
	if sol:
		print('YES')
		print(a, b, c)
	else:
		print('NO')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


import math

def divisor(x):
	i = 1
	div = []
	while i <= math.sqrt(x):
		if x % i == 0:
			if x // i == i:
				div.append(i)
			else:
				div.extend([i, x // i])
		i += 1
	div.remove(max(div))
	div.remove(min(div))
	return div
for _ in range(int(input())):
	n = int(input())
	div1 = divisor(n)
	if len(div1) == 0:
		a = False
	else:
		a = min(div1)
	if a:
		div2 = sorted(divisor(n // a))
		if len(div2) == 0:
			b = False
		else:
			for i in div2:
				if i > a:
					b = i
					break
	else:
		b = False
	if a and b:
		c = n // (a * b)
		if c > a and c > b:
			pass
		else:
			c = False
	else:
		c = False
	if a and b and c:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
t = int(input())
for _ in range(t):
	f = 0
	n = int(input())
	if isPrime(n):
		print('NO')
		continue
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if not isPrime(n // i):
				m = n // i
				for j in range(2, int(m ** 0.5) + 1):
					if m % j == 0 and i != j != m // j != i:
						print('YES')
						print(i, j, m // j)
						f = 1
						break
		if f:
			break
	if not f:
		print('NO')


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	a = []
	s = int(sqrt(n))
	for i in range(2, s + 1):
		if n % i == 0:
			a.append(i)
			n //= i
		if len(a) == 2:
			if a[1] != n and a[0] != n:
				a.append(n)
				break
	if len(a) == 3:
		print('YES')
		print(*a)
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import *

def factorize(n):
	fct = []
	for i in range(2, int(n ** 0.5) + 1):
		c = 0
		while n % i == 0:
			n //= i
			c += 1
		if c > 0:
			fct.append((i, c))
	if n > 1:
		fct.append((n, 1))
	return fct
t = int(input())
for _ in range(t):
	n = int(input())
	factors = factorize(n)
	if len(factors) == 1:
		(p, c) = factors[0]
		if c >= 6:
			print('YES')
			print(p, p ** 2, p ** (c - 3))
		else:
			print('NO')
	elif len(factors) == 2:
		(p1, c1) = factors[0]
		(p2, c2) = factors[1]
		if c1 + c2 >= 4:
			print('YES')
			print(p1, p2, n // p1 // p2)
		else:
			print('NO')
	else:
		(p1, _) = factors[0]
		(p2, _) = factors[1]
		print('YES')
		print(p1, p2, n // p1 // p2)


def findprimefactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n //= 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			n //= i
			l.append(i)
	if n > 2:
		l.append(n)
	return l
for _ in range(int(input())):
	n = int(input())
	k = findprimefactors(n)
	l = set(k)
	z = len(l)
	if z >= 3:
		print('YES')
		l = list(l)
		prod = l[0] * l[1]
		prod1 = 1
		print(*l[:2], end=' ')
		for i in k:
			prod1 *= i
		print(prod1 // prod)
	elif z == 2:
		if len(k) < 4:
			print('NO')
		else:
			prod = 1
			print('YES')
			l = list(l)
			prod1 = 1
			for i in l:
				print(i, end=' ')
				prod *= i
			for i in k:
				prod1 *= i
			print(prod1 // prod)
	elif z == 1:
		prod = 1
		if len(k) > 5:
			print('YES')
			print(k[0], k[1] * k[2], end=' ')
			for i in k[3:]:
				prod *= i
			print(prod)
		else:
			print('NO')
	else:
		print('NO')


import copy
import sys
from collections import defaultdict, Counter

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

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

def maps():
	return map(str, input().split())

def print(arg, *argv, end=None):
	sys.stdout.write(str(arg))
	for i in argv:
		sys.stdout.write(' ' + str(i))
	sys.stdout.write(end) if end else sys.stdout.write('\n')

def GCD(x, y):
	return GCD(y, x % y) if y else x

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

def modInv(s, mod):
	return modPow(s, mod - 2, mod)
from math import *

def solve():
	t = 1
	t = int(input())
	while t:
		t -= 1
		n = int(input())
		a = 0
		b = 0
		flag = 0
		for i in range(int(pow(n, 1 / 3)) + 1, 1, -1):
			if n % i == 0:
				a = i
				tmp = n // a
				for j in range(int(sqrt(tmp)) + 1, 1, -1):
					if tmp % j == 0 and a != j:
						b = j
						c = tmp // b
						if a != c and b != c:
							if c >= 2:
								flag = 1
							break
		if flag:
			print('YES')
			print(a, b, c)
		else:
			print('NO')
solve()


import sys
from collections import defaultdict
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(int(n))
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	req = primeFactors(n)
	d = defaultdict(lambda : 0)
	for j in req:
		d[j] += 1
	l = sorted(list(set(req)))
	if len(l) >= 3:
		print('YES')
		print(l[0], l[1], n // (l[0] * l[1]))
	elif len(l) == 2:
		ans = [l[0], l[1], n // (l[0] * l[1])]
		if len(set(ans)) == 3 and min(ans) != 1:
			print('YES')
			print(l[0], l[1], n // (l[0] * l[1]))
		else:
			print('NO')
	elif d[l[0]] < 6:
		print('NO')
	else:
		print('YES')
		print(l[0], l[0] ** 2, n // l[0] ** 3)


def p3n(cur):
	j = 2
	while j * j <= cur:
		if cur % j == 0:
			oth = cur // j
			k = 2
			while k * k <= oth:
				if oth % k == 0 and j != k != oth // k != j:
					print('YES')
					print(j, k, oth // k)
					return
				k += 1
		j += 1
	print('NO')
t = int(input())
tc = []
for i in range(t):
	tc.append(int(input()))
for i in range(t):
	p3n(tc[i])


import sys
import math
r_input = sys.stdin.readline

def get_divisor(num):
	divisors = []
	length = int(math.sqrt(num)) + 1
	for i in range(1, length):
		if num % i == 0:
			divisors.append(i)
			divisors.append(num // i)
	return divisors
T = int(r_input())
for _ in range(T):
	number = int(r_input())
	f_list = get_divisor(number)
	flag = 0
	for n in f_list:
		tp = number // n
		s_list = get_divisor(tp)
		for m in s_list:
			tmp = sorted([n, m, tp // m])
			if not 1 in tmp:
				if tmp[0] != tmp[1] and tmp[1] != tmp[2]:
					print('YES')
					print(*tmp)
					flag = 1
					break
		if flag:
			break
	if not flag:
		print('NO')


import math

def factors(x):
	l = []
	while x > 1:
		a = 0
		for i in range(2, int(math.sqrt(x) + 1)):
			if x % i == 0:
				l.append(i)
				a = 1
				break
		if a == 0:
			l.append(x)
			break
		x = x // l[-1]
	return l
t = int(input())
while t:
	n = int(input())
	l1 = factors(n)
	if len(l1) < 3:
		print('NO')
	elif len(l1) == 3:
		if l1[0] != l1[-1] and l1[0] != l1[1] and (l1[1] != l1[-1]):
			print('YES')
			s = ''
			for i in l1:
				s += str(i) + ' '
			print(s)
		else:
			print('NO')
	elif l1[0] == l1[1]:
		l1[1] = l1[1] * l1[2]
		l1.pop(2)
		i = 3
		while i < len(l1):
			l1[2] *= l1[i]
			l1.pop(i)
		if l1[0] != l1[-1] and l1[0] != l1[1] and (l1[1] != l1[-1]):
			print('YES')
			s = ''
			for i in l1:
				s += str(i) + ' '
			print(s)
		else:
			print('NO')
	else:
		i = 3
		while i < len(l1):
			l1[2] *= l1[i]
			l1.pop(i)
		if l1[0] != l1[-1] and l1[0] != l1[1] and (l1[1] != l1[-1]):
			print('YES')
			s = ''
			for i in l1:
				s += str(i) + ' '
			print(s)
		else:
			print('NO')
	t -= 1


from sys import stdin, stdout
t = 1
t = int(input())

def factorgreaterthan(n, x):
	i = x + 1
	while i * i <= n:
		if n % i == 0:
			return i
		i += 1
	return n
for i in range(t):
	n = int(input())
	N = n
	l = []
	d1 = factorgreaterthan(n, 1)
	n //= d1
	l.append(d1)
	d2 = factorgreaterthan(n, d1)
	n //= d2
	l.append(d2)
	l.append(n)
	l.sort()
	m = 1
	flag = True
	p = 1
	for i in l:
		m *= i
		if i == p:
			flag = False
		p = i
	if m != N:
		flag = False
	if flag:
		print('YES')
		print(*l)
	else:
		print('NO')


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 math import ceil, floor, log, sqrt, factorial, pi
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def 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):
	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()
		f = 0
		for i in range(2, int(sqrt(n)) + 1):
			if n % i == 0:
				x = n // i
				for j in range(2, int(sqrt(x)) + 1):
					if x % j == 0 and j != i:
						if x // j >= 2 and x // j != j and (x // j != i):
							print('YES')
							print(i, j, x // j)
							f = 1
							break
				if f == 1:
					break
		if f == 0:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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


import math
q = int(input())
for j in range(q):
	n = int(input())
	d = []
	flag = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if len(d) == 2:
				break
			else:
				d.append(i)
				n = int(n / i)
	if len(d) == 1 or len(d) == 0:
		flag = 1
	elif len(d) == 2:
		if n > 1:
			if n != d[0] and n != d[1]:
				print('YES')
				print(d[0], end=' ')
				print(d[1], end=' ')
				print(n)
			else:
				flag = 1
		else:
			flag = 1
	if flag == 1:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = 1
	j = 2
	while j * j <= n:
		if n % j == 0:
			a = j
			break
		j = j + 1
	if a == 1:
		print('NO')
	else:
		b = 1
		n = n / a
		j = a + 1
		while j * j <= n:
			if n % j == 0:
				b = j
				break
			j = j + 1
		n = int(n / b)
		if b == 1:
			print('NO')
		elif n <= b:
			print('NO')
		else:
			print('YES')
			print(str(a) + ' ' + str(b) + ' ' + str(n))


import math

def pf(n):
	cat = []
	while n % 2 == 0:
		cat.append(2)
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			cat.append(i)
			n //= i
	if n > 2:
		cat.append(n)
	return cat
for _ in range(int(input())):
	n = int(input())
	factors = pf(n)
	factors.sort()
	ss = list(set(factors))
	if len(ss) >= 3 and len(factors) >= 3:
		a = ss[0]
		b = ss[1]
		d = a * b
		c = n // d
		print('YES')
		print(a, b, c)
	elif len(ss) == 1 and len(factors) >= 6:
		a = ss[0]
		b = pow(a, 2)
		c = n // pow(a, 3)
		print('YES')
		print(a, b, c)
	elif len(ss) == 2 and len(factors) >= 4:
		a = ss[0]
		b = ss[1]
		c = n // (a * b)
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
T = int(input())

def primeFactors(n):
	c = 1
	for i in range(2, int(math.sqrt(n)) + 1, 1):
		while n % i == 0:
			c = c * i
			if c not in L and c > 1 and (len(L) < 2):
				L.append(c)
				c = 1
			n = n // i
	if n > 2:
		c *= n
	if c > 1 and c not in L:
		L.append(c)
for t in range(T):
	N = int(input())
	L = []
	primeFactors(N)
	if len(L) == 3:
		print('YES')
		print(L[0], L[1], L[2])
	else:
		print('NO')


def product(n):
	A = []
	L1 = isPrime(n, A)
	if len(L1) != 1:
		print('NO')
	else:
		n = n // L1[0]
		L2 = isPrime(n, L1)
		if len(L2) != 2:
			print('NO')
		else:
			n = n // L2[1]
			if n in L2:
				print('NO')
			else:
				L2.append(n)
				print('YES')
				for el in L2:
					print(el, end=' ')

def isPrime(n, B):
	d = 2
	isPrime = True
	while d * d <= n and isPrime:
		if n % d == 0 and d not in B:
			B.append(d)
			isPrime = False
		else:
			d += 1
	return B
t = int(input())
for i in range(t):
	n = int(input())
	product(n)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	raj = set()
	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0:
			raj.add(i)
			raj.add(n // i)
	flg = 0
	for i in raj:
		a = i
		dup = n // a
		andro = set()
		for j in range(2, math.ceil(math.sqrt(dup))):
			if dup % j == 0:
				b = j
				c = dup // b
				if b != a and b != c and (c > 1) and (a != c):
					ans = [a, b, c]
					ans = sorted(ans)
					print('YES')
					print(*ans)
					flg = 1
					break
		if flg == 1:
			break
	if not flg:
		print('NO')


import math

def printDivisors(n):
	i = 2
	x = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				x.append(i)
			else:
				x.append(i)
				x.append(n // i)
		i = i + 1
	return x
t = int(input())
for test in range(t):
	n = int(input())
	x = printDivisors(n)
	y = {}
	for aa in x:
		y[aa] = y.get(aa, 0) + 1
	nn = len(x)
	f = 0
	(a, b, c) = (0, 0, 0)
	for i in range(nn - 1):
		for j in range(i + 1, nn):
			if x[i] * x[j] <= n and x[i] * x[j] != 0 and (n % (x[i] * x[j]) == 0):
				check = n // (x[i] * x[j])
				if check == x[i] or check == x[j]:
					continue
				elif check in y:
					f = 1
					a = x[i]
					b = x[j]
					c = check
					break
		if f == 1:
			break
	if f == 1:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(2, n // 2):
		if n % i == 0:
			n //= i
			a.append(i)
		if len(a) == 2 or n < i * i:
			break
	if len(a) == 2 and n not in a and (n >= 2):
		print('YES')
		print(*a, n)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	f = 0
	i = 2
	li = []
	while i * i <= n:
		if n % i == 0:
			f += 1
			li.append(i)
			n = n // i
		i += 1
		if f == 2:
			break
	if f == 2 and n != 1 and (n not in li):
		print('YES')
		print(*li, n)
	else:
		print('NO')


from math import sqrt

def fact(k):
	for i in range(2, int(sqrt(k) + 1)):
		if k % i == 0:
			if k // i != i:
				f = k // i
				return (f, i)
	return (0, 0)

def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		flag = False
		for i in range(2, int(sqrt(n) + 1)):
			if n % i == 0:
				if n // i != i:
					f = n // i
					(a, b) = fact(i)
					(c, d) = fact(f)
					if a != f and b != f and (a != 0):
						print('YES')
						print(a, b, f)
						flag = True
						break
					elif c != i and d != i and (d != 0):
						print('YES')
						print(c, d, i)
						flag = True
						break
		if not flag:
			print('NO')
main()


import math
for i in range(int(input())):
	n = int(input())
	l = []
	count = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			l.append(i)
			n = n // i
			break
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and len(l) == 1 and (l[0] != i):
			l.append(i)
			n = n // i
			count = 1
			break
	flag = 0
	if count == 1:
		if n != l[0] and n != l[1]:
			l.append(n)
	else:
		flag = 1
	if len(l) == 3 and flag == 0:
		print('YES')
		print(*l)
	else:
		print('NO')


import sys
input = sys.stdin.readline

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

def II():
	return int(input().strip())

def LI():
	return [*map(int, input().strip().split())]
import copy, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from operator import itemgetter
import itertools
for _ in range(II()):
	n = II()
	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)
	p = len(set(l))
	z = len(l)
	if p == 1:
		if z >= 6:
			print('YES')
			print(l[0], end=' ')
			print(l[1] * l[2], end=' ')
			print(l[0] ** (z - 3))
		else:
			print('NO')
	elif p == 2:
		if z >= 4:
			l.sort()
			y = 1
			m = list(set(l))
			v = m[0]
			k = m[1]
			l.remove(v)
			l.remove(k)
			print('YES')
			print(v, end=' ')
			print(k, end=' ')
			for i in range(len(l)):
				y = y * l[i]
			print(y)
		else:
			print('NO')
	elif p > 2:
		print('YES')
		x = 1
		if z == 3:
			print(*l)
		else:
			l.sort()
			for i in range(3, z):
				x = x * l[i]
			print(x, l[0], l[1] * l[2])


for _ in range(int(input())):
	n = int(input())
	ok = False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			p = n // i
			if p == i:
				continue
			for j in range(i + 1, int(p ** 0.5) + 1):
				if p % j == 0:
					if j * j != p and p // j != i:
						print('YES')
						print(i, j, p // j)
						ok = True
						break
		if ok:
			break
	if not ok:
		print('NO')


R = lambda : list(map(int, input().split()))

def solve():
	n = R()[0]
	(a, cnt, i) = ([0, 0], 0, 2)
	while i * i < n and cnt < 2:
		if n % i == 0:
			a[cnt] = i
			cnt += 1
			n //= i
		i += 1
	if cnt < 2:
		print('NO')
	else:
		print('YES\n', a[0], a[1], n)
o_o = R()[0]
for _ in range(o_o):
	solve()


from math import sqrt

def divide(n, start):
	for k in range(start, int(sqrt(n)) + 1):
		if n % k == 0:
			return k
	return n
for _ in range(int(input())):
	n = int(input())
	a = divide(n, 2)
	if a == n:
		print('NO')
		continue
	n //= a
	b = divide(n, a + 1)
	if b == n:
		print('NO')
		continue
	n //= b
	if n <= b:
		print('NO')
		continue
	print('YES')
	print(a, b, n)


import math

def primeFactors(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
t = int(input())
while t:
	n = int(input())
	l = []
	l = primeFactors(n)
	n1 = len(l)
	(a, b, c) = (0, 0, 0)
	a = l[0]
	x = list(set(l))
	n2 = len(x)
	if n1 >= 5:
		if l[0] != l[1]:
			b = l[1]
			r = 2
		else:
			b = l[1] * l[2]
			r = 3
		c = 1
		for i in range(r, n1):
			c = c * l[i]
	if n1 == 3 and n2 == 3:
		b = l[1]
		c = l[2]
	if n1 == 4:
		if l[0] != l[1]:
			b = l[1]
			c = l[2] * l[3]
		else:
			b = l[1] * l[2]
			c = l[3]
	a = int(a)
	b = int(b)
	c = int(c)
	if a != b and b != c and (c != a):
		print('YES')
		print(a, b, c)
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	for x in range(2, n):
		if x * x * x >= n:
			break
		for y in range(x + 1, n):
			if x * y * y >= n:
				break
			if n % (x * y) == 0:
				f = 1
				print('YES')
				print(x, y, n // (x * y))
				break
		if f > 0:
			break
	if f == 0:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	a = b = c = -1
	ok = 0
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			if a == -1:
				a = j
				n /= a
			elif b == -1:
				b = j
				n /= b
				if n >= 2 and n != a and (n != b):
					c = n
					ok = 1
				else:
					break
	if ok:
		print('YES')
		print(a, b, int(c))
	else:
		print('NO')


from math import sqrt

def two_dist(n, k):
	ans = []
	for i in range(2, int(sqrt(n)) + 5):
		if n % i == 0:
			if i != n // i and i != k and (n // i != k) and (n // i >= 2):
				return [i, n // i]
	return False
for _ in range(int(input())):
	n = int(input())
	ans = []
	for p in range(2, int(sqrt(n)) + 4):
		if n % p == 0:
			find = two_dist(n // p, p)
			if find:
				ans = [p] + find
				break
	if ans:
		print('YES')
		print(' '.join((str(k) for k in ans)))
	else:
		print('NO')


import math
from collections import defaultdict

def divisors(n, ans):
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				ans.append(i)
			else:
				ans.append(i)
				ans.append(n // i)
		i = i + 1
for _ in range(int(input())):
	n = int(input())
	d1 = []
	divisors(n, d1)
	rec = defaultdict(int)
	for i in d1:
		rec[i] = 1
	flag = 0
	for i in d1:
		d2 = []
		divisors(n // i, d2)
		for j in d2:
			if rec.get(j, 0) != 0 and rec.get(n // i // j, 0) != 0 and (n // i // j != j) and (n // i // j != i) and (i != j):
				flag = 1
				print('YES')
				print(i, j, n // i // j)
				break
		if flag == 1:
			break
	if flag == 0:
		print('NO')


import math
t = int(input())
for tt in range(t):
	n = int(input())
	m = n
	fact = []
	while m % 2 == 0:
		fact.append(2)
		m = m / 2
	for i in range(3, int(math.sqrt(m)) + 1, 2):
		while m % i == 0:
			fact.append(i)
			m = m / i
	if m > 2:
		fact.append(m)
	(a, b) = (1, 1)
	for v in fact:
		if a == 1:
			a = v
		elif b == 1 or b == a:
			b *= v
		else:
			break
	if a * b == 0:
		print('NO')
		continue
	c = n / (a * b)
	if c == 1 or c == a or c == b:
		print('NO')
		continue
	print('YES')
	d = int(c)
	print(a, b, d)


def IsPrime(n):
	d = 2
	while d * d <= n and n % d != 0:
		d += 1
	return d * d > n
t = int(input())
ans = []
for j in range(t):
	n = int(input())
	divs = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			x = n // i
			u = i + 1
			while u * u <= x:
				if x % u == 0:
					if x // u == u:
						break
					ans.append(['YES', i, u, x // u])
					u = x
					i = n
				u += 1
		i += 1
	if len(ans) == j:
		ans.append(['NO'])
for i in range(len(ans)):
	if len(ans[i]) == 1:
		print(*ans[i])
	else:
		print(ans[i][0])
		print(*ans[i][1:])


t = int(input())
for _ in range(t):
	n = int(input())
	dah = False
	for i in range(2, int(n ** (1.0 / 3)) + 1):
		if n % i == 0:
			ii = int(n / i)
			for j in range(i + 1, int(ii ** (1.0 / 2)) + 1):
				if ii % j == 0:
					jj = int(ii / j)
					if i != j and j != jj and (i != jj):
						print('YES')
						print(i, j, jj)
						dah = True
						break
		if dah:
			break
	if not dah:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	f = 0
	a = 0
	b = 0
	c = 0
	f2 = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a = i
			f2 = 1
			break
	if f2 == 1:
		for j in range(2, int((n // i) ** 0.5) + 1):
			if n // i % j == 0 and j != i and (n // i // j != j) and (n // i // j != i):
				b = n // i // j
				c = j
				f = 1
				break
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(a, b, c)


def main():
	t = int(input())
	for z in range(t):
		n = int(input())
		arr = []
		i = 2
		while i * i <= n:
			while n % i == 0:
				arr.append(i)
				n //= i
			i += 1
		if n > 1:
			arr.append(n)
		(a, b, c) = (1, 1, 1)
		for x in arr:
			if a == 1:
				a *= x
			elif b == 1 or a == b:
				b *= x
			else:
				c *= x
		arr = set([a, b, c])
		if a != 1 and b != 1 and (c != 1) and (len(arr) == 3):
			print('YES')
			print(a, b, c)
		else:
			print('NO')
main()


def f(n):
	for i in range(2, int(n ** (1 / 3)) + 1):
		if n % i == 0:
			m = n / i
			for j in range(2, int(m ** (1 / 2)) + 1):
				if m % j == 0:
					o = int(m / j)
					if i != j and j != o and (o != i):
						return (i, j, o)
	return (0, 0, 0)
t = int(input())
while t:
	t -= 1
	n = int(input())
	(p, q, r) = (0, 0, 0)
	(p, q, r) = f(n)
	if p != 0:
		print('YES')
		print(p, q, r)
	else:
		print('NO')


def req(n):
	k = int(n ** (1 / 2))
	for a in range(2, k):
		if n % a == 0:
			for b in range(2, k):
				if b != a:
					if n % (a * b) == 0:
						c = n // (a * b)
						if b != c and a != c:
							return [a, b, c]
	return 0
t = int(input())
for i in range(t):
	n = int(input())
	result = req(n)
	if result == 0:
		print('NO')
	else:
		print('YES')
		print(*result)


import math
a = [0] * 100000
for i in range(3, 100000, 2):
	a[i] = 1
for i in range(3, 100000, 2):
	if a[i] == 1:
		for j in range(i * i, 100000, i):
			a[j] = 0
a[2] = 1
a1 = []
for i in range(100000):
	if a[i] == 1:
		a1.append(i)
for _ in range(int(input())):
	num = int(input())
	n = num
	ans = []
	for i in a1:
		c = 0
		if i * i > n:
			break
		if n % i == 0:
			while n % i == 0:
				n = n // i
				c += 1
			ans.append([i, c])
	if n != 1:
		ans.append([n, 1])
	if len(ans) == 1:
		if ans[0][1] >= 6:
			print('YES')
			print(ans[0][0], pow(ans[0][0], 2), math.floor(num / (ans[0][0] * pow(ans[0][0], 2))))
		else:
			print('NO')
	elif len(ans) >= 2:
		thirdno = num // (ans[0][0] * ans[1][0])
		if thirdno >= 2 and thirdno != ans[0][0] and (thirdno != ans[1][0]):
			print('YES')
			print(ans[0][0], ans[1][0], thirdno)
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for a in range(t):
	n = ori = int(input())
	num = []
	for b in range(2, int(ori ** 0.5) + 1):
		if n % b == 0:
			num.append(b)
			n = n // b
			if len(num) == 2:
				if n != 1:
					num.append(n)
				break
	num = list(set(num))
	if len(num) == 3:
		print('YES')
		print(' '.join(map(str, num)))
	else:
		print('NO')


import math
import os

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

def get_divisions(a):
	i = 2
	while i <= math.sqrt(a):
		if a % i == 0:
			yield i
		i += 1
	yield (-1)
t = int(input())
for i in range(t):
	n = int(input())
	divs = get_divisions(n)
	while True:
		a = next(divs)
		f = False
		if a != -1:
			divs_a = get_divisions(n / a)
			while True:
				b = next(divs_a)
				if b != -1:
					c = int(n / a / b)
					if b != a and c != b:
						print('YES')
						print(a, ' ', b, ' ', c)
						f = True
						break
				else:
					f = False
					break
			if not f:
				print('NO')
			break
		else:
			print('NO')
			break


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline

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

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

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

def val():
	return int(input().rstrip('\n'))

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

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

def primefactors(n):
	l = []
	while not n % 2:
		l.append(2)
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while not n % i:
			l.append(i)
			n //= i
	if n > 2:
		l.append(n)
	return l
for _ in range(val()):
	l = sorted(primefactors(val()))
	ans = 'YES'
	if len(l) < 3:
		print('NO')
		continue
	first = l[0]
	second = 1
	for i in range(1, len(l) - 1):
		secondlast = l[i - 1]
		second *= l[i]
		last = l[i]
	third = l[-1]
	if second == third:
		second //= last
		third *= last
	if third == first:
		second //= secondlast
		third *= secondlast
	if second == first or second == third or first == third or (1 in set([first, second, third])):
		print('NO')
		continue
	print('YES')
	print(first, second, third)


import math

def GetNumber(start, n, number, count):
	if count == 1 and n >= start:
		number += str(n)
		print('YES')
		print(number)
		return
	for i in range(start, int(math.sqrt(n)) + 1):
		if n % i == 0:
			number += str(i) + ' '
			count -= 1
			GetNumber(i + 1, int(n / i), number, count)
			return
	print('No')
	return
inputCount = int(input(''))
for i in range(0, inputCount):
	n = int(input(''))
	GetNumber(2, n, '', 3)


for _ in range(int(input())):
	n = int(input())
	x = int(n)
	v = 2
	k = 0
	t = []
	while n > v * v and k < 2:
		if n % v == 0:
			t.append(v)
			k += 1
			n = n // v
		v += 1
	if len(t) < 2:
		print('NO')
	else:
		k = x // (t[0] * t[1])
		if k == t[0] or k == t[1]:
			print('NO')
		else:
			print('YES')
			print(t[0], t[1], x // (t[0] * t[1]))


t = int(input())
from math import sqrt
primes = [True for i in range(10 ** 5)]
for i in range(2, len(primes)):
	jumper = i
	ind = 2
	while i * ind < len(primes):
		primes[i * ind] = False
		ind += 1
primes = set([i for i in range(len(primes)) if primes[i]])

def divider(x):
	if x % 2 == 0:
		return (x // 2, 2)
	for i in range(3, int(sqrt(x) + 1), 2):
		if x % i == 0:
			return (x // i, i)
	return (-1, -1)
for _ in range(t):
	n = int(input())
	flag = False
	(ans1, ans2, ans3) = (0, 0, 0)
	for i in range(2, int(sqrt(n) + 1)):
		reali = n // i
		if n % i == 0 and n // i not in primes:
			(ans2, ans3) = divider(n // i)
			if ans2 == -1 and ans3 == -1:
				continue
			ans1 = i
			if ans1 != ans2 and ans2 != ans3 and (ans3 != ans1):
				flag = True
				break
	if flag:
		print('YES')
		print(ans1, ans2, ans3)
	else:
		print('NO')


def cal1(n, tmp):
	i = 2
	while i * i <= n:
		if n % i == 0:
			if i != n // i and i != tmp and (n // i != tmp):
				return (tmp, i, n // i)
		i += 1
	return (-1, 0, 0)

def cal(n):
	i = 2
	while i * i <= n:
		if n % i == 0 and n // i != i:
			(res, a, b) = cal1(n // i, i)
			if res != -1:
				return (1, res, a, b)
		i += 1
	return (0, 0, 0, 0)
for i in range(int(input())):
	n = int(input())
	(res, a, b, c) = cal(n)
	if res == 1:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


for i in range(int(input())):
	from math import sqrt

	def findTriplets(x):
		fact = []
		factors = set()
		for i in range(2, int(sqrt(x))):
			if x % i == 0:
				fact.append(i)
				if x / i != i:
					fact.append(x // i)
				factors.add(i)
				factors.add(x // i)
		found = False
		k = len(fact)
		for i in range(k):
			a = fact[i]
			for j in range(k):
				b = fact[j]
				if a != b and x % (a * b) == 0 and (x / (a * b) != a) and (x / (a * b) != b) and (x / (a * b) != 1):
					print('YES')
					print(a, b, x // (a * b))
					found = True
					break
			if found:
				break
		if not found:
			print('NO')
	if __name__ == '__main__':
		x = int(input())
		findTriplets(x)


import math

def splitPrime(n):
	arr = {}
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n != 0 and n % i == 0:
			f = arr.get(i, 0)
			arr[i] = int(f + 1)
			n = n // i
	if n > 1:
		arr[n] = 1
	return arr
t = int(input())
for i in range(t):
	n = int(input())
	arr = splitPrime(n)
	numbersKey = len(arr)
	if numbersKey >= 3:
		print('YES')
		count = 0
		result = 1
		for key in arr:
			if count == 2:
				break
			print(key, end=' ')
			result *= key
			count += 1
		print(n // result)
	elif numbersKey == 2 and sum(arr.values()) >= 4:
		print('YES')
		result = 1
		for key in arr:
			print(key, end=' ')
			result *= key
		print(n // result)
	elif numbersKey == 1 and sum(arr.values()) >= 6:
		print('YES')
		for key in arr:
			print(key, int(math.pow(key, 2)), int(n // math.pow(key, 3)))
	else:
		print('NO')


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	n1 = 0
	n2 = 0
	n3 = 0
	for j in range(2, int(math.ceil(math.sqrt(n)))):
		if n % j == 0:
			n1 = j
			n3 = n / j
			break
		else:
			continue
	z = 0
	for j in range(n1 + 1, int(math.ceil(math.sqrt(n3)))):
		if n3 % j == 0 and j != n3 / j and (n3 / j != n1):
			z = 1
			n2 = j
			n3 = int(n3 / j)
			break
		else:
			continue
	if z == 0:
		print('NO')
	else:
		print('YES')
		print(n1, n2, n3)


for i in range(int(input())):
	n = int(input())
	ans1 = 1
	ans2 = 1
	ans3 = 1
	p = 2
	while n % p == 0:
		if ans1 == 1:
			ans1 *= p
		elif ans2 == 1 or ans2 == ans1:
			ans2 *= p
		else:
			ans3 *= p
		n //= p
	p = 3
	while p <= n ** 0.5:
		while n % p == 0:
			if ans1 == 1:
				ans1 *= p
			elif ans2 == 1 or ans2 == ans1:
				ans2 *= p
			else:
				ans3 *= p
			n //= p
		p += 2
	if n != 1:
		if ans1 == 1:
			ans1 *= n
		elif ans2 == 1 or ans2 == ans1:
			ans2 *= n
		else:
			ans3 *= n
	if ans1 != 1 and ans2 != 1 and (ans3 != 1):
		if ans1 != ans2 and ans1 != ans3 and (ans2 != ans3):
			print('YES')
			print(ans1, ans2, ans3)
		else:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	fac = []
	count = 0
	i = 2
	p = 0
	z = math.sqrt(n)
	while count != 2 and i < z:
		if n % i == 0:
			p = 1
			fac.append(str(i))
			n = n // i
			count += 1
		i += 1
	if str(n) not in fac and len(fac) == 2:
		ans.append('YES')
		fac.append(str(n))
		ans.append(' '.join(fac))
	else:
		ans.append('NO')
for i in ans:
	print(i)


from sys import stdin
inp = (s.rstrip() for s in stdin).__next__

def mpint():
	return map(int, inp().split())
N = int(100000.0)
is_prime = [True] * (N + 1)
is_prime[0] = is_prime[1] = False
prime = []
for n in range(2, N + 1):
	if is_prime[n]:
		prime.append(n)
	for p in prime:
		if n * p > N:
			break
		is_prime[p * n] = False
		if n % p == 0:
			break

def f():
	global n
	if len(ans) == 2:
		return
	for p in prime:
		if p * p > n:
			return
		if n % p == 0:
			n //= p
			ans.append(p)
			return f()
for case in range(int(inp())):
	n = int(inp())
	ans = []
	f()
	if len(ans) <= 1:
		print('NO')
		continue
	if ans[0] == ans[1]:
		for p in range(2, int(n ** 0.5) + 1):
			if n % p == 0:
				n //= p
				ans[1] *= p
				break
	if len(set(ans + [n])) == 3:
		print('YES')
		print(*ans, n)
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	c = 2
	p = []
	while len(p) < 2 and c * c <= num:
		if num % c == 0:
			num = num // c
			p.append(c)
		c += 1
	if len(p) == 2 and num not in p:
		print('YES')
		print(*p, num)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	abc = set()
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if len(abc) == 0:
				abc.add(i)
				n = n // i
			elif i != n // i and n // i != 1:
				abc.add(i)
				abc.add(n // i)
				break
	if len(abc) == 3:
		print('YES')
		for num in abc:
			print(num, end=' ')
		print('')
	else:
		print('NO')


def factor(n):
	s = set()
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			s.add(i)
			s.add(n // i)
	f = list(s)
	f.sort()
	return f
t = int(input())
while t:
	t -= 1
	n = int(input())
	f = factor(n)
	b = 0
	if f:
		for i in range(len(f) // 2):
			for j in range(i + 1, len(f) // 2):
				if n % (f[i] * f[j]) == 0:
					l = [f[i], f[j], n // (f[i] * f[j])]
					if len(set(l)) == 3:
						print('YES')
						print(*l)
						b = 1
						break
			if b:
				break
		if b == 0:
			print('NO')
	else:
		print('NO')


def product_of_three_numbers():
	num_test = int(input())
	count = 0
	n_list = []
	while count < num_test:
		n_list += [int(input())]
		count += 1
	answer_list = []
	for (idx, n) in enumerate(n_list):
		if n <= 5:
			answer_list += ['NO']
			continue
		breakit = False
		for a in range(2, n + 1):
			if (a - 1) * (a - 1) >= n:
				answer_list += ['NO']
				break
			if n % a == 0:
				divbya = int(n / a)
				if divbya <= a:
					answer_list += ['NO']
					break
				for b in range(a, divbya):
					if (b - 1) * (b - 1) >= divbya:
						answer_list += ['NO']
						breakit = True
						break
					if divbya % b == 0:
						if b == a:
							continue
						divbyb = int(divbya / b)
						if divbyb <= b:
							answer_list += ['NO']
							breakit = True
							break
						answer_list += ['YES']
						answer_list += [str(a) + ' ' + str(b) + ' ' + str(divbyb)]
						breakit = True
						break
			if breakit:
				break
	for answer in answer_list:
		print(answer)
product_of_three_numbers()


import sys
input = sys.stdin.readline
t = int(input())
import math

def primeFactors(n):
	factor = []
	number = []
	while n % 2 == 0:
		factor.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factor.append(int(i))
			n = n / i
	if n > 2:
		factor.append(int(n))
	return factor
for i in range(t):
	n = int(input())
	ffactor = primeFactors(n)
	ffactor2 = list(set(ffactor))
	if len(ffactor2) >= 3:
		print('YES')
		print(int(ffactor2[0]), int(ffactor2[1]), int(n / (ffactor2[1] * ffactor2[0])))
	elif len(set(ffactor)) >= 2 and len(ffactor) >= 4:
		print('YES')
		print(int(ffactor2[0]), int(ffactor2[1]), int(n / (ffactor2[1] * ffactor2[0])))
	elif len(ffactor2) >= 1 and len(ffactor) >= 6:
		print('YES')
		first = int(ffactor2[0])
		sec = int(ffactor2[0] ** 2)
		third = int(n / (first * sec))
		print(int(first), int(sec), int(third))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [1] * 3
	i = 0
	p = 2
	while n > 1:
		if n % p != 0:
			p += 1
			if p >= int(n ** 0.5) + 1:
				break
			continue
		arr[i] *= p
		n //= p
		if i > 0 and arr[1] == arr[0]:
			continue
		i += 1
		if i == 2:
			break
	if i < 2 or n == 1 or n == arr[0] or (n == arr[1]):
		print('NO')
	else:
		print('YES')
		print(f'{arr[0]} {arr[1]} {n}')


for _ in ' ' * int(input()):
	a = int(input())
	b = []
	i = 2
	while len(b) < 2 and i * i < a:
		if a % i == 0 and i not in b:
			b += [i]
			a //= i
			i = 2
		else:
			i += 1
	if len(b) == 2 and a > 1:
		print('YES')
		print(*b, a)
	else:
		print('NO')


t = int(input())
for T in range(t):
	n = int(input())
	ans = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ans.append(i)
			val = n // i
			for j in range(2, int(val ** 0.5) + 1):
				ans = [i]
				if val % j == 0:
					ans.append(j)
					ans.append(val // j)
					if len(set(ans)) == 3:
						break
			if len(set(ans)) == 3:
				break
			ans.append(n // i)
			val = i
			for j in range(2, int(val ** 0.5) + 1):
				if val % j == 0:
					ans.append(j)
					ans.append(val // j)
					if len(set(ans)) == 3:
						break
				ans = [n // i]
			if len(set(ans)) == 3:
				break
		ans = []
	if len(ans) == 3:
		print('YES')
		print(*ans)
	else:
		print('NO')


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
from collections import deque, defaultdict, OrderedDict
import collections

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

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = primeFactors(n)
		amult = 1
		alen = len(a)
		for i in range(1, alen - 1):
			amult = amult * a[i]
		t = 0
		if alen < 3:
			ws('NO')
		else:
			z = len(set(a))
			if z >= 3:
				ws('YES')
				ans = [a[0], a[-1], amult]
				t = 1
			if z == 2:
				if alen >= 4:
					ws('YES')
					ans = [a[0], a[-1], amult]
					t = 1
				if t == 0:
					ws('NO')
			if z == 1:
				if alen >= 6:
					ws('YES')
					ans = [a[0], a[0] * 2, n // a[0] ** 3]
					t = 1
				if t == 0:
					ws('NO')
		if t == 1:
			wia(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

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

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

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

class FastWriter(io.IOBase):

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

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

class FastStdin(io.IOBase):

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

class FastStdout(io.IOBase):

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


import math
for _ in range(int(input())):
	n = int(input())
	f = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == 0:
				f.append(i)
			else:
				f.append(n // i)
				f.append(i)
		i = i + 1
	f = set(f)
	f = list(f)
	ln = len(f)
	f.sort()
	f1 = 0
	for i in range(ln):
		for j in range(1, ln):
			for k in range(2, ln):
				if f[i] * f[j] * f[k] == n:
					print('YES')
					print(f[i], f[j], f[k])
					f1 = 1
					break
			if f1 == 1:
				break
		if f1 == 1:
			break
	if f1 == 0:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	til = int(n ** 0.5) + 1
	i = 2
	while i < til:
		if n % i == 0:
			til = int((n // i) ** 0.5) + 1
			n = n // i
			l.append(i)
		if len(l) == 2:
			break
		i += 1
	if n > 1 and n not in l and (len(l) == 2):
		print('YES')
		print(l[0], l[1], n)
	else:
		print('NO')


import sys
import math
import heapq
import bisect
import re
from collections import deque
from decimal import *
from fractions import gcd

def main():
	n = int(sys.stdin.readline())
	q = []
	for i in range(int(n ** 0.5) + 1, 0, -1):
		if n % i == 0:
			q.append(i)
			if n // i != i:
				q.append(n // i)
	q.sort()
	if len(q) <= 3:
		print('NO')
		return 0
	i = 1
	while i < len(q) - 3:
		i += 1
		f = n / q[1] / q[i]
		if f != q[1] and f != q[i] and (f >= 2) and (f == int(f)) and (int(f) * q[1] * q[i] == n):
			print('YES')
			print(q[1], q[i], int(f))
			return 0
	print('NO')
for i in range(int(input())):
	main()


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
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))

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

def factors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac
for _ in range(int(input())):
	n = int(input())
	fac = factors(n)
	if len(fac) < 3:
		print('NO')
	elif len(fac) == 3 and len(set(fac)) == 3:
		print('YES')
		print(*fac)
	elif len(fac) == 3 and len(set(fac)) < 3:
		print('NO')
	elif len(set(fac)) >= 3:
		print('YES')
		ans = [fac[0], fac[-1]]
		c = 1
		for i in range(1, len(fac) - 1):
			c = c * fac[i]
		ans.append(c)
		print(*ans)
	elif len(set(fac)) == 1:
		if len(fac) >= 6:
			print('YES')
			ans = [fac[0], fac[-1] * fac[-2]]
			c = 1
			for i in range(1, len(fac) - 2):
				c = c * fac[i]
			ans.append(c)
			print(*ans)
		else:
			print('NO')
	elif len(set(fac)) == 2:
		print('YES')
		ans = [fac[0], fac[-1]]
		c = 1
		for i in range(1, len(fac) - 1):
			c = c * fac[i]
		ans.append(c)
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	n2 = n
	prime = {}
	z = int(n ** (1 / 2))
	i = 2
	while i < z + 1:
		if n % i == 0:
			prime[i] = prime.get(i, 0) + 1
			n = n // i
			z = int(n ** (1 / 2))
			i = 2
			continue
		else:
			i += 1
	else:
		prime[int(n)] = prime.get(int(n), 0) + 1
	n = n2
	if len(prime) >= 2:
		output = []
		c = 0
		for i in prime:
			if c >= 2:
				break
			output.append(i)
			c += 1
		product = output[0] * output[1]
		if n // product != 1 and n // product not in output:
			print('YES')
			print(output[0], output[1], n // product)
		else:
			print('NO')
	if len(prime) == 1:
		for i in prime:
			if prime[i] >= 6:
				print('YES')
				print(i, i ** i, i ** (prime[i] - 3))
			else:
				print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	d = []
	a = n
	i = 2
	while i * i <= a:
		while a % i == 0:
			d.append(i)
			a //= i
		i += 1
	if a != 1:
		d.append(a)
	a = d[0]
	b = 1
	c = 1
	for i in range(1, len(d)):
		if a == b or b == 1:
			b *= d[i]
		else:
			c *= d[i]
	if a != b and b != c and (a != c) and (a != 1) and (b != 1) and (c != 1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	fin = []
	for i in range(2, 40000):
		if n % i == 0:
			n = n // i
			fin.append(i)
			break
	if len(fin) == 0:
		print('NO')
	else:
		for i in range(2, 40000):
			if n % i == 0 and i != fin[0]:
				n = n // i
				fin.append(i)
				break
		if len(fin) <= 1 or n == fin[0] or n == 1 or (n == fin[1]):
			print('NO')
		else:
			fin.append(n)
			print('YES')
			print(*fin)


from collections import Counter
from collections import defaultdict
import math

def factors(n):
	l = list()
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l
t = int(input())
for _ in range(0, t):
	n = int(input())
	l = factors(n)
	if len(l) == 2:
		print('NO')
		continue
	else:
		a = l[2]
		b = n // a
		l2 = factors(b)
		f = 0
		if len(l2) == 2:
			print('NO')
			continue
		for i in range(2, len(l2)):
			if a != l2[i] and l2[i] != b // l2[i] and (b // l2[i] != a) and (a >= 2) and (l2[i] >= 2) and (b // l2[i] >= 2):
				f = 1
				print('YES')
				print(a, l2[i], b // l2[i])
				break
		if f == 0:
			print('NO')


import math
t = int(input())

def solve(n):
	f = []
	while n % 2 == 0:
		f.append(2)
		n = n / 2
	R = int(math.sqrt(n))
	for e in range(3, R + 1, 2):
		while n % e == 0:
			f.append(e)
			n = n / e
	if n != 1.0:
		f.append(int(n))
	return f
while t > 0:
	t -= 1
	n = int(input())
	factors = solve(n)
	if len(factors) <= 2:
		print('NO')
	else:
		factors.sort()
		a = factors[0]
		pos = 1
		b = 1
		while b <= a:
			b = b * factors[pos]
			pos += 1
		c = 1
		if pos == len(factors):
			print('NO')
			continue
		for e in range(pos, len(factors)):
			c = c * factors[e]
		if a != b and b != c and (a != c):
			print('YES')
			print('{} {} {}'.format(a, b, c))
		else:
			print('NO')


import collections, math
local = False
if local:
	file = open('inputt.txt', 'r')

def inp():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def ints():
	return [int(_) for _ in inp().split()]
t = int(inp())
for _ in range(t):
	n = int(inp())
	sqrtn = int(math.sqrt(n))
	found = False
	for a in range(2, sqrtn):
		if n % a == 0:
			rem = n // a
			for b in range(a + 1, sqrtn):
				if rem % b == 0:
					c = rem // b
					if a != c and a != b and (b != c):
						print('YES')
						print(str(a) + ' ' + str(b) + ' ' + str(c))
						found = True
						break
		if found:
			break
	if not found:
		print('NO')


import math

def primefactors(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
for i in range(int(input())):
	n = int(input())
	ll = primefactors(n)
	dic = {}
	for i in range(len(ll)):
		if ll[i] in dic:
			dic[ll[i]] += 1
		else:
			dic[ll[i]] = 1
	key_list = list(dic.keys())
	value_list = list(dic.values())
	if len(key_list) == 0:
		print('NO')
	elif len(key_list) == 1:
		if value_list[0] > 5:
			p1 = key_list[0]
			print('YES')
			print(p1, p1 * p1, int(n / (p1 * p1 * p1)))
		else:
			print('NO')
	elif len(key_list) == 2:
		if value_list[0] + value_list[1] >= 4:
			(p1, p2) = (key_list[0], key_list[1])
			print('YES')
			print(p1, int(p2), int(n // (p1 * p2)))
		else:
			print('NO')
	else:
		(p1, p2) = (key_list[0], key_list[1])
		print('YES')
		print(p1, int(p2), int(n // (p1 * p2)))


def factor(x):
	p = []
	d = 2
	while d * d <= x:
		if x % d == 0:
			p.append(d)
			x //= d
		else:
			d += 1
	if x > 1:
		p.append(x)
	return p
t = int(input())
for i in range(t):
	n = int(input())
	p = factor(n)
	(a, b, c) = (1, 1, 1)
	ans = 'NO'
	if len(p) > 2:
		a = p[0]
		if p[1] != p[0]:
			b = p[1]
			c = 1
			for k in p[2:]:
				c *= k
			if c != 1 and c != b and (c != a):
				ans = 'YES'
		else:
			b = p[1] * p[2]
			c = 1
			for k in p[3:]:
				c *= k
			if c != 1 and c != b and (c != a):
				ans = 'YES'
	if ans == 'YES':
		print('YES')
		print(a, b, c)
	else:
		print('NO')


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	l = []
	r = floor(sqrt(n)) + 1
	for i in range(2, r):
		if n % i == 0:
			l.append(i)
			c = c + 1
			n = n // i
		if c == 2:
			break
	if len(l) == 2:
		if n == l[0] or n == l[1]:
			print('NO')
		else:
			print('YES')
			print(l[0], l[1], n)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	i = 2
	while i * i < n:
		if n % i == 0:
			li.append(i)
			n /= i
		if len(li) == 2:
			break
		i += 1
	if len(li) != 2 or n in li:
		print('NO')
	else:
		print('YES')
		print(li[0], li[1], int(n))


from collections import Counter

def prime_factorize(n):
	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)
	a = Counter(a)
	return a
t = int(input())
for i in range(t):
	n = int(input())
	a = prime_factorize(n)
	flag = True
	ans = ''
	if len(a.keys()) == 1:
		for (k, v) in a.items():
			if v <= 5:
				flag = False
			else:
				ans = '{} {} {}'.format(k, k ** 2, k ** (v - 3))
	elif len(a.keys()) == 2:
		v_pair = []
		vk_pair = []
		for (k, v) in a.items():
			v_pair.append(v)
			vk_pair.append((v, k))
		if max(v_pair) >= 3 or (v_pair[0] >= 2 and v_pair[1] >= 2):
			ans = '{} {} {}'.format(vk_pair[0][1], vk_pair[1][1], vk_pair[0][1] ** (vk_pair[0][0] - 1) * vk_pair[1][1] ** (vk_pair[1][0] - 1))
		else:
			flag = False
	else:
		b = 1
		for (j, (k, v)) in enumerate(a.items()):
			if j <= 1:
				ans += '{} '.format(str(k ** v))
			else:
				b *= k ** v
		ans += '{}'.format(b)
	if flag:
		print('YES')
		print(ans)
	else:
		print('NO')


import time
s = time.time()
primes = []
poss = [True for i in range(40000)]
for i in range(2, 40000):
	if poss[i]:
		primes.append(i)
		for j in range(i, 40000, i):
			poss[j] = False

def find(n):
	primedivisor = []
	for i in primes:
		if i > n:
			break
		if n % i == 0:
			primedivisor.append(i)
	if len(primedivisor) == 0:
		return -1
	elif len(primedivisor) == 1:
		temp = 1
		ans = -1
		while n % temp == 0:
			temp *= primedivisor[0]
			ans += 1
		if ans < 3:
			return -1
		elif ans < 6:
			if primedivisor[0] ** ans != n:
				return [1, primedivisor[0], primedivisor[0] ** 2]
			else:
				return -1
		else:
			return [primedivisor[0] ** (ans - 3), primedivisor[0], primedivisor[0] ** 2]
	elif len(primedivisor) == 2:
		temp = 1
		ans = -1
		while n % temp == 0:
			temp *= primedivisor[0]
			ans += 1
		temp = 1
		ans2 = -1
		while n % temp == 0:
			temp *= primedivisor[1]
			ans2 += 1
		if ans > 2:
			return [primedivisor[1] ** ans2, primedivisor[0], primedivisor[0] ** (ans - 1)]
		elif ans2 > 2:
			return [primedivisor[0] ** ans, primedivisor[1], primedivisor[1] ** (ans2 - 1)]
		elif ans == 2:
			if ans2 == 1:
				if primedivisor[0] ** 2 * primedivisor[1] != n:
					return [1, primedivisor[0], primedivisor[1]]
				return -1
			else:
				return [primedivisor[1] * primedivisor[0], primedivisor[0], primedivisor[1]]
		elif ans2 == 2:
			if ans == 1:
				if primedivisor[1] ** 2 * primedivisor[0] != n:
					return [1, primedivisor[0], primedivisor[1]]
				return -1
			else:
				return [primedivisor[1] * primedivisor[0], primedivisor[0], primedivisor[1]]
		elif ans == 1 and ans2 == 1:
			if primedivisor[1] * primedivisor[0] != n:
				return [1, primedivisor[0], primedivisor[1]]
			return -1
	else:
		ap = []
		temp = 1
		while n % temp == 0:
			temp *= primedivisor[0]
		ap.append(temp // primedivisor[0])
		temp = 1
		while n % temp == 0:
			temp *= primedivisor[1]
		ap.append(temp // primedivisor[1])
		temp = 1
		for j in range(2, len(primedivisor)):
			while n % temp == 0:
				temp *= primedivisor[j]
			temp = temp // primedivisor[j]
		ap.append(temp)
		return ap
t = int(input())
for _ in range(t):
	n = int(input())
	x = find(n)
	if x != -1:
		temp = x[0] * x[1] * x[2]
		if temp != n:
			x[0] *= n // temp
		print('YES')
		print(*x)
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
import math

def f(x):
	xr = math.ceil(math.sqrt(x))
	LIST = []
	for i in range(1, xr + 1):
		if x % i == 0:
			LIST.append(i)
			LIST.append(x // i)
	return sorted(set(LIST))[1:]
for test in range(t):
	n = int(input())
	L = f(n)
	A = L[0]
	for i in f(n):
		if i != A and i * A < n and (n % (i * A) == 0) and (n // (i * A) != i) and (n // (i * A) != A) and (n // (i * A) != 1):
			print('YES')
			print(A, i, n // (i * A))
			break
	else:
		print('NO')


import math

def printDivisors(n):
	i = 2
	factors = {}
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors[i] = 1
			else:
				factors[n // i] = 1
				factors[i] = 1
		i = i + 1
	return factors
for t in range(int(input())):
	n = int(input())
	f = printDivisors(n)
	factors = list(f.keys())
	factors.sort()
	if len(factors) < 3:
		print('NO')
	else:
		i = 1
		flag = False
		while i < len(factors) // 2:
			temp = factors[0] * factors[i]
			try:
				x = f[temp]
				if n // temp != factors[0] and n // temp != factors[i]:
					print('YES')
					print(factors[0], factors[i], n // temp)
					flag = True
					break
				else:
					i += 1
			except KeyError:
				i += 1
		if not flag:
			print('NO')


for i in range(int(input())):
	n = int(input())
	j = 2
	a = []
	while j * j < n:
		if n % j == 0:
			n //= j
			a.append(j)
			if len(a) == 2:
				a.append(n)
				break
		j += 1
	if len(a) < 3:
		print('NO')
	elif a[1] == a[2]:
		print('NO')
	else:
		print('YES')
		print(a[0], a[1], a[2])


t = int(input())
for q in range(t):
	n = int(input())
	flag = 0
	arr = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			arr.append(i)
			n = n // i
			if len(arr) == 2:
				if n in arr or n < 2:
					break
				arr.append(n)
				flag = 1
				break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		print(*arr)


t = int(input())
if t <= 100:
	while t > 0:
		l = list()
		n = int(input())
		x = int(2)
		y = int(2)
		z = int(2)
		for i in range(2, round(n ** 0.5) + 1):
			if n % i == 0 and (not i in l):
				n = n // i
				l.append(i)
				break
		for i in range(2, round(n ** 0.5) + 1):
			if n % i == 0 and (not i in l):
				n = n // i
				l.append(i)
				break
		if not n in l and n > 1 and (len(l) == 2):
			print('YES')
			print(l[0], l[1], n)
		else:
			print('NO')
		t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	li = list()
	j = 2
	while len(li) < 2 and j * j < n:
		if n % j == 0:
			li.append(j)
			n = n // j
		j += 1
	if len(li) == 2 and n not in li:
		print('YES')
		for i in li:
			print(i, end=' ')
		print(n)
	else:
		print('NO')


from functools import reduce

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

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = int(input())
while t:
	t -= 1
	n = int(input())
	b = True
	l = []
	if is_prime(n):
		print('NO')
		continue
	elif int(n ** 0.5) == n ** 0.5:
		if is_prime(n ** 0.5):
			print('NO')
			continue
		elif int(n ** 0.25) == n ** 0.25:
			if is_prime(n ** 0.25):
				print('NO')
				continue
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			n = int(n / i)
			s = sorted(list(factors(n)))
			if 1 in s:
				s.pop(s.index(1))
			if n in s:
				s.pop(s.index(n))
			if len(s) > 1:
				for ii in range(len(s)):
					if s[ii] > i:
						j = s[ii]
						k = s[len(s) - ii - 1]
						if j != k and i != k:
							l.append(i)
							l.append(j)
							l.append(k)
							print('YES')
							print(*l)
							b = False
							break
		if not b:
			break
	if b:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	i = 2
	while i ** 2 <= n and len(l) < 2:
		if n % i == 0:
			l.append(i)
			n //= i
		i += 1
	if len(l) < 2 or n == 1 or l.count(n):
		print('NO')
	else:
		print('YES')
		l.append(n)
		print(*l)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	m = n
	d = {}
	while n % 2 == 0:
		if 2 not in d:
			d[2] = 1
		else:
			d[2] += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
			n = n / i
	if n > 2:
		d[int(n)] = 1
	l = len(d)
	f = 0
	if l == 1:
		for key in d.keys():
			if d[key] >= 6:
				f = 1
				a = key
				b = key ** 2
				c = int(m / (a * b))
	elif l == 2:
		i = 0
		k = 0
		for key in d.keys():
			k = k + d[key]
			if i == 0:
				a = key
			else:
				b = key
			i = i + 1
		if k >= 4:
			f = 1
			c = int(m / (a * b))
	else:
		f = 1
		i = 0
		for key in d.keys():
			if i == 0:
				a = key
			elif i == 1:
				b = key
			else:
				break
			i = i + 1
		c = int(m / (a * b))
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(a, b, c)


import sys
from bisect import bisect_left as bl, bisect_right as br, bisect
import math
from timeit import default_timer as dt
from itertools import zip_longest as zl
from itertools import groupby as gb
from itertools import combinations as comb
from itertools import combinations_with_replacement as cwr
from collections import defaultdict as dd
from collections import deque as dq
from collections import Counter as c
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return input()

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 [[val for i in range(n)] for j in range(m)]

def factors(n):
	s = set()
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			s.add(n // i)
			s.add(i)
		i += 1
	return s
for _ in range(int(data())):
	n = int(data())
	ans = factors(n)
	if len(ans) < 3:
		print('NO')
	else:
		r = False
		for i in ans:
			for j in ans:
				if i != j:
					if n // (i * j) == n / (i * j) and n // (i * j) != 1 and (n // (i * j) != i) and (n // (i * j) != j):
						print('YES')
						print(i, j, n // (i * j))
						r = True
						break
			if r:
				break
		if not r:
			print('NO')


import math

def fun(s):
	for i in range(2, int(math.sqrt(s)) + 1):
		if s % i == 0:
			w = s // i
			for j in range(i + 1, int(math.sqrt(w) + 1)):
				d = w // j
				if w % j == 0 and d != j and (d != i):
					return (i, j, d)
	return -1
for t in range(int(input())):
	n = int(input())
	q = fun(n)
	if q != -1:
		print('YES')
		print(q[0], q[1], q[2])
	else:
		print('NO')


for _ in range(int(input())):
	t = n = int(input())
	m = []
	j = 2
	while len(m) < 2 and j * j < t:
		if n % j == 0:
			m.append(j)
			n //= j
		j += 1
	if len(m) == 2 and n >= j:
		print('YES')
		print(m[0], m[1], n)
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	done = False
	for i in range(2, int(num ** (1 / 3)) + 8):
		if num % i != 0:
			continue
		new_num = num // i
		for j in range(i + 1, int(num ** 0.5) + 8):
			if new_num % j == 0 and new_num // j not in [i, j, 1]:
				print('YES')
				print(f'{i} {j} {new_num // j}')
				done = True
				break
		if done:
			break
	if not done:
		print('NO')


for i in range(int(input())):
	n = int(input())
	d = []
	cnt = 2
	c = 1
	(a, b, c) = (1, 1, 1)
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			d.append(i)
	if len(d) <= 2:
		print('NO')
		c = 0
	else:
		a = d[0]
		for j in range(len(d)):
			b = d[j]
			c = n // (a * b)
			if a * b * c == n and a < b < c:
				print('YES\n', a, b, c)
				c = 0
				break
	if c:
		print('NO')


import math

def sovle():
	n = int(input())
	a = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a.append(i)
			n //= i
		if len(a) == 2:
			break
	if len(a) == 2 and n not in a:
		print('YES')
		print(a[0], a[1], n)
	else:
		print('NO')

def main():
	for i in range(int(input())):
		sovle()
main()


import math
from collections import Counter

def primeFactors(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
for _ in range(int(input())):
	n = int(input())
	k = primeFactors(n)
	klen = len(set(k))
	if len(k) < 3:
		print('NO')
	elif klen == 3 and len(k) == 3:
		print('YES')
		print(*k)
	elif klen == 2 and len(k) >= 4:
		print('YES')
		a = k[0]
		b = k[-1]
		c = 1
		for t in k[1:len(k) - 1]:
			c *= t
		print(a, b, c)
	elif klen >= 3:
		print('YES')
		kl = set(k)
		jk = list(kl)
		a = jk[0]
		b = jk[1]
		x = 1
		for t in k:
			x *= t
		print(a, b, x // a // b)
	elif len(k) >= 6:
		print('YES')
		a = k[0]
		b = k[1] * k[2]
		c = 1
		for t in range(3, len(k)):
			c *= k[t]
		print(a, b, c)
	else:
		a = k[0]
		flag = 0
		x = 1
		for t in k[1:]:
			x *= t
		b = -1
		c = -1
		for t in range(1, len(k)):
			b = k[t]
			c = x // k[t]
			x //= k[t]
			if a != b and b != c and (a != c) and (a * b * c == n):
				print('YES')
				flag = 1
				print(a, b, c)
				break
		if flag == 0:
			print('NO')


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

def mul(arr):
	p = 1
	if not len(arr):
		return 0
	for i in arr:
		p = p * i
	return p
t = int(input())
for _ in range(t):
	n = int(input())
	dels = primfacs(n)
	result = [dels[0]]
	tmp = []
	for i in range(1, len(dels)):
		tmp.append(dels[i])
		p = mul(tmp)
		if not p or p in result:
			continue
		elif len(result) < 2:
			result.append(p)
			tmp = []
		else:
			continue
	p = mul(tmp)
	if not p or p in result:
		print('NO')
	else:
		result.append(p)
		print('YES')
		print(' '.join((str(int(i)) for i in result)))


def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			for j in range(cnt):
				arr.append(i)
	if temp != 1:
		arr.append(temp)
	if arr == []:
		arr.append(n)
	return arr
n = int(input())
for _ in range(n):
	x = int(input())
	dat = factorization(x)
	datlen = len(dat)
	if len(dat) <= 2:
		print('NO')
	else:
		f = False
		a = 1
		for i in range(datlen):
			a *= dat[i]
			b = 1
			for j in range(i + 1, datlen):
				b *= dat[j]
				c = 1
				for k in range(j + 1, datlen):
					c *= dat[k]
				if a != b and b != c and (a != c) and (a != 1) and (b != 1) and (c != 1):
					f = True
					break
			if f:
				break
		if f:
			print('YES')
			print('{0} {1} {2}'.format(a, b, c))
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	arr = [0, 0, 0]
	k = 0
	while i * i <= n:
		if n % i == 0:
			arr[k] = i
			n = int(n / i)
			k += 1
		if k == 2:
			break
		i += 1
	arr[2] = n
	if arr[1] > 1 and arr[0] > 1 and (arr[2] > 1):
		if arr[0] == arr[1] or arr[1] == arr[2] or arr[0] == arr[1]:
			print('NO')
		else:
			print('YES')
			print(str(arr[0]) + ' ' + str(arr[1]) + ' ' + str(arr[2]))
	else:
		print('NO')


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt, ceil
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def ds(d, s):
	for i in range(s, d + 1):
		if i * i > d:
			break
		if d % i == 0:
			return i

def main():
	n = inp()
	for _ in range(n):
		d = inp()
		d1 = ds(d, 2)
		if d1 is not None:
			d2 = ds(d // d1, d1 + 1)
			if d2 is not None:
				d3 = d // d1 // d2
				if d3 != 1 and d3 != d1 and (d3 != d2):
					print('YES')
					print(' '.join([str(v) for v in [d1, d2, d3]]))
				else:
					print('NO')
			else:
				print('NO')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	dvdrs = []
	passs = True
	if n < 24:
		print('NO')
		continue
	for k in range(2, n):
		if k * k * k > n:
			passs = False
			break
		if n % k == 0:
			dvdrs += [k]
			n = int(n / k)
			break
	if passs:
		for k in range(dvdrs[0] + 1, n):
			if k * k > n:
				passs = False
				break
			if n % k == 0:
				dvdrs += [k]
				n = int(n / k)
				break
	if passs and n != dvdrs[0] and (n != dvdrs[1]):
		print('YES')
		print(str(dvdrs[0]) + ' ' + str(dvdrs[1]) + ' ' + str(n))
	else:
		print('NO')


def getFactors(n):
	fact = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			fact.append(i)
			if i != n // i:
				fact.append(n // i)
		i += 1
	return fact
t = int(input())
while t > 0:
	n = int(input())
	fact = getFactors(n)
	fact.sort()
	found = False
	for i in range(len(fact) - 1):
		for j in range(len(fact)):
			a = fact[i]
			b = fact[j]
			c = n // (a * b)
			if c in fact:
				if a - b != 0 and b - c != 0 and (a - c != 0):
					print('YES')
					print(a, b, c)
					found = True
					break
		if found:
			break
	if not found:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	divisorarr = []
	for divisor in range(2, int(n ** 0.5) + 2):
		if n % divisor == 0:
			while n % divisor == 0:
				n = n // divisor
				divisorarr.append(divisor)
	if n != 1:
		divisorarr.append(n)
	if len(divisorarr) < 3:
		print('NO')
	else:
		a = divisorarr[0]
		b = divisorarr[1]
		index = 2
		while b == a and index < len(divisorarr) - 1:
			b *= divisorarr[index]
			index += 1
		c = 1
		for divisor in range(index, len(divisorarr)):
			c *= divisorarr[divisor]
		if not a != b != c != a:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import math

def printDivisors(n):
	fact = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				fact.append(i)
			else:
				fact.append(i)
				fact.append(n // i)
		i = i + 1
	fact.sort()
	return fact[1:]
for _ in range(int(input())):
	n = int(input())
	f1 = printDivisors(n)
	a = f1[0]
	if len(f1) == 1 or len(f1) == 2:
		print('NO')
		continue
	f2 = printDivisors(n // a)
	try:
		f2.remove(a)
	except:
		pass
	b = f2[0]
	c = n // (a * b)
	if a > 1 and b > 1 and (c > 1) and (a != b) and (b != c) and (a != c):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = []
	i = 2
	while len(l1) < 2 and i * i < n:
		if n % i == 0:
			l1.append(i)
			n = n // i
		i += 1
	if len(l1) == 2:
		print('YES')
		for i in l1:
			print(i, end=' ')
		print(n)
	else:
		print('NO')


import math

def is_prime(n):
	if n == 1:
		return False
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
for _ in range(int(input())):
	n = int(input())
	a = []
	z = int(math.sqrt(n))
	if is_prime(n) == True:
		print('NO')
	else:
		for i in range(2, z):
			if n % i == 0:
				a.append(i)
				n = n // i
			if len(a) == 2:
				break
		if n < 2:
			print('NO')
		elif len(a) == 2:
			if n == a[0] or n == a[1]:
				print('NO')
			else:
				print('YES')
				for i in a:
					print(i, end=' ')
				print(n)
		else:
			print('NO')


import math
t = int(input())
while t > 0:
	n = int(input())
	l = []
	c = 0
	s = int(math.sqrt(n))
	for i in range(2, s + 1):
		if n % i == 0:
			l.append(i)
			c += 1
			n = n // i
			break
	for i in range(2, s + 1):
		if i not in l and n % i == 0:
			l.append(i)
			c += 1
			n = n // i
			break
	if c < 2 or n == 1 or n in l:
		print('NO')
	else:
		print('YES')
		for i in l:
			print(i, end=' ')
		print(n)
	t -= 1


import collections

class Solution:

	def solve(self, n):
		used = set()
		a = 2
		while a * a <= n:
			if n % a == 0 and a not in used:
				used.add(a)
				n //= a
				break
			a += 1
		b = 2
		while b * b <= n:
			if n % b == 0 and b not in used:
				used.add(b)
				n //= b
				break
			b += 1
		if len(used) < 2 or n in used or n == 1:
			return (False, None)
		else:
			return (True, list(used) + [n])
sol = Solution()
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	answer = sol.solve(n)
	if answer[0]:
		print('YES')
		print(' '.join(map(str, answer[1])))
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	i = 2
	result = 'NO'
	while i * i * i < n:
		if n % i == 0:
			j = i + 1
			while j * j < int(n / i):
				if n % (i * j) == 0:
					result = '{} {} {}'.format(i, j, int(n / (i * j)))
					break
				j += 1
			break
		i += 1
	if result != 'NO':
		print('YES')
	print(result)
	t -= 1


for T in range(int(input())):
	N = int(input())
	D = set()
	for I in range(2, int(N ** 0.5) + 1):
		if N % I == 0:
			D.add(I)
			D.add(N // I)
	D = sorted(list(D))
	F = 0
	if len(D) < 3:
		F = 1
		print('NO')
	else:
		for I in range(len(D)):
			for J in range(len(D)):
				if I != J:
					X = N / (D[I] * D[J])
					if X != D[I] and X != D[J] and (X > 1) and (X % 1 == 0):
						F = 1
						print('YES')
						print(D[I], D[J], int(X))
						break
			if F == 1:
				break
	if F == 0:
		print('NO')


t = int(input())

def isnotprime(n):
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			return True
	return False
for _ in range(t):
	n = int(input())
	if n < 8:
		print('NO')
		continue
	found = list()
	foundmul = 1
	done = False
	for i in range(2, int((n // 2 + 1) ** 0.5) + 1):
		if n % i == 0:
			found.append(i)
			foundmul *= i
			n //= i
		if len(found) >= 2:
			if n >= 2 and n not in found:
				print('YES')
				print(found[0], found[1], n)
				done = True
				break
			else:
				done = True
				print('NO')
				break
		if n <= 1:
			done = True
			print('NO')
			break
	if not done:
		print('NO')


from math import sqrt

def primes(n):
	(y, count, result) = (n, 0, list())
	for i in range(2, int(sqrt(n)) + 1):
		if y % i == 0:
			count += 1
			y = y // i
			result.append(i)
			if count >= 2:
				break
	print('YES' if count >= 2 and y not in result else 'NO')
	if count >= 2 and y not in result:
		print(*result + [y])
for _ in range(int(input())):
	primes(int(input()))


from math import sqrt, ceil

def primesfrom2to(n):
	sieve = [True] * (n // 2)
	for i in range(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 range(1, n // 2) if sieve[i]]
primedin105 = primesfrom2to(10 ** 5)

def primedec(n):
	ret = dict()
	if n == 1:
		return ret
	s = ceil(sqrt(n))
	for i in primedin105:
		if s < i:
			return {n: 1}
		if not n % i:
			d = primedec(n // i)
			ret = d
			try:
				ret[i] += 1
			except Exception:
				ret[i] = 1
			return ret

def solution(n):
	p = primedec(n)
	k = sorted(p.keys())
	a = k[0]
	if p[a] == 1:
		if len(k) == 1:
			print('NO')
			return
		b = k[1]
	elif p[a] == 2:
		if len(k) == 1:
			print('NO')
			return
		b = k[0] * k[1]
	else:
		b = k[0] ** 2
	c = n // (a * b)
	if c == 1 or c == a or c == b:
		print('NO')
		return
	print('YES')
	print(a, b, c)
t = int(input())
for i in range(t):
	solution(int(input()))


t = int(input())
for xyz in range(t):
	n = int(input())
	a = []
	fa = 1
	p = n
	i = 2
	while i * i <= p:
		if p % i == 0 and i not in a:
			a.append(i)
			p = p / i
			break
		i = i + 1
	while i * i <= p:
		if p % i == 0 and i not in a:
			a.append(i)
			p = p / i
			break
		i = i + 1
	l = len(a)
	if l == 0:
		print('NO')
	if l == 1:
		f = a[0]
		s = a[0] * a[0]
		t = n // (f * s)
		if f * s * t == n and f != s and (s != t) and (t != f) and (t > 1):
			print('YES')
			print(f, s, t)
		else:
			print('NO')
	if l == 2:
		f = min(a)
		c = a.copy()
		for i in c:
			if i == f:
				c.remove(i)
		s = min(c)
		t = n // (f * s)
		if f * s * t == n and f != s and (s != t) and (t != f) and (t > 1):
			print('YES')
			print(f, s, t)
		else:
			print('NO')
	if l >= 3:
		f = min(a)
		c = a.copy()
		for i in c:
			if i == f:
				c.remove(i)
		s = min(c)
		t = n // (f * s)
		print('YES')
		print(f, s, t)


import math

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

def prod(a):
	s = 1
	for i in range(len(a)):
		s = s * a[i]
	return s
t = int(input())
for i in range(t):
	n = int(input())
	b = primeFactors(n)
	c = list(set(b))
	if len(c) >= 3:
		print('YES')
		print(c[0], c[1], n // (c[0] * c[1]))
	elif len(c) == 2 and len(b) >= 4:
		print('YES')
		print(c[0], c[1], n // (c[0] * c[1]))
	elif len(c) == 1 and len(b) >= 6:
		print('YES')
		print(c[0], c[0] ** 2, n // c[0] ** 3)
	else:
		print('NO')


import math

def primeFactors(n):
	mm = n + 1
	d = dict()
	count = 0
	while n % 2 == 0:
		count += 1
		n = n // 2
	if count != 0:
		d[2] = count
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		icount = 0
		while n % i == 0:
			n = n // i
			icount += 1
		if icount != 0:
			d[i] = icount
	if n > 2:
		d[n] = 1
	n = mm - 1
	li = []
	for i in d:
		li.append(i)
	if len(d) >= 3:
		print('YES')
		num1 = li[0]
		num2 = li[1]
		num3 = n // num1
		num3 = num3 // num2
		print(num1, num2, num3)
	elif len(d) == 2:
		anss = 0
		for i in d:
			anss += d[i]
		if anss >= 4:
			print('YES')
			fi = li[0]
			se = li[1]
			print(fi, se, n // fi // se)
		else:
			print('NO')
	else:
		anss = 0
		for i in d:
			anss += d[i]
		if anss >= 6:
			print('YES')
			num1 = li[0]
			num2 = num1 ** 2
			num3 = num1 ** 3
			print(num1, num2, n // num1 // num2)
		else:
			print('NO')
t = int(input())
for i in range(0, t):
	n = int(input())
	primeFactors(n)


import sys
input = sys.stdin.readline

def factors(n):
	ret = set()
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ret.add(i)
			ret.add(n // i)
	return ret

def solve(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i != n // i:
			(a, b) = (i, n // i)
			(fa, fb) = (factors(a), factors(b))
			if len(fa) > 0:
				for fac in fa:
					if len(set([fac, a // fac, b])) == 3:
						return [fac, a // fac, b]
			if len(fb) > 0:
				for fac in fb:
					if len(set([fac, b // fac, a])) == 3:
						return [fac, b // fac, a]
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	ans = solve(n)
	if ans == 'NO':
		print('NO')
	else:
		print('YES')
		print(*sorted(ans))


import sys
import math
input = sys.stdin.readline

def primeFactors(n):
	while n % 2 == 0:
		n = n / 2
		return (2, n)
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n / i
			return (i, n)
	return (-1, -1)
t = int(input())
for _ in range(t):
	n = int(input())
	(a, n) = primeFactors(n)
	b = -1
	c = -1
	flag = 0
	if a == -1:
		print('NO')
	else:
		i = 2
		while i <= math.sqrt(n):
			if n % i == 0:
				if n // i >= 2:
					if i != a and (n // i != a and i != n // i):
						b = i
						c = n // i
						flag = 1
			i += 1
		if flag == 1:
			print('YES')
			print(a, int(b), int(c))
		else:
			print('NO')


from collections import defaultdict as dc
from heapq import *
import math
import bisect
from collections import deque as dq

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

def line():
	p = list(map(int, input().split()))
	return p

def check(n, d, x):
	if x < 0:
		return 0
	return n >= x + math.ceil(d / (x + 1))

def unique(a, b, c):
	p = set()
	p.add(a)
	p.add(b)
	p.add(c)
	if len(p) == 3:
		return 1
	return 0

def bs(a, n, z, val):
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if val % (a * z[mid]) == 0 and val // (a * z[mid]) != 1:
			if unique(a, z[mid], val // (a * z[mid])):
				return mid
		if val > a * z[mid]:
			l = mid + 1
		else:
			r = mid - 1
	if val % (a * z[mid]) == 0 and val // (a * z[mid]) != 1:
		if unique(a, z[mid], val // (a * z[mid])):
			return mid
	return -1
for _ in range(inp()):
	a = inp()
	z = []
	for i in range(2, int(pow(a, 0.5)) + 1):
		if a % i == 0:
			z.append(i)
			if i != a // i:
				z.append(a // i)
	z.sort()
	k = 0
	for i in range(len(z)):
		l = z[i]
		ans = bs(l, len(z), z, a)
		if ans != -1:
			print('YES')
			print(l, z[ans], a // (l * z[ans]))
			k = 1
			break
	if k == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ans = 'NO'
	p = q = 1
	for j in range(2, int(n ** (1 / 3)) + 2):
		if n % j == 0:
			p = j
			n = n // p
			ans = 'YES'
			break
	if ans == 'YES':
		ans = 'NO'
		for j in range(p + 1, int(n ** (1 / 2)) + 2):
			if n % j == 0:
				q = j
				n = n // q
				ans = 'YES'
				break
	if n <= q:
		ans = 'NO'
	print(ans)
	if ans == 'YES':
		print(p, q, n)


from sys import stdin

def f(n):
	res = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i not in res:
			n = n // i
			res.append(i)
			break
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i not in res:
			n = n // i
			res.append(i)
			break
	if len(res) < 2 or n in res or n == 1:
		return False
	else:
		return res + [n]
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	res = f(n)
	if res == False:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, res)))


import math

def solve(n):
	A = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			A.append(i)
			break
	if len(A) == 0:
		print('NO')
		return
	n = n // A[0]
	for i in range(A[0] + 1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			A.append(i)
			A.append(int(n / i))
			break
	if len(A) != 3:
		print('NO')
		return
	if A[0] < A[1] and A[1] < A[2]:
		print('YES')
		print(A[0], A[1], A[2])
	else:
		print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


for _ in range(int(input())):
	n = int(input())
	f = 0
	a = set()
	i = 2
	while i * i <= n:
		if n % i == 0:
			a.add(i)
			a.add(n // i)
		i += 1
	a = list(a)
	a.sort()
	l = len(a)
	for i in range(l):
		for j in range(i + 1, l):
			for k in range(j + 1, l):
				if a[i] * a[j] * a[k] == n:
					print('YES')
					print(a[i], a[j], a[k])
					f = 1
					break
			if f:
				break
		if f:
			break
	if not f:
		print('NO')


import math

def mul3(n):
	original_n = n
	divisors = set()
	divisor = 2
	sqrt_n = int(math.sqrt(n))
	while divisor <= sqrt_n and len(divisors) < 2:
		if n % divisor == 0:
			divisors.add(divisor)
			n //= divisor
		divisor += 1
	if len(divisors) < 2:
		return None
	list_divisors = list(divisors)
	multiplication = list_divisors[0] * list_divisors[1]
	third_number = original_n // multiplication
	if third_number in divisors:
		return None
	return divisors | set([third_number])
number_of_tests = int(input())
for _ in range(number_of_tests):
	n = int(input())
	result = mul3(n)
	if not result:
		print('NO')
		continue
	print('YES')
	print(' '.join(map(str, result)))


from sys import stdin, stdout
from math import sqrt
from collections import Counter
(primes, primes_list) = (set([2]), None)
composites = set()

def gen_primes(n):
	for i in range(3, n + 1, 2):
		if i not in composites:
			primes.add(i)
			for j in range(i * 2, n + 1, i):
				composites.add(j)

def get_fact(n):
	fact = []
	if n not in primes:
		for p in primes_list:
			if n % p == 0:
				c = 0
				while n % p == 0:
					n //= p
					c += 1
				fact.append((p, c))
				if n == 1:
					break
				elif len(fact) > 1:
					fact.append((n, 1))
					break
		else:
			fact.append((n, 1))
	return fact
t = int(stdin.readline().strip())
ns = [int(stdin.readline().strip()) for _ in range(t)]
gen_primes(int(sqrt(max(ns))) + 1)
primes_list = list(primes)
primes_list.sort()
for n in ns:
	fact = get_fact(n)
	div = []
	if len(fact) == 3 or (len(fact) == 2 and fact[0][1] + fact[1][1] - 2 > 1):
		(a, b) = (fact[0][0], fact[1][0])
		div = [a, b, n // a // b]
	elif len(fact) == 1 and fact[0][1] >= 6:
		a = fact[0][0]
		b = a * a
		div = [a, b, n // a // b]
	if div:
		stdout.write('YES\n{} {} {}\n'.format(*div))
	else:
		stdout.write('NO\n')


from math import floor, sqrt, ceil

def findPrimeFac(num):
	ans = []
	lim = ceil(sqrt(num))
	while num % 2 == 0:
		ans.append(2)
		num //= 2
	for p in range(3, lim, 2):
		while num % p == 0:
			ans.append(p)
			num //= p
	if num != 1:
		ans.append(num)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	primeFacs = findPrimeFac(n)
	freq = {}
	for p in primeFacs:
		if p not in freq:
			freq[p] = 0
		freq[p] += 1
	numDist = 0
	ans = []
	l = list(freq.keys())
	if len(l) >= 2:
		a = l[0]
		b = l[1]
		c = n // (a * b)
		if c != a and c != b and (c != 1):
			print('YES')
			assert n == a * b * c
			print(a, b, c)
		else:
			print('NO')
	elif len(l) == 0 or freq[l[0]] < 6:
		print('NO')
	else:
		print('YES')
		p = l[0]
		print(p, p * p, n // p ** 3)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
for _ in range(int(input())):
	n = int(input())
	s = ''
	f = x = y = 0
	for i in range(2, int(n ** (2 / 3)) + 1):
		if n % i == 0 and x == 0:
			s += str(i) + ' '
			x = i
			n //= i
		elif n % i == 0:
			s += str(i) + ' '
			y = i
			n //= i
			break
	if min([x, y, n]) < 2 or (x == y or y == n or x == n):
		print('NO')
	else:
		s += str(n) + ' '
		print('YES' + '\n' + s)


import math
for _ in range(int(input())):
	n = int(input())
	flag = 0
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		l = []
		if n % i == 0:
			l.append(i)
			a = n // i
			for j in range(2, math.ceil(math.sqrt(a)) + 1):
				if a % j == 0 and j != l[-1]:
					l.append(j)
					break
			if len(l) < 2:
				continue
			b = n // (l[0] * l[1])
			if b != l[0] and b != l[1] and (b != 1):
				l.append(b)
				print('YES')
				print(*l)
				flag = 1
				break
			else:
				continue
	if flag == 0:
		print('NO')


import math
for i in range(int(input())):
	q = int(input())
	k = []
	t = 0
	for i in range(2, int(math.sqrt(q)) + 1):
		if q % i == 0:
			q = q // i
			t = 1
			k.append(str(i))
			break
	if t == 1:
		for i in range(2, int(math.sqrt(q)) + 1):
			if q % i == 0 and str(i) not in k:
				q = q // i
				t = 2
				k.append(str(i))
				break
	else:
		print('NO')
	if t == 2 and str(q) not in k:
		k.append(str(q))
		print('YES')
		print(' '.join(k))
	elif t != 0:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = []
	if n % 2 == 0:
		l.append(2)
	for i in range(3, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	flag = 0
	for i in range(0, len(l)):
		for j in range(i + 1, len(l)):
			for k in range(j + 1, len(l)):
				if l[i] * l[j] * l[k] == n:
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 1:
		print('YES')
		print(l[i], l[j], l[k])
	else:
		print('NO')


from math import sqrt
t = int(input())
f = ''
for _ in range(t):
	n = int(input())
	m = n
	r = 0
	x = []
	for i in range(2, int(sqrt(n)) + 1):
		if i > m or r == 2:
			break
		elif m % i == 0:
			x.append(i)
			m = m // i
			r += 1
	if r == 2 and n // (x[0] * x[1]) > x[1]:
		f += 'YES\n'
		f += str(x[0]) + ' ' + str(x[1]) + ' ' + str(n // (x[0] * x[1])) + '\n'
	else:
		f += 'NO\n'
print(f)


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
import math
test = int_input()

def solve(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			tmp = n // i
			for j in range(i + 1, int(math.sqrt(tmp)) + 1):
				if tmp % j == 0 and (tmp // j != a and tmp // j != j):
					print('YES')
					print(a, j, tmp // j)
					return
	print('NO')
	return
for _ in range(test):
	n = int_input()
	solve(n)


from sys import stdin
inp = stdin.readline
t = int(inp())
for i in range(t):
	n = int(inp())
	a = b = 0
	for j in range(2, int(n ** 0.5) + 1):
		if n % j == 0:
			if a == 0:
				a = j
				n //= j
			elif b == 0:
				b = j
				n //= j
				break
	if a != 0 and b != 0 and (n != a) and (n != b):
		print('YES')
		print(a, b, n)
	else:
		print('NO')


d = dict()
import math

def primeFactors(n):
	c = 0
	while n % 2 == 0:
		c += 1
		n = n // 2
	if c != 0:
		d[2] = c
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		c = 0
		while n % i == 0:
			c += 1
			n = n // i
		if c != 0:
			d[i] = c
	if n > 2:
		if n in d:
			d[n] += 1
		else:
			d[n] = 1
I = input
for _ in range(int(I())):
	d.clear()
	n = int(I())
	primeFactors(n)
	k = list(d.keys())
	v = list(d.values())
	if len(set(d)) == 1:
		if v[0] >= 6:
			print('YES')
			a = k[0]
			b = k[0] ** 2
			c = k[0] ** (v[0] - 3)
			print(a, b, c)
		else:
			print('NO')
	elif len(set(d)) == 2:
		if sum(v) >= 4:
			print('YES')
			a = k[0]
			b = k[0] ** (v[0] - 1) * k[1] ** (v[1] - 1)
			c = k[1]
			print(a, b, c)
		else:
			print('NO')
	else:
		a = k[0] ** v[0]
		b = k[1] ** v[1]
		c = 1
		for i in range(2, len(k)):
			c *= k[i] ** v[i]
		print('YES')
		print(a, b, c)


def solve(n):
	l = []
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			d = n / i
			l.append(i)
			for j in range(i + 1, int(n ** (1 / 2)) + 1):
				if d % j == 0:
					d2 = d / j
					l.append(j)
					l.append(int(d2))
					break
			break
	if len(l) == 3 and l[0] != l[1] and (l[1] != l[2]) and (l[0] != l[2]):
		return [l, 'YES']
	return [l, 'NO']
for _ in range(int(input())):
	n = int(input())
	res = solve(n)
	if res[1] == 'YES':
		print(res[1])
		print(*res[0])
	else:
		print('NO')


from math import sqrt
test = int(input())
while test > 0:
	test -= 1
	n = int(input())
	first = []
	sz = 0
	for i in range(2, int(sqrt(n) + 1)):
		if n % i == 0:
			first.append(i)
			sz += 1
	found = False
	for i in range(sz):
		for j in range(i + 1, sz):
			if first[i] != first[j] and n % (first[i] * first[j]) == 0 and (n / (first[i] * first[j]) != first[i]) and (n / (first[i] * first[j]) != first[j]):
				print('YES')
				print(first[i], end=' ')
				print(first[j], end=' ')
				print(int(n / (first[i] * first[j])))
				found = True
				break
		if found:
			break
	if found == False:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = ip()
for _ in range(t):
	n = ip()
	ch = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ch.append(i)
			ch.append(n // i)
			break
	if len(ch) == 2:
		a = ch[0]
		b = ch[1]
		ch = []
		for i in range(2, int(a ** 0.5) + 1):
			if a % i == 0:
				if i != b and a // i != b and (i != a // i):
					ch.append(i)
					ch.append(a // i)
					break
		if len(ch) == 2:
			print('YES')
			print(b, ch[0], ch[1])
		else:
			ch = []
			for i in range(2, int(b ** 0.5) + 1):
				if b % i == 0:
					if i != a and b // i != a and (i != b // i):
						ch.append(i)
						ch.append(b // i)
						break
			if len(ch) == 2:
				print('YES')
				print(a, ch[0], ch[1])
			else:
				print('NO')
	else:
		print('NO')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def ok(n):
	pass

def fac(n):
	res = []
	for i in range(2, int(n ** 0.5 + 1)):
		if n % i:
			continue
		res.append(i)
		if i ** 2 != n:
			res.append(n // i)
	return sorted(res)
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	ans = 'YES'
	f = fac(n)
	if len(f) < 3:
		print('NO')
		continue
	m = len(f)
	for i in range(m):
		for j in range(i + 1, m):
			k = n // (f[i] * f[j])
			if k in f and k != f[i] and (k != f[j]):
				print('YES')
				print(f[i], f[j], k)
				break
		else:
			continue
		break
	else:
		print('NO')


t = int(input())
from math import *
import bisect
for i in range(t):
	n = int(input())
	x = set()
	for j in range(2, int(sqrt(n)) + 1):
		if n % j == 0:
			x.add(j)
		if n % (n // j) == 0:
			x.add(n // j)
	x = list(x)
	x.sort()
	flag = 0
	for j in range(len(x)):
		for k in range(j + 1, len(x)):
			y = n / (x[j] * x[k])
			if y in x and y != x[j] and (y != x[k]):
				flag = 1
				print('YES')
				print(x[j], x[k], int(y))
				break
		if flag == 1:
			break
	if flag == 0:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())

	def prime(n):
		primes = {2: 0}
		while n % 2 == 0:
			primes[2] += 1
			n = n // 2
		for i in range(3, int(math.sqrt(n) + 1), 2):
			while n % i == 0:
				if i in primes:
					primes[i] += 1
				else:
					primes[i] = 1
				n = n // i
		if n > 2:
			if n in primes:
				primes[n] += 1
			else:
				primes[n] = 1
		return primes

	def prod(l):
		p = 1
		for x in l:
			p *= x
		return p
	primes = prime(n)
	ar = []
	keys = sorted(primes.keys())
	for key in keys:
		ar.extend([key] * primes[key])
	if len(ar) < 3:
		print('NO')
	else:
		a = ar[0]
		i = 1
		b = ar[1]
		if ar[0] == ar[1]:
			b *= ar[2]
			i += 1
		c = prod(ar[i + 1:])
		if i == len(ar) - 1 or b == c or len(set([a, b, c])) < 3:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


for _ in range(int(input())):
	n = int(input())
	i = 2
	while i * i <= n:
		if n % i == 0:
			k = n // i
			j = i + 1
			fl = 0
			while j * j <= k:
				if k % j == 0 and j != k // j:
					print('YES')
					print(i, j, k // j)
					fl = 1
					break
				j += 1
			if fl:
				break
		i += 1
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ans = list()
	for i in range(2, int(n ** (2 / 3)) + 1):
		if len(ans) == 2:
			break
		if n % i == 0:
			ans.append(i)
			n //= i
	if len(ans) == 2 and ans[1] < n:
		print('YES')
		print(*ans, n)
	else:
		print('NO')


import math
T = int(input())
for _ in range(T):
	N = int(input())
	n = 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)
	a = L[0]
	b = 1
	c = 1
	ptr = 0
	for j in range(1, len(L)):
		b = b * L[j]
		if b != a:
			ptr = j + 1
			break
	for j in range(ptr, len(L)):
		c = c * L[j]
	if a == b or b == c or a == c or (a * b * c != N) or (a < 2) or (b < 2) or (c < 2):
		print('NO')
	else:
		print('YES')
		print(a, b, c)


import math
t = int(input())
while t > 0:
	n = int(input())
	d = set()
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and (not i in d):
			d.add(i)
			n /= i
			break
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0 and (not i in d):
			d.add(i)
			n /= i
			break
	if n == 1 or len(d) < 2 or n in d:
		print('NO')
	else:
		d.add(int(n))
		print('YES')
		print('{} {} {}'.format(*list(d)))
	t = t - 1


num = int(input())
mas = [None] * num
for i in range(num):
	mas[i] = int(input())
for i in range(num):
	n = mas[i]
	n0 = n
	i = 2
	delit = []
	while i * i <= n0:
		while n % i == 0:
			delit.append(i)
			n //= i
		i += 1
	if n != 1:
		delit.append(n)
	if len(set(delit)) == 1 and len(delit) > 5:
		print('YES')
		print(delit[0], delit[0] * delit[0], n0 // delit[0] ** 3)
	elif len(set(delit)) == 2 and len(delit) > 3 or len(set(delit)) > 2:
		print('YES')
		a = delit[0]
		b = delit[-1]
		print(a, b, n0 // (a * b))
	else:
		print('NO')


tests = int(input())
for t in range(tests):
	n = int(input())
	initN = n
	i = 2
	(a, b) = (0, 0)
	while True:
		if i ** 2 > initN:
			print('NO')
			break
		if n % i == 0:
			n = n / i
			if a == 0:
				a = i
			elif b == 0:
				b = i
		if a > 0 and b > 0 and (n > 1) and (a != b) and (b != n) and (a != n):
			print('YES')
			print(str(a) + ' ' + str(b) + ' ' + str(int(n)))
			break
		i += 1


t = int(input())
while t:
	l = set()
	tr = 0
	n = int(input())
	ce = n
	if n >= 12:
		i = 2
		while n > 0 and tr < 3:
			if tr < 2 and i * i > ce:
				break
			if tr == 2:
				l.add(int(n))
				tr = tr + 1
				break
			elif n % i == 0:
				l.add(i)
				tr = tr + 1
				n = n / i
			elif tr == 2:
				l.add(int(n))
				tr = tr + 1
				break
			i = i + 1
	if tr == 3 and len(l) == 3:
		print('YES')
		l = list(l)
		l.sort()
		for i in range(3):
			print(l[i], end=' ')
		print()
	else:
		print('NO')
	t = t - 1


from sys import stdin, stdout
import sys
INF = 1000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
import math
for _ in range(int(stdin.readline())):
	n = get_int()
	(a, b, c) = (0, 0, 0)
	f = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			n = n // i
			for j in range(i + 1, int(math.sqrt(n)) + 1):
				if n % j == 0:
					b = j
					n = n // j
					f = 1
					break
			if f == 1:
				break
	if f == 1 and n not in [a, b]:
		print('YES')
		print(a, b, n)
		continue
	print('NO')


import math

def printDivisors(n):
	list = []
	a = []
	x = n
	for i in range(2, int(math.sqrt(n) + 1)):
		if x % i == 0:
			a.append(i)
			x /= i
		if len(a) == 2:
			p = 1
			if x == a[0] or x == a[1]:
				print('NO')
				return
			print('YES')
			print(a[0], end=' ')
			print(a[1], end=' ')
			print(int(x))
			return
	print('NO')
t = int(input())
for i in range(t):
	a = int(input())
	printDivisors(a)


def factors(x):
	result = []
	i = 1
	while i * i <= x:
		if x % i == 0:
			result.append(i)
			if x // i != i:
				result.append(x // i)
		i += 1
	return result
for _ in range(int(input())):
	n = int(input())
	lst = sorted(factors(n))
	a = lst[1]
	x = n // a
	lst2 = sorted(factors(x))
	if len(lst2) <= 2:
		b = -1
	elif lst2[1] != a:
		b = lst2[1]
	elif lst2[1] == a and len(lst2) > 2:
		b = lst2[2]
	yo = a * b
	res = n // yo
	if res != a and res != b and (res != 1) and (b > 1):
		print('YES')
		print(a, b, res)
	else:
		print('NO')


import sys
from collections import defaultdict
import math
dic = defaultdict(int)
t = int(sys.stdin.readline())
for _ in range(t):
	dic = defaultdict(int)
	m = int(sys.stdin.readline())
	d = m
	l = []
	while m % 2 == 0:
		m = m // 2
		dic[2] += 1
	for i in range(3, int(math.sqrt(d)) + 1, 2):
		while m % i == 0:
			dic[i] += 1
			m = m // i
	if m > 2:
		dic[m] += 1
	if len(dic) >= 3:
		print('YES')
		l = []
		for i in dic:
			l.append(i)
			if len(l) == 2:
				break
		l.append(d // (l[0] * l[1]))
		print(*l)
	elif len(dic) == 2:
		a = []
		for i in dic:
			a.append(i)
		z = True
		if dic[a[0]] > 2 and z:
			l = [a[0], a[0] ** (dic[a[0]] - 1)]
			l.append(d // (l[0] * l[1]))
			print('YES')
			print(*l)
			z = False
		elif dic[a[1]] > 2 and z:
			l = [a[1], a[1] ** (dic[a[1]] - 1)]
			l.append(d // (l[0] * l[1]))
			print('YES')
			print(*l)
			z = False
		elif dic[a[1]] == dic[a[0]] == 2 and z:
			l = [a[0], a[1], a[0] * a[1]]
			print('YES')
			print(*l)
			z = False
		else:
			print('NO')
	elif len(dic) == 1:
		for i in dic:
			if dic[i] > 5:
				print('YES')
				l = [i, i ** 2, d // i ** 3]
				print(*l)
			else:
				print('NO')
	else:
		print('NO')


import math

def factors(n):
	l = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			l.append(i)
			l.append(n // i)
	return l
for _ in range(int(input())):
	n = int(input())
	l = factors(n)
	nn = len(l)
	flag = 0
	for i in range(nn):
		for j in range(nn):
			for k in range(nn):
				if l[i] * l[j] * l[k] == n:
					if not (i == j or j == k or k == i):
						print('YES')
						print(l[i], l[j], l[k])
						flag = 1
						break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 0:
		print('NO')


import math
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	divisors = Counter()
	for p in range(2, int(math.sqrt(n)) + 1):
		while n % p == 0:
			divisors[p] += 1
			n //= p
	if n > 1:
		divisors[n] += 1
	ans = [1, 1, 1, 1]
	i = 1
	for (k, v) in divisors.items():
		for j in range(v):
			ans[i] *= k
			if all((ans[i] != ans[j] for j in range(i))) and i < 3:
				i += 1
	if len(set(ans)) == 4:
		print('YES')
		print(*ans[1:])
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	facs = []
	i = 2
	x = n
	while i <= int(math.sqrt(x)) and len(facs) < 2:
		if n % i == 0:
			facs.append(i)
			n = n // i
		i += 1
	if n not in facs and n > 1:
		facs.append(n)
	if len(facs) == 3:
		print('YES')
		print(*facs)
	else:
		print('NO')


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
m = int(input())
for i in range(m):
	n = int(input())
	if len(prime_factors(n)) < 3:
		print('NO')
	else:
		a = prime_factors(n)[0]
		if prime_factors(n)[0] == prime_factors(n)[1]:
			b = prime_factors(n)[1] * prime_factors(n)[2]
			if len(prime_factors(n)) == 3:
				print('NO')
			else:
				c = 1
				for el in prime_factors(n)[3:]:
					c *= el
				if a != b != c and a != c:
					print('YES')
					print(a, b, c)
				else:
					print('NO')
		else:
			b = prime_factors(n)[1]
			c = 1
			for el in prime_factors(n)[2:]:
				c *= el
			if a != b != c and a != c:
				print('YES')
				print(a, b, c)
			else:
				print('NO')


for _ in range(int(input())):
	n = int(input())
	t = pow(n, 0.5) + 3
	l = []
	co = 0
	i = 2
	while i < t:
		if n % i == 0:
			n = n // i
			l.append(i)
		else:
			i += 1
	if n != 1:
		l.append(n)
	flag = 'YES'
	t = len(l)
	if t >= 3:
		a = l[-1]
		l.pop(-1)
		b = l[-1]
		l.pop(-1)
		if a == b:
			b = b * l[-1]
			l.pop(-1)
		c = 1
		for i in l:
			c = c * i
	if t >= 3:
		if c > 1 and a > 1 and (b > 1) and (b != c) and (a != b) and (a != c):
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		print('NO')


import math

class Read:

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def main():
	n = Read.int()
	status = False
	for a in range(2, int(math.sqrt(n) + 1)):
		if n % a == 0:
			k = n / a
			for b in range(a + 1, int(math.sqrt(k) + 1)):
				if k % b == 0:
					c = int(k / b)
					if b != c and c > 2:
						print('YES')
						print('{} {} {}'.format(a, b, c))
						status = True
						break
		if status:
			break
	if status == False:
		print('NO')
query_count = Read.int()
while query_count:
	query_count -= 1
	main()


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	sol = {}
	j = 2
	sqroot = {}
	sqroot[n] = int(sqrt(n))
	while j <= sqroot[n]:
		if len(sol) == 2:
			break
		if n % j == 0:
			sol[j] = 1
			n = n // j
			sqroot[n] = int(sqrt(n))
		j += 1
	if len(sol) == 2 and n not in sol:
		print('YES')
		for j in sol:
			print(j, end=' ')
		print(n)
	else:
		print('NO')


from collections import defaultdict
import math

def prime(n):
	ans = []
	al = defaultdict(int)
	while n % 2 == 0:
		al[2] = al[2] + 1
		ans.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			al[i] += 1
			ans.append(i)
			n = n // i
	if n > 2:
		al[n] = 1
		ans.append(n)
	ans = list(set(ans))
	return (ans, al)
t = int(input())
for i in range(t):
	n = int(input())
	(ans, al) = prime(n)
	if len(ans) >= 3:
		print('YES')
		a = ans[0] ** al[ans[0]]
		b = ans[1] ** al[ans[1]]
		c = n // (a * b)
		print(a, b, c)
	elif len(ans) == 2:
		if al[ans[0]] + al[ans[1]] >= 4:
			a = ans[0]
			b = ans[1]
			c = n // (a * b)
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	elif al[ans[0]] > 5:
		print('YES')
		a = ans[0] * ans[0]
		b = ans[0]
		c = n // (a * b)
		print(a, b, c)
	else:
		print('NO')


import math
m = 1000000007

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans % m * (i % m) % m
	return ans

def power_2(n):
	ans = 1
	for i in range(n):
		ans = ans % m * 2 % m
	return ans
for z in range(int(input())):
	n = int(input())
	fin = int(math.ceil(n ** (1 / 3)))
	(cnt, i) = (0, 2)
	while i <= fin:
		if n % i == 0:
			cnt += 1
			n = int(n / i)
			break
		i += 1
	fin = int(math.ceil(n ** (1 / 2)))
	j = i + 1
	while j <= fin:
		if n % j == 0 and j != int(n / j) and (int(n / j) != i):
			cnt += 1
			break
		j += 1
	if cnt == 2:
		print('YES')
		print(i, j, int(n / j))
	else:
		print('NO')


import math
a = int(input())
for x in range(a):
	a = int(input())
	prime = 2
	count = list()
	while prime <= math.ceil(math.sqrt(a)):
		if a % prime == 0:
			a /= prime
			count.append(prime)
			if len(count) == 2:
				if not a in count:
					print('YES')
					print(count[0], count[1], int(a))
					break
		prime += 1
	else:
		print('NO')


from functools import reduce
import io
import os
import sys
from atexit import register
import random
import math
import itertools
DEBUG = False
STRESSTEST = False
if not DEBUG:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
sys.stdout = io.BytesIO()
register(lambda : os.write(1, sys.stdout.getvalue()))
tokens = []
tokens_next = 0

def nextStr():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	if type(tokens[tokens_next - 1]) == str:
		return tokens[tokens_next - 1]
	return tokens[tokens_next - 1].decode()

def nextInt():
	return int(nextStr())

def nextIntArr(n):
	return [nextInt() for i in range(n)]

def print(*argv, end='\n'):
	for arg in argv:
		sys.stdout.write((str(arg) + ' ').encode())
	sys.stdout.write(end.encode())

def genTestCase():
	return random.randint(1, 100)

def bruteforce(n):
	for c in itertools.combinations(range(2, n), 3):
		if reduce(lambda x, y: x * y, c) == n:
			return list(c)
	return None

def check(mySoln, bruteforceSoln):
	if bruteforceSoln is None or mySoln == None:
		return mySoln == bruteforceSoln
	n = reduce(lambda x, y: x * y, bruteforceSoln)
	return mySoln[0] * mySoln[1] * mySoln[2] == n and len(set(mySoln)) == 3

def doStressTest():
	while True:
		curTest = genTestCase()
		mySoln = solve(curTest)
		bruteforceSoln = bruteforce(curTest)
		if not check(mySoln, bruteforceSoln):
			print('### Found case ###')
			print(curTest)
			print(f'{mySoln} should have been: {bruteforceSoln}')
			return

def genPrimes(limit):
	limit = int(limit)
	isPrime = [0, 0] + [1] * (limit + 10)
	for i in range(len(isPrime)):
		if isPrime[i]:
			yield i
			for j in range(i * i, len(isPrime), i):
				isPrime[j] = 0
primes = [i for i in genPrimes(10 ** 5)]

def factorize(n):
	res = []
	ps = iter(primes)
	while n > 1:
		p = next(ps, -1)
		if p == -1:
			res.append(n)
			break
		while n % p == 0:
			n = n // p
			res.append(p)
	return res

def solve(n):
	factors = factorize(n)
	if len(factors) > 2:
		p1 = factors[0]
		p2 = next((i for i in factors if i != p1), -1)
		if p2 == -1:
			p2 = factors[1] * factors[2]
		res = [p1, p2, n // p1 // p2]
		if reduce(lambda x, y: x * y, res) == n and len(set(res)) == 3 and (1 not in res):
			return res
	return None
if not DEBUG and STRESSTEST:
	raise Exception('Wrong flags!')
if STRESSTEST:
	doStressTest()
else:
	t = nextInt()
	for _ in range(t):
		n = nextInt()
		res = solve(n)
		if res is None:
			print('NO')
		else:
			print('YES')
			print(' '.join(map(str, res)))
sys.stdout.flush()


I = input
for _ in [0] * int(I()):
	temp = int(I())
	ans = []
	for i in range(2, temp, 1):
		if temp % i == 0:
			ans.append(i)
			break
		elif i * i > temp:
			break
	if len(ans) == 0 or ans[0] * ans[0] >= temp:
		print('NO')
		continue
	temp //= ans[0]
	for i in range(ans[0], int(temp), 1):
		if int(temp) % i == 0 and i != ans[0]:
			ans.append(i)
			temp //= i
			break
		elif i * i > temp:
			break
	if len(ans) == 1:
		print('NO')
		continue
	if int(temp) != ans[0] and int(temp) != ans[1]:
		ans.append(int(temp))
		print('YES')
		for i in ans:
			print(i, end=' ')
		print('')
	else:
		print('NO')


from math import sqrt

def solve(R: list):
	n = int(input())
	m = n
	for i in range(2, int(sqrt(m))):
		if i >= n:
			return
		if n % i == 0:
			R.append(i)
			n //= i
		if len(R) == 2:
			break
	if len(R) == 2:
		if n > R[-1]:
			R.append(n)
t = int(input())
for cnt in range(t):
	R = []
	solve(R)
	if len(R) == 3:
		print('YES')
		print(' '.join(map(str, R)))
	else:
		print('NO')


import math

def p(n):
	l = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				if i != 1:
					l.append(i)
			else:
				if i != 1:
					l.append(i)
				if n // i != 1:
					l.append(n // i)
		i = i + 1
	return l
for _ in range(int(input())):
	n = int(input())
	a = p(n)
	a.sort()
	z = -1
	d = {}
	d[a[0]] = 1
	l = []
	c = 0
	for i in range(1, len(a)):
		for j in range(i + 1, len(a)):
			if n % (a[i] * a[j]) == 0:
				if n // (a[i] * a[j]) in d and (a[i] >= 2 and a[j] >= 2 and (n // (a[i] * a[j]) >= 2)):
					print('YES')
					z = 0
					l.append(a[i])
					l.append(a[j])
					l.append(n // (a[i] * a[j]))
					l.sort()
					print(*l)
			if z == 0:
				c = 1
				break
		if c == 1:
			break
		d[a[i]] = 1
	if z == -1:
		print('NO')


import math

def run():
	num = int(input())
	if num < 24:
		print('NO')
		return
	else:
		used = set()
		i = 2
		while i * i <= num:
			if num % i == 0 and i not in used:
				used.add(i)
				num //= i
				break
			i += 1
		while i * i <= num:
			if num % i == 0 and i not in used:
				used.add(i)
				num //= i
				break
			i += 1
		if len(used) < 2 or num in used or num == 1:
			print('NO')
		else:
			print('YES')
			print(used.pop(), used.pop(), num)
n = int(input())
for i in range(n):
	run()


import sys
import math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	n = inp()
	i = 2
	check = False
	while i * i <= n:
		if n % i == 0:
			check = True
			nn = n // i
			j = i + 1
			check2 = False
			while j * j <= nn:
				if nn % j == 0:
					c = nn // j
					if c != j:
						if c != i:
							print('YES')
							print(str(i) + ' ' + str(j) + ' ' + str(c))
							check2 = True
							break
				j = j + 1
			if check2 == False:
				check = False
			break
		i = i + 1
	if check == False:
		print('NO')


def main():
	T = int(input())
	for t in range(T):
		m = int(input())
		n = m
		dic = {}
		i = 2
		while i * i <= n:
			while n % i == 0:
				dic[i] = dic.get(i, 0) + 1
				n //= i
			i += 1
		if m % n == 0 and n != 1:
			dic[n] = dic.get(n, 0) + 1
		keys = list(dic.keys())
		if len(dic) == 0:
			print('NO')
		elif len(dic) == 1:
			x = keys[0]
			y = dic[x]
			if y < 6:
				print('NO')
			else:
				print('YES')
				print(str(x) + ' ' + str(x ** 2) + ' ' + str(x ** (y - 3)))
		elif len(dic) == 2:
			(x1, x2) = (keys[0], keys[1])
			(y1, y2) = (dic[x1], dic[x2])
			if y1 + y2 <= 3:
				print('NO')
			else:
				print('YES')
				print(str(x1) + ' ' + str(x2) + ' ' + str(x1 ** (y1 - 1) * x2 ** (y2 - 1)))
		else:
			(x1, x2) = (keys[0], keys[1])
			(y1, y2) = (dic[x1], dic[x2])
			print('YES')
			print(str(x1 ** y1) + ' ' + str(x2 ** y2) + ' ' + str(m // x1 ** y1 // x2 ** y2))
main()


import math

def prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(input())
for i in range(t):
	n = int(input())
	if prime(n):
		print('NO')
	else:
		flag = 0
		ans = []
		for i in range(2, int(math.sqrt(n)) + 1):
			if flag == 1:
				break
			if n % i == 0:
				if prime(i) == False:
					a = n / i
					for j in range(2, int(math.sqrt(i)) + 1):
						if i % j == 0 and a != j and (a != i // j) and (j != i // j):
							b = j
							c = i // j
							flag = 1
							break
					break
				elif prime(n // i) == False:
					x = n // i
					a = i
					for j in range(2, int(math.sqrt(x)) + 1):
						if x % j == 0 and a != j and (a != x // j) and (j != x // j):
							b = j
							c = x // j
							flag = 1
							break
					break
				else:
					flag = 0
		if flag == 0:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import sys
from math import sqrt
input = sys.stdin.readline
f = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	a = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			a = i
			break
	b = 0
	if a:
		for i in range(a + 1, int(sqrt(n // a)) + 1):
			if n // a % i == 0:
				b = i
				break
	c = 0
	if b and n % (a * b) == 0:
		c = n // (a * b)
	if c and c != 1 and (c != a) and (c != b):
		print('YES\n', a, b, c)
	else:
		print('NO')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

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 ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	d = divs(n, 2)
	f = 1
	if len(d):
		x = d[0]
		for y in divs(n // x, 2):
			z = n // (x * y)
			if x != y != z != x and z != 1:
				print('YES')
				print(x, y, z)
				f = 0
				break
	if f:
		print('NO')


def prime_divisors(n):
	res = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			if len(res) > 0 and res[-1][0] == d:
				res[-1][1] = res[-1][1] + 1
			else:
				res.append([d, 1])
			n = n // d
		else:
			d = d + 1
	if n > 1:
		if len(res) > 0 and res[-1][0] == n:
			res[-1][1] = res[-1][1] + 1
		else:
			res.append([n, 1])
	return res
t = int(input())
for i in range(t):
	a = int(input())
	pds = prime_divisors(a)
	first_divisor = pds[0][0]
	if len(pds) >= 3:
		second_divisor = pds[1][0]
		ans = [first_divisor, second_divisor, a // (first_divisor * second_divisor)]
		print('YES')
		print(*ans)
	elif len(pds) == 1:
		if pds[0][1] <= 5:
			print('NO')
		else:
			print('YES')
			print(first_divisor, first_divisor * first_divisor, a // (first_divisor * first_divisor * first_divisor))
	elif pds[0][1] + pds[1][1] >= 4:
		second_divisor = pds[1][0]
		print('YES')
		print(first_divisor, second_divisor, a // (first_divisor * second_divisor))
	else:
		print('NO')


for _ in [0] * int(input()):
	n = int(input())
	a = ['YES']
	i = j = 2
	while j < 4 and i * i < n:
		if n % i < 1:
			a += (i,)
			n //= i
			j += 1
		i += 1
	print(*(a + [n], ['NO'])[j < 4])


t = int(input())
for qwe in range(t):
	n1 = int(input())
	flag = False
	for i1 in range(2, int(n1 ** 0.5) + 1):
		if n1 % i1 == 0:
			a = i1
			n2 = n1 // i1
			for i2 in range(2, int(n2 ** 0.5) + 1):
				if n2 % i2 == 0 and i2 != a:
					b = i2
					c = n2 // i2
					if c != a and c != b:
						flag = True
				if flag:
					break
		if flag:
			break
	if flag:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math as m

def divisor(n):
	arr = []
	for i in range(2, int(m.sqrt(n)) + 1):
		if n % i == 0:
			arr.append(i)
	return arr
t = int(input())
for _ in range(t):
	n = int(input())
	temp = divisor(n)
	if temp == []:
		print('NO')
	else:
		a = temp[0]
		n = n // temp[0]
		temp = divisor(n)
		boo = True
		for i in temp:
			if i != a and n % i == 0 and (n // i != a) and (n // i != i) and (n // i != 1):
				print('YES')
				print(a, i, n // i)
				boo = False
				break
		if boo:
			print('NO')


from math import sqrt

def primeFactors(n):
	arr = []
	while n % 2 == 0:
		arr.append(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			arr.append(i)
			n = n // i
	if n > 2:
		arr.append(n)
	return arr

def solve(a, n, res):
	for i in res:
		b = n // i
		if a != b:
			return (a, b)
	return False
for t in range(int(input())):
	n = int(input())
	res = primeFactors(n)
	if len(res) <= 2:
		print('NO')
		continue
	resset = list(set(res))
	ans = []
	if len(resset) >= 2:
		ans.append(resset[0])
		ans.append(resset[1])
		ans.append(n // (ans[-1] * ans[-2]))
		ans = set(ans)
	else:
		ans.append(resset[0])
		ans.append(resset[0] ** 2)
		ans.append(n // (ans[-1] * ans[-2]))
		ans = set(ans)
	ans = list(ans)
	if len(ans) == 3 and min(ans) >= 2:
		print('YES')
		for i in ans:
			print(i, end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = b = c = 1
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a = i
			n //= i
			break
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if i != a:
				b = i
				n //= i
				break
	if n != 1 and n != a and (n != b):
		c = n
	if a == 1 or b == 1 or c == 1:
		print('NO')
	else:
		print('YES')
		print(a, b, c, sep=' ')


t = int(input())
from math import sqrt
for i in range(t):
	number = int(input())
	l = []
	for i in range(2, int(sqrt(number)) + 1):
		if number % i == 0:
			for j in range(2, int(sqrt(number // i)) + 1):
				if number // i % j == 0 and j != i and (number // i // j not in [i, j]):
					l.append(i)
					l.append(j)
					l.append(number // i // j)
					break
	if len(l) % 3 == 0 and len(l) != 0:
		print('YES')
		print(*l[0:3])
	else:
		print('NO')


def productOfThreeNumbers(n, answer=(1,)):
	lengthOfAnswer = len(answer)
	if lengthOfAnswer == 3:
		if n > answer[-1]:
			return f'YES\n{answer[1]} {answer[2]} {int(n)}'
		return 'NO'
	for i in range(answer[-1] + 1, int(n ** (1 / (4 - lengthOfAnswer))) + 1):
		if not n % i:
			return productOfThreeNumbers(n / i, answer + (i,))
	return 'NO'
nTestCases = int(input())
testCases = [int(input()) for x in range(nTestCases)]
[print(productOfThreeNumbers(testCase)) for testCase in testCases]


def Sieve(n):
	ret = []
	divlis = [-1] * (n + 1)
	flag = [True] * (n + 1)
	flag[0] = False
	flag[1] = False
	ind = 2
	while ind <= n:
		if flag[ind]:
			ret.append(ind)
			ind2 = ind ** 2
			while ind2 <= n:
				flag[ind2] = False
				divlis[ind2] = ind
				ind2 += ind
		ind += 1
	return (ret, divlis)
t = int(input())
(ret, divs) = Sieve(10 ** 6)
for loop in range(t):
	n = int(input())
	ans = []
	now = 1
	flag = False
	for i in ret:
		while n % i == 0:
			n //= i
			now *= i
			if now > 1 and now not in ans:
				ans.append(now)
				now = 1
				if len(ans) == 2:
					if n not in ans and n > 1:
						ans.append(n)
						print('YES')
						print(' '.join(map(str, ans)))
						flag = True
						break
					else:
						print('NO')
						flag = True
						break
			if flag:
				break
		if flag:
			break
	if not flag:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = b = c = -1
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a = i
			n //= i
			break
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and i != a:
			b = i
			n //= i
			break
	if b != -1 and n != a and (n != b):
		c = n
	if c == -1:
		print('NO')
	else:
		print('YES')
		print('{} {} {}'.format(a, b, c))


import sys
import math
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin, stdout
from collections import defaultdict, deque
from math import log2, ceil, floor
inp = lambda : int(input())
sip = lambda : input()
mulip = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
slst = lambda : list(sip())
arr2d = lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x % 2 != 0, l)))
evens = lambda l: len(list(filter(lambda x: x % 2 == 0, l)))
mod = pow(10, 9) + 7
Judge = 0
if Judge:
	sys.stdin = open('input.in', 'r')
for _ in range(inp()):
	n = inp()
	x = n
	d = {}
	i = 2
	while i * i <= x:
		cnt = 0
		while n % i == 0 and n != 0:
			n = n // i
			cnt += 1
			d[i] = cnt
		i += 1
	if n > 2:
		d[n] = 1
	if len(d) == 0:
		print('NO')
	elif len(d) == 1:
		l = list(d.keys())
		if d[l[0]] >= 6:
			print('YES')
			print(l[0], pow(l[0], 2), pow(l[0], d[l[0]] - 3))
		else:
			print('NO')
	elif len(d) == 2:
		l = list(d.keys())
		if d[l[0]] + d[l[1]] >= 4:
			print('YES')
			print(l[0], l[1], x // (l[0] * l[1]))
		else:
			print('NO')
	else:
		l = list(d.keys())
		print('YES')
		print(pow(l[0], d[l[0]]), pow(l[1], d[l[1]]), end=' ')
		ans = 1
		for i in range(2, len(l)):
			ans *= pow(l[i], d[l[i]])
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	i = 2
	while len(arr) < 2 and i * i <= n:
		if n % i == 0:
			arr.append(i)
			n = n // i
		i += 1
	if n not in arr and len(arr) == 2:
		print('YES')
		print(*arr, end=' ')
		print(n)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	s = []
	try:
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				g = n // i
				a = i + 0
				break
		for i in range(a + 1, int(math.sqrt(g)) + 1):
			if g % i == 0:
				b = i
				break
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				s.append(i)
	except:
		print('NO')
		continue
	if len(s) >= 3:
		print('YES')
		print(a, b, n // (a * b))
	else:
		print('NO')


import sys
queries = int(sys.stdin.readline())

def numberToFactors(number, fromTop=False):
	factor1 = number
	factor2 = 2
	if fromTop:
		while factor2 <= factor1 ** 0.5:
			factor2 += 1
		while factor2 > 2:
			if factor1 % factor2 == 0:
				if factor1 // factor2 != factor2:
					return [factor1 // factor2, factor2]
			factor2 -= 1
	else:
		factor2 = 2
		while factor2 <= factor1 ** 0.5:
			if factor1 % factor2 == 0:
				if factor1 // factor2 != factor2:
					return [factor1 // factor2, factor2]
			factor2 += 1
	return [factor1]
for query in range(queries):
	number = int(sys.stdin.readline())
	factors = numberToFactors(number)
	if len(factors) == 2:
		factorsLeft = numberToFactors(factors[0], True)
		factorsRight = numberToFactors(factors[1], True)
		next = True
		if len(factorsLeft) == 2:
			if factorsLeft[0] != factors[1] and factorsLeft[1] != factors[1]:
				del factors[0]
				factors = factorsLeft + factors
				next = False
		if len(factorsRight) == 2 and next:
			if factorsRight[0] != factors[0] and factorsRight[1] != factors[0]:
				del factors[1]
				factors = factors + factorsRight
	if len(factors) == 3:
		print('YES')
		print(' '.join(map(str, factors)))
	else:
		print('NO')


q = int(input())

def div_by_primes(n):
	p = []
	s = []
	for d in range(2, int(n ** (1 / 2)) + 1):
		if n % d == 0:
			p.append(d)
			s.append(0)
			while n % d == 0:
				s[-1] += 1
				n //= d
	if n > 1:
		p.append(n)
		s.append(1)
	return (p, s)

def s_mult(s, p):
	ans = 1
	for i in range(len(s)):
		ans *= p[i] ** s[i]
	return ans
for _ in range(q):
	n = int(input())
	(p, s) = div_by_primes(n)
	if len(p) == 1:
		if s[0] < 6:
			print('NO')
		else:
			print('YES\n', p[0], p[0] ** 2, p[0] ** (s[0] - 3))
	elif len(p) == 2:
		if s[0] + s[1] < 4:
			print('NO')
		elif s[0] == 1:
			print('YES\n', p[0], p[1], p[1] ** (s[1] - 1))
		elif s[1] == 1:
			print('YES\n', p[0], p[1], p[0] ** (s[0] - 1))
		else:
			print('YES\n', p[0], p[1], p[0] ** (s[0] - 1) * p[1] ** (s[1] - 1))
	else:
		print('YES\n', p[0] ** s[0], p[1] ** s[1], s_mult(s[2:], p[2:]))


import math

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

def ans(a):
	count = 0
	f = 0
	l = []
	s = ''
	d = int(math.sqrt(a))
	for i in range(2, d + 1, 1):
		if a % i == 0:
			l.append(i)
			count += 1
			a = a // i
		if count == 2 and l[0] != a and (l[1] != a):
			l.append(a)
			f = 1
			break
	if f:
		print('YES')
		for i in l:
			print(i, end=' ')
		print()
	else:
		print('NO')
t = int(input())
while t > 0:
	a = int(input())
	if wa(a) == True:
		print('NO')
	elif a % 10 == 0:
		x = a // 10
		y = 2
		z = 5
		if x * z * y == a and x != y and (x != z) and (z != y) and (x > 1) and (y > 1) and (z > 1):
			print('YES')
			if z > x:
				print(y, x, z)
			else:
				print(y, z, x)
		else:
			print('NO')
	else:
		ans(a)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	k1 = int(pow(n, 0.333))
	k2 = k1 ** 2
	a = 0
	b = 0
	s = n
	for j in range(2, k1 + 1):
		if n % j == 0:
			a = j
			n = n // j
			break
	if a == 0:
		print('NO')
		continue
	else:
		k = int(pow(n, 0.5))
		for j in range(a + 1, k + 1):
			if n % j == 0:
				b = j
				n = n // j
				break
	if b == 0:
		print('NO')
		continue
	else:
		c = s // (a * b)
		if c == 1 or c == a or c == b:
			print('NO')
		else:
			print('YES')
			print(a, end=' ')
			print(b, end=' ')
			print(c)


import math
b = int(input())
t = []
for j in range(b):
	t.append(int(input()))
for a in t:
	c = 3
	i = 2
	s = ''
	while a > 1 and a // i >= 1 and (i <= math.pow(a, 1 / c)):
		if a % i == 0:
			a = a // i
			s = s + i.__str__() + ' '
			c = c - 1
			if s.split(' ').__len__() > 2 and a // (i + 1) > 0:
				s = s + a.__str__() + ' '
				a = 0
			elif s.split(' ').__len__() > 2:
				a = 0
		i = i + 1
	if s.split(' ').__len__() > 3:
		print('YES \n', s, sep='')
	else:
		print('NO')


def Fenjie(n):
	k = {}
	if n == 1:
		return {}
	a = 2
	while n >= 2:
		b = n % a
		if a * a > n:
			if n in k:
				k[n] += 1
			else:
				k[n] = 1
			break
		if b == 0:
			if a in k:
				k[a] += 1
			else:
				k[a] = 1
			n = n // a
		else:
			a += 1
	return k
n = int(input())
for _ in range(n):
	m = int(input())
	k = Fenjie(m)
	s = 0
	le = len(k)
	l = [i for i in k]
	if le >= 3:
		print('YES')
		flag = 0
		print(l[0], l[1], m // l[0] // l[1])
	elif le == 2:
		if k[l[0]] + k[l[1]] >= 4:
			print('YES')
			print(l[0], l[1], m // l[0] // l[1])
		else:
			print('NO')
	elif k[l[0]] >= 6:
		print('YES')
		print(l[0], l[0] * l[0], m // l[0] // l[0] // l[0])
	else:
		print('NO')


from math import ceil

def factorize(n):
	ans = []
	sq = ceil(n ** 0.5)
	while n > 1 and len(ans) < 2:
		prime = True
		for i in range(2, sq + 1):
			if n % i == 0:
				if i not in ans:
					ans.append(i)
					n //= i
					prime = False
					break
		if prime:
			if n != 1 and n not in ans:
				ans.append(n)
				n = 1
			else:
				break
	if n != 1 and n not in ans:
		ans.append(n)
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	if len(factorize(n)) == 3:
		print('YES')
		print(*factorize(n))
	else:
		print('NO')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	i = 2
	a = 0
	b = 0
	while i * i <= n and (a == 0 or b == 0):
		if n % i == 0 and a == 0:
			n //= i
			a = i
			i += 1
			continue
		elif n % i == 0 and b == 0:
			n //= i
			b = i
			i += 1
			continue
		i += 1
	if (a == 0 or b == 0) or (n == a or n == b):
		print('NO')
	else:
		print('YES')
		print(a, b, n)


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

def solve(n):
	facts = getFacts(n)
	for i in range(len(facts)):
		a = facts[i]
		bc = n // a
		f = getFacts(bc)
		for k in f:
			b = k
			c = bc // k
			if a != b and b != c and (a != c):
				print('YES')
				print(a, b, c)
				return
	print('NO')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		solve(n)
main()


def factorize(n):
	l = []
	for i in range(2, int(n ** 0.5) + 1):
		if len(l) == 2 and n >= i:
			l.append(n)
			break
		if n <= 1:
			break
		if n % i == 0:
			n = n // i
			l.append(i)
	return l
for _ in range(int(input())):
	n = int(input())
	l = factorize(n)
	if len(l) >= 3:
		print('YES')
		print(*l)
	else:
		print('NO')


from math import sqrt
t = int(input())
for ti in range(t):
	n = int(input())
	try:
		a = 0
		b = 0
		c = 0
		for i in range(2, int(sqrt(n)) + 1):
			if n % i == 0:
				a = i
				break
		for i in range(2, int(sqrt(n / a)) + 1):
			if int(n / a) % i == 0 and i != a:
				b = i
				c = int(n / (a * b))
				if c == b:
					raise Exception
				break
		if a == 0 or b == 0 or c == 0:
			raise Exception
		else:
			print('YES')
			print(a, b, c)
	except:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 2 * 3 * 4:
		print('NO')
	else:
		r = []
		i = 2
		j = 3
		while j > 1:
			l = len(r)
			for k in range(i, int(n ** (1 / j) + 2)):
				if n % k == 0:
					r.append(k)
					n //= k
					i = k + 1
					j -= 1
					break
			if len(r) == l or len(r) == 2:
				break
		if len(r) == 2 and n > int(r[-1]):
			r.append(n)
			print('YES')
			print(' '.join(map(str, r)))
		else:
			print('NO')


from sys import stdin, stdout
fin = lambda : stdin.readline()
fout = lambda *args: stdout.write(' '.join((str(i) for i in args)) + '\n')

def f(n, s=2):
	(a, b) = (-1, -1)
	for i in range(s, 22361):
		if n % i == 0:
			if a == -1:
				a = i
				n //= i
			elif i < n // i:
				return (a, i, n // i)
	return -1
for _ in range(int(fin())):
	n = int(fin())
	a = f(n)
	if a == -1:
		fout('NO')
	else:
		fout('YES')
		fout(a[0], a[1], a[2])


def factors(n):
	s = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			s.append(i)
			n = n // i
		if len(s) == 2:
			if n not in s:
				s.append(n)
				break
		i = i + 1
	if len(s) < 3:
		print('NO')
	else:
		print('YES')
		print(*s)
for _ in range(int(input())):
	n = int(input())
	l1 = factors(n)


from __future__ import division, print_function
import os
import sys, math
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
prime = []

def pp(n):
	while n % 2 == 0:
		n /= 2
		prime.append(2)
	import math
	k = int(math.sqrt(n))
	for i in range(3, k + 1):
		if n % i == 0:
			while n % i == 0:
				n /= i
				prime.append(i)
	if n > 2:
		prime.append(n)

def main():
	t = int(input())
	while t:
		t -= 1
		n = int(input())
		prime.clear()
		pp(n)
		if len(prime) < 3:
			print('NO')
			continue
		ok = True
		a = prime[0]
		b = prime[1]
		c = 1
		for i in range(2, len(prime)):
			c *= prime[i]
		if b == a:
			b *= prime[2]
			c /= prime[2]
			if len(prime) < 4 or c == a or c == b:
				print('NO')
				continue
			print('YES')
			c = int(c)
			print(a, b, c)
		elif b == c:
			print('NO')
		else:
			print('YES')
			c = int(c)
			print(a, b, c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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


def miller_rabin_primalitytest(n, a):
	z = n - 1
	d = z
	while d % 2 == 0:
		d = d // 2
	if pow(a, d, n) != 1:
		x = d
		while x < n:
			r = pow(a, x, n)
			if r == n - 1:
				return 'Probable Prime'
			else:
				x = 2 * x
		return 'Composite'
	else:
		return 'Probable Prime'

def isprimeoptimized(n):
	if n % 2 == 0 and n > 2:
		return False
	elif n == 2:
		return True
	elif n == 1:
		return False
	else:
		if n < 2047:
			L = [2]
		else:
			L = [2, 3, 5, 7]
		i = 0
		while i < len(L):
			if miller_rabin_primalitytest(n, L[i]) == 'Probable Prime':
				i += 1
			else:
				return False
		return True
t = int(input())
for i in range(0, t):
	n = int(input())
	if isprimeoptimized(n):
		print('NO')
	elif n < 24:
		print('NO')
	else:
		L = []
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				L.append(i)
				n = n // i
				break
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0 and L[0] != i and (L[0] != n // i) and (i * i != n):
				L.append(i)
				L.append(n // i)
				break
		if len(L) == 3:
			print('YES')
			print(*L)
		else:
			print('NO')


from functools import reduce

def factors(n):
	l = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			l.append(i)
			l.append(n // i)
	return l
for _ in range(int(input())):
	n = int(input())
	l = factors(n)
	flag = False
	flag1 = False
	flag2 = False
	for i in range(len(l)):
		a = l[i]
		b = n // a
		if a != b:
			flag = True
			break
	if flag:
		p = factors(b)
		l1 = p
		for i in range(len(l1)):
			c = l1[i]
			d = b // c
			if c != d and d != a and (c != a):
				flag1 = True
				break
		if flag1:
			print('YES')
			print(a, c, d)
		else:
			p = factors(a)
			l1 = list(p)
			for i in range(len(l1)):
				c = l1[i]
				d = a // c
				if d != c and b != d and (c != b):
					flag2 = True
					break
			if flag2:
				print('YES')
				print(c, d, b)
			else:
				print('NO')
	else:
		print('NO')


def affichage(L):
	for i in range(len(L)):
		L[i] = str(L[i])
	return ' '.join(L)
t = int(input())
for i in range(t):
	n = int(input())
	n1 = n
	nb = 0
	x = int(n ** 0.5)
	X = []
	for i in range(2, x + 1):
		if n % i == 0:
			n = n // i
			X.append(i)
			nb += 1
			if nb == 2:
				break
	if nb == 2:
		X.append(n1 // (X[-1] * X[-2]))
		if X[0] != X[1] and X[1] != X[2] and (X[0] != X[2]):
			print('YES')
			print(affichage(X))
		else:
			print('NO')
	else:
		print('NO')


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

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

def factors(a):
	fact = []
	if a % 2 == 0:
		ch = 0
		while a % 2 == 0:
			ch += 1
			a //= 2
		fact.extend([2] * ch)
	i = 3
	while i * i <= a:
		if a % i == 0:
			ch = 0
			while a % i == 0:
				ch += 1
				a //= i
			fact.extend([i] * ch)
		i += 2
	if a > 1:
		fact.append(a)
	return fact

def main():
	t = iin()
	ans = ['YES', 'NO']
	while t:
		t -= 1
		n = iin()
		fct = factors(n)
		if len(fct) >= 3:
			l = len(fct)
			(a, b) = (fct[0], fct[1])
			c = 1
			if b == a:
				if l > 3:
					b *= fct[2]
					for i in range(3, l):
						c *= fct[i]
				else:
					print(ans[1])
					continue
			else:
				for i in range(2, l):
					c *= fct[i]
			if a != b and b != c and (c != a):
				print(ans[0])
				print(a, b, c)
				continue
		print(ans[1])
main()


import math

def primenum(x):
	count = 0
	for i in range(2, int(math.floor(math.sqrt(x))) + 1):
		if x % i == 0:
			count = count + 1
	if count == 0:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	n = int(input())
	m = n
	if primenum(n) == True:
		print('NO')
	else:
		l = []
		for j in range(2, int(math.sqrt(m)) + 1):
			if n % j == 0:
				l.append(j)
				n = n // j
			if len(l) == 2:
				x = m // (l[0] * l[1])
				if x > l[0] and x > l[1]:
					l.append(x)
			if len(l) == 3:
				if l[0] * l[1] * l[2] == m:
					print('YES')
					print(l[0], l[1], l[2])
					break
		else:
			print('NO')


from math import sqrt
t = int(input())
while t:
	n = int(input())
	nn = n
	nnn = n
	num = []
	n = int(sqrt(n)) + 1
	cou = 0
	if nn % 2 == 0:
		cou += 1
		num.append(2)
	while nn % 2 == 0:
		nn = nn // 2
	for i in range(3, n, 2):
		if cou == 3:
			break
		if nn % i == 0:
			cou += 1
			num.append(i)
		while nn % i == 0:
			nn = nn // i
	if nn != 1:
		cou += 1
		num.append(nn)
	if cou >= 3:
		print('YES')
		print(num[0], num[1], nnn // (num[0] * num[1]))
	elif cou == 1:
		a = num[0]
		b = num[0] * num[0]
		c = nnn // (a * b)
		if a != b and a != c and (c > b):
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		a = num[0]
		b = num[1]
		c = nnn // (num[0] * num[1])
		if c != a and c != b and (c > 1):
			print('YES')
			print(num[0], num[1], c)
		else:
			print('NO')
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
p = []
for _ in range(t):
	n = int(input())
	fac = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			fac.append(i)
			fac.append(n // i)
	nn = len(fac)
	st = 0
	for i in range(nn):
		for j in range(i + 1, nn):
			if n % (fac[i] * fac[j]) == 0:
				k = n // (fac[i] * fac[j])
				if fac[i] == fac[j] or fac[i] == k or fac[j] == k:
					continue
				if 1 in [fac[i], fac[j], k]:
					continue
				st = 1
				(ii, jj, kk) = (fac[i], fac[j], k)
				break
	if st:
		print('YES')
		print(ii, jj, kk)
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(n):
	ans = []
	i = 2
	while len(ans) < 2 and i * i < n:
		if n % i == 0:
			ans.append(i)
			n //= i
		i += 1
	if len(ans) == 2:
		print('YES')
		print(ans[0], ans[1], n)
	else:
		print('NO')
for _ in range(int(input())):
	n = int(input())
	solve(n)


t = int(input())
for _ in range(t):
	n = int(input())
	import math
	temp = int(math.sqrt(n))
	done = 0
	for i in range(2, temp + 1):
		if n % i == 0:
			a = i
			for j in range(2, int(math.sqrt(a)) + 1):
				if a % j == 0 and a / j != a:
					x = n // i
					y = j
					z = a // j
					if x != y and z != y and (z != x):
						done = 1
						break
			if done == 1:
				break
			if i != n / i:
				b = n // i
				for j in range(2, int(math.sqrt(b)) + 1):
					if b % j == 0 and b != b // j:
						x = i
						y = b // j
						z = j
						if x != y and z != y and (z != x):
							done = 1
							break
			if done == 1:
				break
	if done:
		print('YES')
		print(x, y, z)
	else:
		print('NO')


import math
debug = False
if debug:
	f = open('test', 'r')
else:
	f = None

def line(file):
	if debug:
		return file.__next__().strip()
	return input()
test_cases = int(line(f))
for _ in range(test_cases):
	n = int(line(f))

	def solve(n):
		throot = int(math.pow(n, 1 / 3)) + 1
		for a in range(2, throot):
			if n % a == 0:
				twroot = int(math.sqrt(n / a)) + 1
				for b in range(a + 1, twroot):
					if n / a % b == 0:
						c = int(n / a / b)
						if c != b:
							return f'{a} {b} {c}'
		raise EnvironmentError()
	try:
		string = solve(n)
		print('YES')
		print(string)
	except EnvironmentError:
		print('NO')
if debug:
	f.close()


import sys
import math
import itertools
import functools
import collections
import operator

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

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

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

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 divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

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):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	d = divs(n)
	if len(d) < 4:
		print('NO')
	else:
		f = True
		s = d[0]
		for item in d[1:]:
			t = n // (s * item)
			if t in d and t != s and (t != item):
				print('YES')
				print(s, t, item)
				f = False
				break
		if f:
			print('NO')


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = b = c = -1
	d = -1
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			a = j
			if n // j != j:
				d = n // j
				break
	if a == -1 or d == -1:
		print('NO')
	else:
		for j in range(2, int(math.sqrt(d)) + 1):
			if d % j == 0 and j != a:
				b = j
				if d // j != j:
					c = d // j
					break
		if b == -1 or c == -1:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import sys
import math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	for test in range(tests):
		n = inp()
		n1 = math.sqrt(n) + 2
		out = []
		flag = 1
		i = 2
		while i < n1 and len(out) < 3:
			if n % i == 0:
				n = int(n / i)
				n1 = math.sqrt(n) + 2
				if i not in out:
					out.append(i)
				if len(out) == 2 and n not in out and (n != 1):
					out.append(n)
					break
			i = i + 1
		if len(out) == 3:
			print('YES')
			pr_list(out)
		else:
			print('NO')
	return
main()


import math
for _ in range(int(input())):
	n = int(input())
	f = 0
	s = 0
	k = 0
	if n < 24:
		f = 1
	else:
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				f = 0
				k = i
				break
		if k == int(math.sqrt(n)):
			f = 1
	if n >= 24 and f == 0:
		f = 1
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				x = n // i
				a = i
				for j in range(2, int(math.sqrt(x)) + 1):
					b = j
					c = x // j
					if x % j == 0:
						if a != b and b != c and (c != a):
							f = 0
							break
				if f == 0:
					break
	if f == 0:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


test_cases = int(input())
for z in range(test_cases):
	n = int(input())
	x = n
	l = []
	for i in range(2, int(n ** 0.5) + 2):
		if x % i == 0:
			l.append(i)
			x = x / i
			if len(l) >= 3:
				if l[0] * l[1] * l[2] <= n:
					print('YES')
					print(l[0], l[1], int(n / (l[0] * l[1])))
					break
			elif len(l) == 2 and l[0] * l[1] <= n ** 0.5:
				print('YES')
				print(l[0], l[1], int(n / (l[0] * l[1])))
				break
	if len(l) < 2:
		print('NO')
	if len(l) == 2:
		if l[0] * l[1] > n ** 0.5:
			print('NO')
	elif len(l) >= 3:
		if l[0] * l[1] * l[2] > n:
			print('NO')


n = int(input())

def f(a):
	q = a
	x = 0
	y = 0
	z = 0
	for i in range(2, a):
		if i * i > a:
			break
		if a % i == 0:
			x = i
			break
	if x == 0:
		return 'NO'
	else:
		a = a // x
	for i in range(2, a):
		if i * i > a:
			break
		if i != x and a % i == 0:
			y = i
			break
	if y == 0:
		return 'NO'
	else:
		z = a // y
	if z != y and z != x and (y != x) and (x * y * z == q):
		return 'YES' + '\n' + str(x) + ' ' + str(y) + ' ' + str(z)
	return 'NO'
for i in range(n):
	a = int(input())
	print(f(a))


def foo(num):
	isSimple = True
	k = 0
	while k < arr.__len__() and arr[k] <= math.sqrt(num):
		if num % arr[k] == 0:
			isSimple = False
			num = num / arr[k]
			break
		k += 1
	return num
import math
n = int(input())
arr = []
root = math.sqrt(1000000000)
for num in range(2, int(root) + 1):
	isSimple = True
	for delimiter in range(2, int(math.sqrt(num)) + 1):
		if num % delimiter == 0:
			isSimple = False
			break
	if isSimple:
		arr.append(num)
for i in range(n):
	num = int(input())
	res = foo(num)
	if res == num:
		print('NO')
		continue
	else:
		d1 = num / res
		num = res
	res = foo(num)
	if res == num:
		print('NO')
		continue
	else:
		d2 = num / res
		num = res
	if d1 == d2:
		res = foo(num)
		if res == num:
			print('NO')
			continue
		d2 *= num / res
		num = res
	if d1 != num and d2 != num and (d1 != d2):
		print('YES')
		print('%d %d %d' % (d1, d2, res))
	else:
		print('NO')


def primefactor(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			l.append(i)
			n //= i
	if n > 2:
		l.append(n)
	return l
for _ in range(int(input())):
	n = primefactor(int(input()))
	l = []
	if len(n) == 3:
		if len(set(n)) == 3:
			print('YES')
			print(*n)
		else:
			print('NO')
	elif len(n) > 3:
		if n[0] == n[1]:
			l.append(n[0])
			l.append(n[1] * n[2])
			c = 1
			for i in range(3, len(n)):
				c *= n[i]
			l.append(c)
			if len(set(l)) != 3:
				print('NO')
			else:
				print('YES')
				print(*l)
		else:
			l.append(n[0])
			l.append(n[1])
			c = 1
			for i in range(2, len(n)):
				c *= n[i]
			l.append(c)
			if len(set(l)) != 3:
				print('NO')
			else:
				print('YES')
				print(*l)
	else:
		print('NO')


from math import sqrt
from math import ceil

def find(fro, n):
	if n % fro == 0:
		return fro
	return find(fro + 1, n)
t = int(input())
answers = []
for ti in range(t):
	n = int(input())
	first = -1
	for i in range(2, ceil(sqrt(n)) + 1):
		if n % i == 0:
			first = i
			break
	if first == -1:
		answers.append('NO')
		continue
	second = -1
	nn = n // first
	for i in range(first + 1, ceil(sqrt(nn))):
		if nn % i == 0:
			second = i
			break
	if second == -1:
		answers.append('NO')
		continue
	third = nn // second
	answers.append('YES')
	answers.append(str(first) + ' ' + str(second) + ' ' + str(third))
for a in answers:
	print(a)


for _ in range(int(input())):
	i = 2
	l = []
	n = int(input())
	size = 0
	while i * i <= n and size < 2:
		if n % i == 0:
			l.append(i)
			n //= i
			size += 1
		i += 1
	if size == 2 and (l[0] != n and l[1] != n):
		print('YES')
		print(l[0], l[1], n)
	else:
		print('NO')


from math import ceil, sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 24:
		print('NO')
	else:
		try:
			for i in range(4, ceil(sqrt(n)) + 1):
				if n % i == 0:
					a = n // i
					b = i
					for j in range(2, ceil(sqrt(a))):
						if a % j == 0 and j != b and (a // j != b) and (a // j > 1):
							print('YES')
							print(b, j, a // j)
							raise SystemExit
					for j in range(2, ceil(sqrt(b))):
						if b % j == 0 and j != a and (b // j != a) and (b // j > 1):
							print('YES')
							print(a, j, b // j)
							raise SystemExit
		except SystemExit:
			continue
		else:
			print('NO')


import math

def fac(x):
	i = 2
	a = []
	while i * i <= x:
		if x % i == 0:
			a.append(i)
			x //= i
		else:
			i += 1
	if x > 1:
		a.append(x)
	return a

def res(x):
	f = fac(x)
	if len(f) <= 2 or (len(set(f)) == 1 and len(f) < 6) or (len(set(f)) == 2 and len(f) <= 3):
		print('NO')
		return 0
	a = f[0]
	l = 1
	r = len(f) - 1
	s = 1
	for i in f[l:r + 1]:
		s *= i
	b = s
	h = 31
	c = 1
	while h > 0:
		if c != 1 and c != a and (c != b):
			break
		else:
			c = int(c * f[r])
			b = int(b / f[r])
			r -= 1
			if l == r:
				break
		h -= 1
	print('YES')
	(b, c) = (min(b, c), max(b, c))
	print(a, b, c)
n = int(input())
while n > 0:
	x = int(input())
	res(x)
	n -= 1


n = int(input())
for i in range(n):
	a = int(input())
	k = a
	p = []
	j = 2
	while j * j < k:
		if k % j == 0 and j not in p:
			p.append(j)
			k = k // j
		if len(p) == 2:
			g = a // (p[0] * p[1])
			if g != p[0] and g != p[1]:
				break
		j += 1
	if len(p) < 2:
		print('NO')
	elif len(p) == 2 and p[0] * p[1] == a:
		print('NO')
	elif p[0] != a // (p[0] * p[1]) and p[1] != a // (p[0] * p[1]):
		print('YES')
		print(p[0], p[1], a // (p[0] * p[1]))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, s) = (int(input()), [])
	for i in range(2, int(n ** (1 / 2) + 1)):
		if n % i == 0:
			s.append(i)
			n = n // i
			if len(s) == 2 and s[0] != n and (s[1] != n):
				break
	if len(s) == 2 and s[0] != n and (s[1] != n):
		print('YES')
		print(str(s[0]) + ' ' + str(s[1]) + ' ' + str(n))
	else:
		print('NO')


import math as m
n = int(input())
for _ in range(n):
	a = int(input())
	v = []
	for i in range(2, int(m.sqrt(a)) + 1):
		if a % i == 0 and i != a // i:
			z = a // i
			for j in range(i + 1, int(m.sqrt(z)) + 1):
				if z % j == 0 and j != z // j:
					a = 0
					v.append([i, j, z // j])
					break
		if a == 0:
			break
	if a == 0:
		print('YES')
		for i in v:
			print(*i)
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	f = []
	for j in range(2, int(n ** (1 / 2))):
		while n % j == 0:
			f.append(j)
			n = int(n / j)
	if n > 1:
		f.append(n)
	if len(f) >= 3:
		if len(f) == 3:
			if f[0] != f[1] and f[1] != f[2] and (f[2] != f[0]):
				print('YES')
				print(f[0], f[1], f[2])
			else:
				print('NO')
		else:
			f0 = f[0]
			f1 = 1
			f2 = 1
			if f[1] == f[0]:
				f1 = f[1] * f[2]
				for j in range(3, len(f)):
					f2 *= f[j]
			else:
				f1 = f[1]
				for j in range(2, len(f)):
					f2 *= f[j]
			if f0 != f1 and f1 != f2 and (f2 != f0):
				print('YES')
				print(f0, int(f1), int(f2))
			else:
				print('NO')
	else:
		print('NO')


def main():

	def divisors(n):
		div = []
		for i in range(2, int(n ** 0.5)):
			if n % i == 0:
				div.append(i)
				n //= i
			if len(div) == 2:
				if n not in div and n != 1:
					div.append(n)
				break
		return div
	for _ in range(int(input())):
		n = int(input())
		d = divisors(n)
		if len(d) < 3:
			print('NO')
			continue
		print('YES')
		print(*d)
main()


t = int(input())
for _ in range(t):
	n = num = int(input())
	arr = []
	div = 2
	while n != 1:
		if div > int(n ** 0.5):
			arr.append(n)
			n //= div
			break
		if n % div == 0:
			n //= div
			arr.append(div)
			continue
		div += 1
	if len(arr) < 3:
		print('NO')
	else:
		cand = []
		cur = 1
		while arr:
			cur *= arr.pop(0)
			if cur not in cand:
				cand.append(cur)
				cur = 1
		if cur != 1:
			cand[-1] *= cur
		if len(cand) < 3:
			print('NO')
		else:
			while len(cand) != 3:
				cur = cand.pop()
				cand[-1] *= cur
			print('YES')
			print(*cand)


import math

def getnumbers(n):
	divisor = []
	while n % 2 == 0:
		(divisor.append(2),)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			(divisor.append(int(i)),)
			n = n / i
	if n > 2:
		divisor.append(int(n))
	(a, b, c, size) = (0, 0, 0, 0)
	a = b = c = 1
	size = len(divisor)
	for i in range(size):
		if a == 1:
			a = a * divisor[i]
		elif b == 1 or b == a:
			b = b * divisor[i]
		else:
			c = c * divisor[i]
	if a == 1 or b == 1 or c == 1 or (a == b) or (b == c) or (a == c):
		print('NO')
	else:
		print('YES')
		print(a, b, c)
for i in range(int(input())):
	n = int(input())
	getnumbers(n)


import math
t = int(input())

def f(a):
	b = 2
	a = int(a)
	fac = []
	c = math.sqrt(a)
	while b <= c and a > 1:
		if a % b == 0:
			while a % b == 0:
				fac.append(b)
				a /= b
			b += 1
		else:
			b += 1
	if a != 1:
		fac.append(a)
	return fac
for i in range(t):
	n = int(input())
	list = f(n)
	list2 = []
	list2.clear()
	while list:
		i = list[0]
		b = list.count(i)
		list2.append([i, b])
		for j in range(b):
			list.remove(i)
	c = len(list2)
	if c >= 3:
		print('YES')
		print(list2[0][0], list2[1][0], int(n / list2[0][0] / list2[1][0]))
	elif c == 1:
		if list2[0][1] >= 6:
			print('YES')
			print(list2[0][0], list2[0][0] * list2[0][0], int(n / list2[0][0] / list2[0][0] / list2[0][0]))
		else:
			print('NO')
	elif c == 0:
		print('NO')
	elif list2[0][1] >= 2 and list2[1][1] >= 2:
		print('YES')
		print(list2[0][0], list2[1][0], int(n / list2[0][0] / list2[1][0]))
	elif list2[0][1] >= 3:
		print('YES')
		print(list2[0][0], int(list2[1][0]), int(n / list2[0][0] / list2[1][0]))
	elif list2[1][1] >= 3:
		print('YES')
		print(list2[0][0], list2[1][0], int(n / list2[0][0] / list2[1][0]))
	else:
		print('NO')


t = int(input())
li = []

def p2(m, a):
	for i in range(2, int(m ** 0.5) + 1):
		if int(m / i) == m / i and i != m / i != a and (i != a):
			return [int(i), int(m / i)]
	return 'no'
for i in range(t):
	li = li + [int(input())]
for k in li:
	if p2(k, 1) != 'no':
		l = p2(k, 1)
		if p2(l[0], l[1]) != 'no':
			print('YES')
			print(l[1], p2(l[0], l[1])[0], p2(l[0], l[1])[1])
		elif p2(l[1], l[0]) != 'no':
			print('YES')
			print(l[0], p2(l[1], l[0])[0], p2(l[1], l[0])[1])
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	sqn = int(n ** (1 / 2)) + 10
	ans = []
	flag = False
	for i in range(2, sqn):
		if n % i == 0:
			ans.append(i)
			n //= i
			if len(ans) == 2:
				if n == ans[1] or n == ans[0] or n == 1:
					print('NO')
				else:
					print('YES')
					print(*ans, n)
				flag = True
				break
	if not flag:
		print('NO')


from collections import defaultdict as dd

def facts(x):
	f = set()
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0:
			f.add(i)
			f.add(x // i)
	return list(f)
for _ in range(int(input())):
	n = int(input())
	fac = facts(n)
	if len(fac) < 3:
		print('NO')
	else:
		have = dd(lambda : False)
		root = n ** 0.5
		for x in fac:
			have[x] = True
		done = False
		for i in range(len(fac)):
			for j in range(i + 1, len(fac)):
				(x, y) = (fac[i], fac[j])
				z = n // (x * y)
				if z == x or z == y:
					continue
				if have[z] == True and x * y * z == n:
					done = True
					print('YES')
					print(x, y, z)
					break
			if done:
				break
		if not done:
			print('NO')


import math

def solve(n):
	root = int(math.sqrt(n))
	a = -1
	b = -1
	c = 0
	i = 2
	while i <= root:
		if n % i == 0:
			a = i
			n = n / i
			break
		i = i + 1
	root = int(math.sqrt(n))
	i = 2
	while i <= root:
		if n % i == 0 and i != a and (n / i != a) and (i != n / i):
			b = i
			c = int(n / i)
			break
		i = i + 1
	if a == -1 or b == -1:
		print('NO')
	else:
		output = '{0} {1} {2}'
		print('YES')
		print(output.format(a, b, c))
t = int(input())
while t >= 1:
	n = int(input())
	solve(n)
	t = t - 1


import math

def is_prime(n):
	isPrime = 1
	for i in range(2, math.floor(math.sqrt(n)) + 1):
		if n % i == 0:
			isPrime = 1
			break
	if isPrime == 1:
		return False
	return True
for _ in range(int(input())):
	n = int(input())
	isPrime = is_prime(n)
	if isPrime:
		print('NO')
	else:
		(a, b, c) = (0, 0, 0)
		l = []
		k = n
		for i in range(2, math.floor(math.sqrt(n)) + 1):
			if n % i == 0:
				if n // i == i:
					l.append(i)
				else:
					l.append(i)
					l.append(n // i)
		l.append(k)
		a = min(l)
		if a != 0:
			l = []
			n = k // a
			for i in range(2, math.floor(math.sqrt(n)) + 1):
				if n % i == 0:
					if n // i == i:
						if i > a:
							l.append(i)
					else:
						if i > a:
							l.append(i)
						if n // i > a:
							l.append(n // i)
			l.append(k // a)
			b = min(l)
		if b != 0:
			l = []
			n = k // (a * b)
			for i in range(2, math.floor(math.sqrt(n) + 1)):
				if n % i == 0:
					if n // i == i:
						if i > b:
							l.append(i)
					else:
						if i > b:
							l.append(i)
						if n // i > b:
							l.append(n // i)
			l.append(k // (a * b))
			c = max(l)
		if len(set([a, b, c])) < 3 or a < 2 or b < 2 or (c < 2):
			print('NO')
		else:
			print('YES')
			print(a, b, c)


import math

def solve(n):
	for a in range(2, math.ceil(n ** (1 / 3))):
		if n % a == 0:
			for b in range(a + 1, math.ceil(math.sqrt(n // a))):
				c = n // a // b
				if c * a * b == n:
					print('YES')
					print('%d %d %d' % (a, b, c))
					return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	if solve(n):
		print('NO')


v = int(input())
for i in range(v):
	b = list(map(int, input().split()))[:v]
	c = 0
	a = []
	for j in b:
		for h in range(2, int(j ** 0.5) + 1):
			if j % h == 0:
				c += 1
				j = j // h
				a.append(h)
				if len(a) == 2:
					break
		if len(a) == 2 and j not in a:
			print('YES')
			print(*a, j)
		else:
			print('NO')


from sys import stdin
input = stdin.readline
import math

def com(p, q, r):
	if p == q or q == r or p == r:
		return -1
	else:
		return 1

def pd(n):
	t = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0 and i != 1:
			if n // i == i:
				t.append([i, i])
			else:
				t.append([i, n // i])
		i += 1
	return t
for _ in range(int(input())):
	n = int(input())
	a = pd(n)
	ans = -1
	for i in range(len(a)):
		if ans == 1:
			break
		x = a[i][0]
		y = a[i][1]
		b = pd(x)
		c = pd(y)
		for i in range(len(b)):
			ans = com(b[i][0], b[i][1], y)
			if ans == 1:
				ans1 = [b[i][0], b[i][1], y]
				break
		if ans == 1:
			break
		for i in range(len(c)):
			ans = com(c[i][0], c[i][1], x)
			if ans == 1:
				ans1 = [c[i][0], c[i][1], x]
				break
	if ans == 1:
		print('YES')
		print(*ans1)
	else:
		print('NO')


import math
from itertools import permutations

def divisores(n):
	large_divisors = []
	for k in range(1, int(math.sqrt(n) + 1)):
		if n % k == 0:
			yield k
			if k * k != n:
				large_divisors.append(n // k)
	for d in reversed(large_divisors):
		yield d
t = int(input())
for k in range(t):
	q = int(input())
	divisoresL = list(divisores(q))
	if len(divisoresL) < 5:
		print('NO')
	else:
		flag = 0
		divisoresL.remove(divisoresL[0])
		divisoresL.remove(divisoresL[len(divisoresL) - 1])
		for subset in permutations(divisoresL, 3):
			if subset[0] * subset[1] * subset[2] == q:
				print('YES')
				print('{} {} {}'.format(subset[0], subset[1], subset[2]))
				flag = 1
				break
		if flag == 0:
			print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	factors = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			factors.append(i)
			if n // i != i:
				factors.append(n // i)
	if len(factors) < 2:
		print('NO')
		continue
	factors.sort()
	done = False
	for i in range(len(factors)):
		for j in range(i + 1, len(factors)):
			a = factors[i]
			b = factors[j]
			c = n // a
			if c % b != 0:
				continue
			c = c // b
			if c >= 2 and a != c and (b != c):
				done = True
				print('YES')
				print(a, b, c)
				break
		if done:
			break
	if not done:
		print('NO')


import math, sys
t = int(input())
answer = []
while t != 0:
	t -= 1
	n = int(input())
	num = n
	if num in answer:
		print('NO')
		continue
	even = True if num % 2 == 0 else False
	if even == True:
		arr = [1]
		counter = 1
	else:
		arr = [2]
		counter = 2
	while len(arr) != 3:
		i = arr[-1] + 1
		if i > n:
			break
		while n % i != 0 and i < int(pow(n, 0.5)):
			i += 1
		arr.append(i)
		n = n // i
	if n != 1 and len(arr) == 3 and (n not in arr) and (arr[1] * arr[2] * n == num):
		print('YES')
		arr.append(n)
		arr = map(str, arr[1:])
		print(' '.join(arr))
	else:
		if num not in answer:
			answer.append(num)
		print('NO')


for x in range(int(input())):
	n = int(input())
	a = 1
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0:
			a = i
			n /= i
			break
	if a != 1:
		b = 1
		for i in range(a + 1, int(n ** 0.5) + 2):
			if n % i == 0:
				if n // i != a and n // i != i:
					b = i
					n /= i
					break
		if b != 1:
			if n != 1:
				print('YES')
				print(a, b, int(n))
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


from collections import deque
from math import sqrt

def factors(n):
	d = deque()
	for x in range(2, int(sqrt(n) + 1)):
		if n % x == 0:
			d.append(x)
			if n // x != x:
				d.append(n // x)
	return (d, set(d))
t = int(input())
while t:
	n = int(input())
	(f, m) = factors(n)
	flag = a = b = c = 0
	for x in range(len(f)):
		(fa, ma) = factors(f[x])
		for y in range(len(fa)):
			if f[x] // fa[y] != fa[y] and fa[y] != n // f[x] and (f[x] // fa[y] != n // f[x]):
				flag = 1
				(a, b, c) = (fa[y], n // f[x], f[x] // fa[y])
				break
		if flag:
			break
	if flag:
		print('YES')
		print(a, b, c)
	else:
		print('NO')
	t -= 1


import math
num = int(input())
nums = []
for i in range(num):
	nums.append(int(input()))

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

def getDel(num, left):
	for i in range(left, int(math.sqrt(num)) + 1):
		if num % i == 0:
			return [i, num // i]
	return [-1]

def thirdNum(f, s, num):
	if num != f and num != s:
		return num
	elif isPrime(num):
		return -1
	else:
		for i in range(s + 1, num):
			if num % i == 0:
				return i
	return -1
for i in nums:
	if isPrime(i) == True:
		print('NO')
	else:
		f = getDel(i, 2)
		if f[0] > 0:
			s = getDel(f[1], f[0] + 1)
			if s[0] > 0:
				t = thirdNum(f[0], s[0], s[1])
				if t > 0:
					print('YES')
					print(' '.join(map(str, [f[0], s[0], t])))
				else:
					print('NO')
			else:
				print('NO')
		else:
			print('NO')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

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

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

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))
mo = 1000000007

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
for _ in range(inn()):
	n = inn()
	res = factors(n)
	res.sort()
	res = res[1:len(res) - 1]
	if len(res) > 4:
		flag = 0
		for i in range(len(res) - 1):
			for j in range(i + 1, len(res)):
				val = res[i] * res[j]
				if n % val == 0:
					flag = 1
					print('YES')
					print(res[i], res[j], n // val)
					break
			if flag == 1:
				break
		if flag == 0:
			print('NO')
	else:
		print('NO')


import math
t = int(input())
for tt in range(t):
	n = int(input())
	f = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			a = i
			c = 1
			b = 1
			for j in range(2, int(math.sqrt(n / a)) + 1):
				if n / a % j == 0 and j != a:
					b = j
					c = int(n / (a * j))
					break
			if a != c and b != c and (c != 1):
				print('YES')
				print('%s %s %s' % (a, b, c))
				f = 1
			else:
				print('NO')
				f = 1
			break
	if f == 0:
		print('NO')


import math
for _ in range(int(input())):
	t = n = int(input())
	dels = []
	sq = int(math.sqrt(n))
	d = 2
	while d <= sq:
		if n % d != 0:
			d += 1
		else:
			dels.append(d)
			n //= d
			sq = int(math.sqrt(n))
	dels.append(n)
	a = dels[0]
	b = 1
	i = 1
	while i < len(dels) and b <= a:
		b *= dels[i]
		i += 1
	(a, b, c) = sorted([a, b, t // (a * b)])
	if a > 1 and a < b < c:
		print('YES')
		print(a, b, t // (a * b))
	else:
		print('NO')


def process(n, i, sol):
	for j in range(i + 1, int(n ** 0.5) + 1):
		if n % j == 0:
			sol.append(j)
			if len(sol) == 1:
				process(n // j, j, sol)
				break
			if len(sol) == 2:
				if j != n // j:
					sol.append(n // j)
				break
	return sol
for _ in range(int(input())):
	n = int(input())
	sol = []
	process(n, 1, sol)
	if len(sol) == 3:
		print('YES')
		print(*sol)
	else:
		print('NO')


def f1(x, k):
	for i in range(int(math.sqrt(x)), 1, -1):
		if x % i == 0:
			y = x // i
			if i != y and i != k and (y != k):
				return i
	return 0
import math
t = int(input())
for i in range(t):
	n = int(input())
	if n < 24:
		print('NO')
		continue
	a = 0
	b = 0
	c = 0
	for j in range(int(pow(n, 1 / 3)), 1, -1):
		if n % j == 0:
			p = n // j
			z = f1(p, j)
			if z != 0:
				a = j
				b = z
				c = p // z
				break
	if a != 0:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	used = []
	n = int(input())
	for i in range(2, round(n / 2)):
		if i * i >= n:
			break
		if n % i == 0 and i not in used:
			used.append(i)
			n = n / i
			break
	for i in range(2, round(n / 2)):
		if i * i >= n:
			break
		if n % i == 0 and i not in used:
			used.append(i)
			n = n / i
			break
	if len(used) < 2 or n in used or n == 1:
		print('NO')
	else:
		print('YES')
		used.append(int(n))
		for item in used:
			print(item, end=' ')
		print()


from math import ceil, sqrt

def kFactors(n, k=3):
	a = []
	for i in range(2, ceil(sqrt(n))):
		if n % i == 0:
			n = n / i
			a.append(i)
	if n > 2:
		a.append(n)
	a = list(set(a))
	if len(a) < k:
		return [-1]
	return [a[0], a[1]]
for i in range(int(input())):
	n = int(input())
	a = kFactors(n)
	if a[0] == -1:
		print('NO')
	else:
		print('YES')
		print(int(a[0]), int(a[1]), int(n // (a[0] * a[1])))


for x in range(int(input())):
	n = int(input())
	k = 0
	a = set()
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0 and k < 2:
			n //= i
			k += 1
			a.add(i)
	if k == 2 and n > 1:
		a.add(n)
	if len(a) == 3:
		a = sorted(a)
		print('YES')
		print(*a)
	else:
		print('NO')


def prime_factorize(n):
	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
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	l = prime_factorize(n)
	L = l[0]
	R = l[-1]
	if L == R and len(l) > 3:
		R *= l[-2]
		l.pop(-1)
	if len(l) >= 3 and L != R:
		prod = 0
		for i in range(len(l[1:-1])):
			prod = prod * l[1 + i] if prod != 0 else l[1]
		if prod != L and prod != R:
			ans.append('YES')
			ans.append(str(L) + ' ' + str(prod) + ' ' + str(R))
		else:
			ans.append('NO')
	else:
		ans.append('NO')
for i in range(len(ans)):
	print(ans[i])


for i in range(int(input())):
	a = int(input())
	b = []
	i = 2
	while len(b) < 2 and i ** 2 < a:
		if a % i == 0:
			a = a // i
			b.append(i)
		i += 1
	if len(b) == 2 and a not in b:
		print('YES')
		b.append(a)
		b = ' '.join((str(i) for i in b))
		print(b)
	else:
		print('NO')


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	i = 2
	found = 0
	while i * i <= n:
		if n % i == 0:
			n1 = n // i
			j = 2
			comp = 0
			while j * j <= n1:
				if n1 % j == 0:
					comp = 1
					if i == n1 // j or i == j or n1 // j == j or (n // j == 1) or (j == 1):
						j += 1
						continue
					else:
						if found or n1 // j == 1 or j == 1:
							break
						found = 1
						print('YES')
						print(i, n1 // j, j)
				j += 1
		i += 1
	if not found:
		print('NO')


import math
T = int(input())
for i in range(T):
	x = input()
	x = int(x)
	d = 0
	(a, b, c) = (-1, -1, -1)
	p = x
	for j in range(2, int(math.sqrt(x)) + 1):
		if x % j == 0:
			a = j
			x = x // j
			break
	if a != -1:
		for j in range(a + 1, int(math.sqrt(x)) + 1):
			if x % j == 0:
				b = j
				x = x // j
				break
	if p % x == 0:
		c = x
	if a == -1 or b == -1 or c == -1 or (b == c) or (a == c):
		print('NO')
	else:
		print('YES')
		print(a, b, c, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	rt = int(n ** 0.5)
	st = set()
	flag = 0
	for i in range(2, rt + 1):
		if n % i == 0:
			k = n // i
			v = int(k ** 0.5)
			for j in range(2, v + 1):
				if k % j == 0 and i != j:
					if k // j != i and k // j != j:
						print('YES')
						print(i, j, k // j)
						flag = 1
						break
		if flag == 1:
			break
	if flag == 0:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	flag = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			t = n // i
			for j in range(2, int(math.sqrt(t)) + 1):
				if t % j == 0:
					if j != i and t // j != i and (j != t // j):
						flag = 1
						print('YES')
						print(str(i) + ' ' + str(j) + ' ' + str(t // j))
						break
			if flag == 1:
				break
	if flag == 0:
		print('NO')


def foo(n):
	x = pow(n, 0.5)
	x = int(x) + 1
	l = []
	for i in range(2, x):
		if n % i == 0:
			z = n // i
			l.append(i)
			if z != i:
				l.append(z)
	l.sort()
	if len(l) >= 3:
		for i in range(0, len(l) - 1):
			k = l[i] * l[i + 1]
			z = n // k
			if z in l and z != l[i] and (z != l[i + 1]):
				print('YES')
				k = [l[i], l[i + 1], z]
				print(*k)
				return
		print('NO')
	else:
		return print('NO')
t = int(input())
for t1 in range(0, t):
	n = int(input())
	foo(n)


def fun(n):
	for i in range(2, int(n ** 0.5) + 1):
		x = n // i
		if n % i == 0:
			for j in range(2, int(x ** 0.5) + 1):
				if x % j == 0 and x // j != j and (i != j) and (x // j != i):
					return (True, [i, j, x // j])
	return (False, [-1, -1, -1])
t = int(input())
for _ in range(t):
	n = int(input())
	(res, lst) = fun(n)
	lst.sort()
	if res:
		print('YES')
		print(lst[0], lst[1], lst[2])
	else:
		print('NO')


import math

def prf(x):
	a = []
	b = 1
	n = 2
	m = int(math.sqrt(x))
	while n <= m:
		if x % n == 0:
			if not n in a:
				a.append(n)
			elif not n * b in a:
				a.append(n * b)
				b = 1
			else:
				b *= n
			x //= n
		elif n == 2:
			n += 1
		else:
			n += 2
		if len(a) == 2 and (not x * b in a) and (x * b > 1):
			a.append(x * b)
			return a
		elif len(a) == 3:
			return a
		elif len(a) == 2:
			return 'NO'
	return 'NO'
n = int(input())
for i in range(n):
	x = int(input())
	re = prf(x)
	if type(re) == type('NO'):
		print(re)
	else:
		print('YES')
		print(*sorted(re))


n = int(input())
for i in range(n):
	a = int(input())
	A = []
	for i in range(2, int(a ** 0.5)):
		if a % i == 0:
			A.append(i)
			a /= i
			break
	if len(A) == 0:
		print('NO')
		continue
	else:
		for i in range(A[0] + 1, int(a ** 0.5) + 1):
			if a % i == 0:
				A.append(i)
				a /= i
				break
		if len(A) == 2:
			if A[1] == a or A[0] == 1:
				print('NO')
			else:
				print('YES')
				print(A[0], A[1], int(a))
		else:
			print('NO')


import math

def find_factors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n //= 2
	for i in range(3, int(math.sqrt(n) + 1), 2):
		while n % i == 0:
			l.append(i)
			n //= i
	if n > 2:
		l.append(n)
	return l
for _ in range(int(input())):
	n = int(input())
	k0 = find_factors(n)
	k1 = list(dict.fromkeys(k0))
	if len(k1) == 1:
		if len(k0) <= 5:
			print('NO')
		else:
			print('YES')
			pro = 1
			for i in range(3, len(k0)):
				pro *= k0[i]
			print(k0[0], k0[1] * k0[2], pro)
	elif len(k1) == 2:
		if len(k0) <= 3:
			print('NO')
		else:
			pro = 1
			print('YES')
			for i in range(1, len(k0) - 1):
				pro *= k0[i]
			print(k0[0], k0[-1], pro)
	elif len(k1) == 3:
		b = [1, 1, 1]
		print('YES')
		for i in range(len(k0)):
			if k0[i] == k1[0]:
				b[0] *= k0[i]
			elif k0[i] == k1[1]:
				b[1] *= k0[i]
			else:
				b[2] *= k0[i]
		print(*b)
	else:
		m = k1[0]
		n = k1[1]
		k0.remove(m)
		k0.remove(n)
		pro = 1
		print('YES')
		for i in range(len(k0)):
			pro *= k0[i]
		print(m, n, pro)


def Find(n):
	for i in range(2, int(n ** 0.5) + 1):
		if not n % i:
			p = int(n / i)
			if p >= 2:
				for j in range(2, int(p ** 0.5) + 1):
					if i != j and (not p % j):
						k = int(p / j)
						if k >= 2 and i != k and (j != k):
							return 'YES\n' + str(i) + ' ' + str(j) + ' ' + str(k)
	return 'NO'

def main():
	t = int(input())
	outcome = [Find(int(input())) for _ in range(t)]
	print('\n'.join(outcome))
main()


for _ in range(int(input())):
	num = int(input())
	list1 = []
	j = 2
	while j * j < num and len(list1) < 2:
		if num % j == 0:
			num = num // j
			list1.append(j)
		j += 1
	if len(list1) == 2 and num not in list1:
		print('YES')
		for k in list1:
			print(k, end=' ')
		print(num)
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	(c1, c2) = (0, 0)
	arr = []
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			arr.append(j)
			c1 = 1
			n = n // j
			store = j
			break
	if c1 == 1:
		for j in range(store + 1, int(math.sqrt(n)) + 1):
			if n % j == 0:
				arr.append(j)
				arr.append(n // j)
				if arr[2] == arr[1]:
					arr.pop()
				break
	if len(arr) == 3:
		print('YES')
		print(arr[0], end=' ')
		print(arr[1], end=' ')
		print(arr[2])
	else:
		print('NO')


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
t = inp(1)
while t:
	t -= 1
	n = inp(1)
	a = b = c = 0
	i = 2
	while i * i < n:
		if n % i == 0:
			a = i
			n //= a
			break
		i += 1
	if n != 1 and a != 0:
		i = a + 1
		while i * i < n:
			if n % i == 0:
				b = i
				n //= b
				break
			i += 1
		if n != 1 and b != 0:
			c = n
			print('YES')
			print(a, b, c)
		else:
			print('NO')
	else:
		print('NO')


def getprod(n):
	res = []
	i = 1
	while i * i <= n:
		if n % i == 0:
			res.append(i)
			if n // i != i:
				res.append(n // i)
		i += 1
	return res
for _ in range(int(input())):
	num = int(input())
	res = getprod(num)
	if len(res) <= 2:
		print('NO')
	else:
		res.sort()
		(a, b, c) = (-1, -1, -1)
		i = 0
		n = len(res)
		flag = 0
		while i < n:
			(j, k) = (i + 1, n - 1)
			while j < k:
				x = res[i] * res[j] * res[k]
				if x == num and res[i] >= 2 and (res[j] >= 2) and (res[k] >= 2):
					(a, b, c) = (res[i], res[j], res[k])
					flag = 1
					break
				elif x < num:
					j += 1
				else:
					k -= 1
			if flag == 1:
				break
			i += 1
		if a == -1:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


kl = int(input())
for l in range(kl):
	pr = 0
	n = int(input())
	t = int(n ** 0.5)
	a = []
	for i in range(2, t + 1):
		if n % i == 0:
			a += [i]
			n = n // i
		if len(a) == 2:
			pr = 1
			break
	if pr and a[1] < n:
		print('YES')
		print(a[0], a[1], n)
	else:
		print('NO')


from math import sqrt
n = int(input())
for i in range(n):
	f = int(input())
	a = []
	for j in range(2, int(sqrt(f))):
		if f % j == 0:
			a.append(j)
			f = f // j
		if len(a) == 2:
			break
	if len(a) == 2 and a.count(f) == 0:
		print('YES')
		print(a[0], a[1], f)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	a = []
	s = round(math.sqrt(n))
	for i in range(2, s + 1):
		if len(a) == 2:
			if n not in a:
				a.append(n)
				break
		elif n % i == 0:
			a.append(i)
			n = n // i
	if len(a) == 3:
		print('Yes')
		for j in range(0, 3):
			print(a[j], end=' ')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = n
	for i in range(2, 35000):
		if n % i == 0:
			a = i
			break
	n //= a
	b = n
	for i in range(2, 35000):
		if n % i == 0 and a != i:
			b = i
			break
	n //= b
	if n == 1 or n == a or n == b:
		print('NO')
	else:
		print('YES')
		print(a, b, n)


import math
t = int(input())
for zxx in range(t):
	n = int(input())
	l = []
	k = int(0)
	for i in range(2, int(math.sqrt(n))):
		if n % i == 0:
			n = n // i
			l.append(i)
			k = i
			if len(l) == 2:
				break
		elif i > n:
			break
		else:
			k = i
	if len(l) == 2:
		if n > i:
			l.append(n)
			print('YES')
			for x in l:
				print(x, end=' ')
			print()
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin
from functools import reduce

def solve():
	for _ in range(int(stdin.readline())):
		n = int(stdin.readline())
		(flag, a1, a2, a3, tmp) = (0, 0, 0, 0, 0)
		for i in range(2, int(n ** 0.5) + 1):
			if flag == 1:
				break
			if n % i == 0:
				tmp = n // i
				a1 = i
				for j in range(2, int(tmp ** 0.5) + 1):
					if tmp % j == 0:
						a2 = j
						a3 = tmp // j
						if a1 != a2 and a2 != a3 and (a3 != a1):
							flag = 1
							break
		if flag == 1:
			print('YES')
			print(a1, a2, a3, sep=' ')
		else:
			print('NO')
solve()


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
input = lambda : stdin.readline().strip()
print = lambda s: stdout.write(s)
primes = []

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			primes.append(p)
SieveOfEratosthenes(10 ** 6)
t = int(input())
for _ in range(t):
	n = int(input())
	ls = []
	for i in primes:
		if n % i == 0:
			ls.append(i)
		if len(ls) == 2:
			break
	if len(ls) == 0:
		print('NO\n')
	elif len(ls) >= 2:
		if n // (ls[0] * ls[1]) in ls or n // (ls[0] * ls[1]) == 1:
			print('NO\n')
		else:
			print('YES\n')
			print(str(ls[0]) + ' ' + str(ls[1]) + ' ' + str(n // (ls[0] * ls[1])) + '\n')
	elif n == ls[0] or n == ls[0] ** 2 or n == ls[0] ** 3 or (n == ls[0] ** 4) or (n == ls[0] ** 5):
		print('NO\n')
	else:
		copy = n
		cnt = 0
		while copy % ls[0] == 0:
			copy //= ls[0]
			cnt += 1
		if cnt >= 3:
			print('YES\n')
			print(str(ls[0]) + ' ' + str(ls[0] ** 2) + ' ' + str(n // ls[0] ** 3) + '\n')
		else:
			print('NO\n')


import math

def primeFactors(n, d):
	while n % 2 == 0:
		try:
			if d[2] >= 0:
				d[2] += 1
		except:
			d[2] = 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			try:
				if d[int(i)] >= 0:
					d[int(i)] += 1
			except:
				d[int(i)] = 1
			n = n / i
	if n > 2:
		d[int(n)] = 1
	return d
t = int(input())
for r in range(t):
	n = int(input())
	d = primeFactors(n, {})
	if len(d) < 3:
		try:
			if d[n] >= 0:
				print('NO')
		except:
			if len(d) == 1:
				a = 1
				for i in d:
					a = i
				if d[a] < 6:
					print('NO')
				else:
					print('YES')
					s = str(a) + ' ' + str(int(a ** 2)) + ' ' + str(int(a ** (d[a] - 3)))
					print(s)
			else:
				summ = 0
				temp = []
				for i in d:
					summ += d[i]
					temp.append(i)
				if summ <= 3:
					print('NO')
				else:
					print('YES')
					a = temp[0]
					b = temp[1]
					s = str(int(a)) + ' ' + str(int(b)) + ' '
					tempd = int(a ** (d[a] - 1)) * int(b ** (d[b] - 1))
					s += str(int(tempd))
					print(s)
	else:
		l = []
		for i in d:
			l.append(i)
		print('YES')
		s = str(int(l[0] ** d[l[0]])) + ' ' + str(int(l[1] ** d[l[1]])) + ' '
		temp = 1
		for i in range(2, len(l)):
			temp *= int(l[i] ** d[l[i]])
		s += str(int(temp))
		print(s)


import sys
input = sys.stdin.readline

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

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		d = make_divisors(N)
		if len(d) <= 2:
			print('NO')
			continue
		fl = False
		for i in d:
			if i == 1 or i == N:
				continue
			f = make_divisors(N // i)
			if len(f) <= 2:
				continue
			for j in f:
				if j == 1 or j == N // i:
					continue
				k = N // i // j
				if k != i and j != i and (k != j):
					print('YES')
					print(i, j, k)
					fl = True
					break
			if fl:
				break
		if not fl:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	factors = []
	i = 2
	while i * i <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	if len(factors) < 3:
		print('NO')
	else:
		i = 0
		a = factors[i]
		i += 1
		b = factors[i]
		i += 1
		while i < len(factors) and b == a:
			b *= factors[i]
			i += 1
			if b != a:
				break
		if i == len(factors):
			print('NO')
		else:
			c = factors[i]
			i += 1
			while i < len(factors):
				c *= factors[i]
				i += 1
			if c != a and c != b:
				print('YES')
				print(a, b, c)
			else:
				print('NO')


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

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

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

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

def sin():
	return input()

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

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		a = []
		c = 0
		for i in range(2, int(math.sqrt(n)) + 5):
			if c == 2:
				break
			if n % i == 0:
				a.append(i)
				n = n // i
				c += 1
		if n > 1:
			a.append(n)
		a = list(set(a))
		if len(a) == 3:
			print('YES')
			print(*a)
		else:
			print('NO')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

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

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

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

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

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

class IOWrapper(IOBase):

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

class ostream:

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

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


T = int(input().strip())
import math
for t in range(T):
	N = int(input().strip())
	status = True
	for a in range(2, int(math.sqrt(N) + 1)):
		if N % a == 0:
			b = N // a
			for x in range(2, int(math.sqrt(b) + 1)):
				if x != a and b % x == 0 and (a != b // x) and (x != b // x):
					print('YES')
					print(a, x, b // x)
					status = False
					break
		if status == False:
			break
	if status == True:
		print('NO')


def three_nums(n):
	ret = []
	i_max = int(n ** 0.5 + 0.5)
	remainder = n
	cnt = 0
	for i in range(2, i_max + 1):
		if remainder % i == 0:
			ret.append(i)
			remainder //= i
			i_max = int(remainder ** 0.5 + 0.5)
			cnt += 1
			if cnt == 2:
				ret.append(remainder)
				break
	if len(ret) != 3 or ret[1] >= ret[2]:
		return None
	return ret
t = int(input())
for _ in range(t):
	n = int(input())
	xs = three_nums(n)
	if xs is not None:
		print('YES')
		print(*xs)
	else:
		print('NO')


def helper(n):
	upper = int(n ** 0.5) + 1
	for i in range(2, upper):
		if n % i == 0:
			curr = n // i
			for j in range(i + 1, upper):
				if curr % j == 0:
					new_curr = curr // j
					if i < j < new_curr:
						return [i, j, new_curr]
	return []
count = int(input())
for _ in range(count):
	ans = helper(int(input()))
	if len(ans) != 3:
		print('NO')
	else:
		print('YES')
		for val in ans:
			print(val, end=' ')
		print()


from math import sqrt, ceil

def s(y, x=0):
	for i in range(2, ceil(sqrt(y))):
		n = y // i
		if y % i == 0 and i != x and (n != x) and (i != n):
			return (i, n)
	else:
		return (0, 0)
for i in range(int(input())):
	(x, y) = s(int(input()))
	(y, z) = s(y, x)
	if y == z:
		print('NO')
	else:
		print('YES')
		print(x, y, z)


t = int(input())
for i in range(0, t):
	n = int(input())
	l = int(n ** (1 / 3))
	a = 1
	for k in range(2, l + 1):
		if n % k == 0:
			a = k
			break
	b = 1
	c = 1
	if a == 1:
		print('NO')
	else:
		m = n / a
		l = int(m ** (1 / 2))
		for k in range(a + 1, l + 1):
			if m % k == 0:
				b = k
				c = int(m / b)
				break
		if a != 1 and b != 1 and (c != 1) and (c != b):
			print('YES')
			print(a, b, c)
		else:
			print('NO')


from sys import stdin
from _collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from _collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop

def solve(n):
	la = []
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i != i:
				la.append((i, n // i))
	return la
t = int(input())
for _ in range(t):
	n = int(input())
	l = solve(n)
	flag = 0
	(x, y, z) = (-1, -1, -1)
	for (a, b) in l:
		la = solve(a)
		flag = 0
		for (c, d) in la:
			if b != c and b != d:
				x = b
				y = c
				z = d
				flag = 1
				break
		if flag:
			break
		la = solve(b)
		for (c, d) in la:
			if a != c and a != d:
				x = a
				y = c
				z = d
				flag = 1
				break
		if flag:
			break
	if x * y * x > 0:
		print('YES')
		print(x, y, z)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	m = n
	l = []
	t = 1
	f = 0
	g = 0
	if n < 8:
		print('NO')
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				if not l:
					l.append(i)
					f = 1
					break
		if f == 1:
			n = n // l[-1]
			for i in range(l[-1], int(n ** 0.5) + 1):
				while n % i == 0:
					if l[-1] == t * i:
						t = t * i
					else:
						l.append(t * i)
						n = n // i
						g = 1
						break
					n = n // i
				if g == 1:
					break
			if len(l) < 2:
				if t == 1 or t == l[-1]:
					print('NO')
				else:
					l.append(t)
					m = m // (l[0] * l[1])
					if m >= 2:
						l.append(m)
					s = set(l)
					if len(s) < len(l) or len(l) <= 2:
						print('NO')
					else:
						print('YES')
						print(' '.join(map(str, l)))
			else:
				m = m // (l[0] * l[1])
				if m >= 2:
					l.append(m)
				s = set(l)
				if len(s) < len(l) or len(l) <= 2:
					print('NO')
				else:
					print('YES')
					print(' '.join(map(str, l)))
		else:
			print('NO')


import math

def primeFactors(n):
	vals = []
	two = False
	while n % 2 == 0:
		vals.append(int(n))
		if not two:
			vals.append(2)
			two = True
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			vals.append(int(n))
			vals.append(i)
			n = n / i
	if n > 2:
		vals.append(int(n))
	if len(vals) != 0:
		vals.pop(0)
	vals.sort()
	i = 1
	while i < len(vals):
		if vals[i - 1] == vals[i]:
			del vals[i]
		else:
			i += 1
	return vals

def find3(number):
	factors = primeFactors(number)
	if len(factors) == 0:
		return []
	finalFactors = [factors[0]]
	newNumber = int(number / factors[0])
	factors = primeFactors(newNumber)
	if len(factors) == 0:
		return finalFactors
	pos = 0
	if factors[pos] == finalFactors[0]:
		newFound = False
		while not newFound:
			if factors[pos] != finalFactors[0]:
				newFound = True
			else:
				pos += 1
				if pos >= len(factors):
					return finalFactors
	if len(factors) == 0:
		finalFactors.append(newNumber)
		return finalFactors
	finalFactors.append(factors[pos])
	newNumber = int(newNumber / factors[pos])
	for elem in finalFactors:
		if newNumber == elem:
			return finalFactors
	finalFactors.append(newNumber)
	return finalFactors

def solve(number):
	ans = find3(number)
	for i in range(len(ans)):
		ans[i] = str(ans[i])
	if len(ans) == 3:
		print('YES')
		p = ' '.join(ans)
		print(p)
	else:
		print('NO')
input()
while True:
	try:
		val = int(input())
		solve(val)
	except EOFError:
		break


for _ in range(int(input())):
	n = int(input())
	(k, j) = (2, 0)
	a = []
	while j < 2 and k * k < n:
		if n % k == 0:
			a.append(k)
			n = n // k
			j += 1
		k += 1
	if j != 2:
		print('NO')
	elif a[1] != n:
		print('YES')
		a.append(n)
		print(*a)
	else:
		print('NO')


for tin in range(int(input())):
	n = int(input())
	f = n
	k = 0
	for i in range(2, int(n ** 0.5) + 1):
		if f % i == 0 and f // i != i:
			a = i
			f = f // i
			for j in range(i + 1, int(f ** 0.5) + 1):
				if f % j == 0 and f // j != j:
					b = j
					c = f // j
					k = 1
					print('YES')
					print(a, b, c)
					break
		if k == 1:
			break
	if k == 0:
		print('NO')


def divisors(n):
	i = 2
	while i * i * i < n:
		if n % i == 0:
			d = n // i
			j = i + 1
			while j * j < d:
				if d % j == 0:
					return [i, j, d // j]
				else:
					j += 1
			else:
				i += 1
		else:
			i += 1
	else:
		return [-1]
t = int(input())
for i in range(t):
	n = int(input())
	array = divisors(n)
	if array == [-1]:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, array)))


def solution(n):
	for first_dis in range(2, int(n ** 0.5) + 1):
		if n % first_dis == 0:
			next_value = n // first_dis
			for second_dis in range(first_dis + 1, int(next_value ** 0.5) + 1):
				if next_value % second_dis == 0:
					third = next_value // second_dis
					if third != second_dis:
						return ('YES', f'{first_dis} {second_dis} {third}')
	return ('NO',)

def read():
	cnt = int(input())
	for _ in range(cnt):
		value = int(input())
		for item in solution(value):
			print(item)
read()


for _ in range(int(input())):
	n = int(input())
	X = set()
	x = 1
	for d in range(2, 1 + int(n ** 0.5)):
		while not n % d:
			x *= d
			n //= d
			if len(X) < 2 and x not in X:
				X.add(x)
				x = 1
	X.add(n * x)
	if len(X) < 3 or 1 in X:
		print('NO')
	else:
		print('YES')
		print(*X)


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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
for _ in range(int(ri())):
	n = int(ri())
	p = 2
	flag = False
	ans = []
	while p * p <= n:
		if n % p == 0:
			ans.append(p)
			n = n // p
			p += 1
			while p * p <= n:
				if n % p == 0 and n // p not in ans and (n // p != p):
					ans.append(p)
					ans.append(n // p)
					flag = True
					break
				p += 1
		if flag:
			break
		p += 1
	if flag:
		YES()
		print(*ans)
	else:
		NO()


t = int(input())
for i in range(0, t):
	n = int(input())
	tmp = n
	lst = []
	j = 2
	while j * j <= n:
		if tmp % j == 0:
			tmp = int(tmp / j)
			lst.append(j)
			if len(lst) >= 2:
				if tmp > j:
					lst.append(tmp)
				break
		j = j + 1
	if len(lst) == 3:
		print('YES')
		print(lst[0], ' ', lst[1], ' ', lst[2])
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b, c) = (0, 0, 0)
	i = 1
	while i < n and i < 10 ** 4:
		i += 1
		if n % i == 0:
			n = n // i
			if a == 0:
				a = i
			elif b == 0:
				b = i
				c = n
				break
	if c > 2 and b != c and (c != a):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math as m
t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	c = 0
	for j in range(2, int(m.sqrt(n)) + 1):
		if n % j == 0:
			a = j
			n = n / j
			break
	for k in range(a + 1, int(m.sqrt(n)) + 1):
		if n % k == 0:
			b = k
			c = n / k
			break
	if a > 1 and b > 1 and (c > 1) and (a != b and a != c and (b != c)):
		print('YES')
		print(int(a), int(b), int(c))
	else:
		print('NO')


from math import floor, sqrt, ceil
t = int(input())
for _ in range(t):
	a = -1
	b = -1
	n = int(input())
	i = 2
	while i * i < n:
		if n % i == 0:
			a = i
			n //= a
			break
		i += 1
	i = 2
	while i * i < n:
		if n % i == 0 and i != a:
			b = i
			n //= b
			break
		i += 1
	if a == -1 or b == -1 or n == 1 or (n == a) or (n == b):
		print('NO')
		continue
	print('YES')
	print(a, b, n)


for _ in range(int(input())):
	n = int(input())
	sq = int(n ** 0.5 + 1)
	a = []
	d = {}
	for i in range(2, sq):
		if n % i == 0:
			x = n // i
			a.append(i)
			d[i] = x
			d[x] = i
	ch = 1
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			try:
				x = d[a[i] * a[j]]
				y = a[i]
				z = a[j]
				if x != y and x != z:
					ch = 2
					break
			except:
				continue
		if ch == 2:
			break
	if ch == 2:
		print('YES')
		print(x, y, z)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	r = int(n ** 0.5) + 1
	ans = []
	for i in range(2, r):
		if n % i == 0:
			n //= i
			ans.append(i)
			if len(ans) == 2:
				break
	if len(ans) == 2:
		if n in ans:
			print('NO')
		else:
			print('YES')
			print(*ans, n)
	else:
		print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	l = []
	s = int(n ** 0.5) + 1
	for i in range(2, s):
		if n % i == 0:
			l.append(i)
			n //= i
		if len(l) == 2:
			if l[1] != n and l[0] != n:
				l.append(n)
				break
	if len(l) == 3:
		print('YES')
		print(*l)
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict
import math

def main():
	for _ in range(int(input())):
		n = int(input())
		data = defaultdict(lambda : 0)
		for x in range(2, math.floor(math.sqrt(n)) + 1):
			if n % x == 0:
				while n % x == 0:
					n = n // x
					data[x] = data[x] + 1
		if n != 1:
			data[n] += 1
		ele = []
		if len(data.keys()) >= 3:
			for (x, y) in data.items():
				if len(ele) == 3:
					ele[2] *= x ** y
				else:
					ele.append(x ** y)
			print('YES')
			print(*ele)
		elif len(data.keys()) == 2:
			dat = sorted(data.items(), key=lambda x: x[0])
			if dat[0][1] >= 3:
				ele.append(dat[0][0])
				ele.append(dat[0][0] ** (dat[0][1] - 1))
				ele.append(dat[1][0] ** dat[1][1])
				print('YES')
				print(*ele)
			elif dat[1][1] >= 3:
				ele.append(dat[1][0])
				ele.append(dat[1][0] ** (dat[1][1] - 1))
				ele.append(dat[0][0] ** dat[0][1])
				print('YES')
				print(*ele)
			elif dat[0][1] >= 2 and dat[1][1] >= 2:
				ele.append(dat[0][0])
				ele.append(dat[1][0])
				ele.append(dat[1][0] ** (dat[1][1] - 1) * dat[0][0] ** (dat[0][1] - 1))
				print('YES')
				print(*ele)
			else:
				print('NO')
		elif len(data.keys()) == 1:
			done = False
			for (x, y) in data.items():
				if y >= 6:
					print('YES')
					print(x, x ** 2, x ** (y - 3))
				else:
					print('NO')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


import math

def div(n, r):
	sq = math.sqrt(n)
	d = 1
	for x in range(2, int(sq) + 1):
		if n % x == 0 and x != r:
			d = x
			break
	return d
t = int(input())
for i in range(0, t):
	y = int(input())
	a = div(y, 1)
	if a == 1:
		print('NO')
		continue
	else:
		z = int(y / a)
		b = div(z, a)
		if b == 1 or b == a:
			print('NO')
			continue
		else:
			c = int(y / (a * b))
			if c == 1 or c == a or c == b:
				print('NO')
				continue
			else:
				print('YES')
				print(a, b, c)


t = int(input())
while t != 0:
	n = int(input())
	p = int(pow(n, 0.5))
	(a, b, c) = (-1, -1, -1)
	for i in range(2, p + 1):
		if n % i == 0:
			a = i
			n = n // i
			break
	q = int(pow(n, 0.5))
	for i in range(2, q + 1):
		if i != a and n % i == 0 and (i != n // i):
			b = i
			c = n // i
			break
	if a != -1 and b != -1 and (c != -1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')
	t -= 1


for tc in range(int(input())):
	n = int(input())
	a = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			a.append(i)
			if n // i != i:
				a.append(n // i)
	a.sort()
	if len(a) < 3:
		print('NO')
	else:
		flag = 0
		for i in range(len(a)):
			for j in range(i + 1, len(a)):
				k = n // (a[i] * a[j])
				if k in a and k != a[i] and (k != a[j]):
					print('YES')
					print(k, a[i], a[j])
					flag = 1
					break
			if flag:
				break
		if not flag:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ok = True
	if n < 24:
		ok = False
	i = 1
	j = 1
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			n = n // i
			break
		if i == int(n ** 0.5):
			ok = False
	if i + 1 > int(n ** 0.5):
		ok = False
	for j in range(i + 1, int(n ** 0.5) + 1):
		if n % j == 0:
			n = n // j
			break
		if j == int(n ** 0.5):
			ok = False
	if ok and n > j:
		print('YES')
		print(i, j, n)
	else:
		print('NO')


from math import *
for i in range(int(input())):
	n = int(input())
	j = 2
	count = 0
	num = []
	while j ** 2 <= n:
		if n % j == 0:
			if len(num) == 1:
				if n % (j * num[0]) != 0:
					j += 1
					continue
			num.append(j)
			count += 1
		if count == 2:
			break
		j += 1
	if count < 2:
		print('NO')
		continue
	if count == 2:
		val = n // (num[0] * num[1])
		if val in num:
			print('NO')
			continue
		if val * num[0] * num[1] != n:
			print('NO')
			continue
		print('YES')
		print(num[0], num[1], val)


import math

def prime(n):
	flag = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			flag = 1
			break
	if flag != 1:
		return 1
	else:
		return 0
t = int(input())
while t != 0:
	n = int(input())
	n1 = n
	flag = 0
	if prime(n) == 0 and n >= 24:
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				a = i
				break
		if prime(n // a) == 0:
			n = n // a
			for i in range(2, int(math.sqrt(n)) + 1):
				if n % i == 0 and i != a and (n // i != a) and (n // i != i):
					b = i
					c = n // b
					flag = 1
					break
	if flag != 0 and a >= 2 and (b >= 2) and (c >= 2) and (a * b * c == n1):
		print('YES')
		print(a, b, c)
	else:
		print('NO')
	t -= 1


import math
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	i = 2
	(a, b, c) = (-1, -1, -1)
	while i * i <= n:
		while n % i == 0:
			n //= i
			if a == -1:
				a = i
			elif b == -1 or a == b:
				if b == -1:
					b = i
				else:
					b *= i
			elif c == -1:
				c = i
			else:
				c *= i
		i += 1
	if n > 1:
		if c == -1:
			c = n
		else:
			c *= n
	if min(a, b, c) == -1 or b == c or a == b or (a == c):
		print('NO')
	else:
		print('YES')
		print(a, b, c)


from functools import reduce

def fac(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
t = int(input())
for i in range(t):
	n = int(input())
	x = fac(n)
	x = x[1:-1]
	flag = 1
	if len(x) < 3:
		flag = 0
	else:
		(a, b) = (x[0], 0)
		for j in range(1, len(x)):
			if n % (a * x[j]) == 0:
				b = x[j]
				break
		if b:
			te = a * b
			if n % te == 0:
				c = n // te
				if a != b and a != c and (b != c) and (a >= 2) and (b >= 2) and (c >= 2):
					pass
				else:
					flag = 0
			else:
				flag = 0
		else:
			flag = 0
	if flag:
		pass
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math

def primeFactors(n):
	temp = []
	while n % 2 == 0:
		temp.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			temp.append(i)
			n = n / i
	if n > 2:
		temp.append(int(n))
	return temp
t = int(input())
while t:
	t += -1
	n = int(input())
	prime = primeFactors(n)
	if len(prime) < 3:
		print('NO')
	else:
		prime.sort()
		ans = [prime[0]]
		if prime[0] == prime[1]:
			ans.append(prime[1] * prime[2])
			p = 1
			for i in range(3, len(prime)):
				p *= prime[i]
			if p != 1:
				ans.append(p)
			if len(set(ans)) != 3:
				print('NO')
			else:
				print('YES')
				print(*ans)
		else:
			ans.append(prime[1])
			p = 1
			for i in range(2, len(prime)):
				p *= prime[i]
			if p != 1:
				ans.append(p)
			if len(set(ans)) != 3:
				print('NO')
			else:
				print('YES')
				print(*ans)


import sys
ip = lambda : sys.stdin.readline().rstrip()
for _ in range(int(ip())):
	n = int(ip())
	ans = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			v = n // i
			for j in range(2, int(v ** 0.5) + 1):
				if v % j == 0:
					st = set([i, j, v // j])
					if len(st) == 3:
						ans = sorted([i, j, v // j])
						break
			if ans != []:
				break
	if ans != []:
		print('YES')
		print(*ans)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			a.append(i)
			if n // i != i:
				a.append(n // i)
		i += 1
	flag = 0
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			for k in range(j + 1, len(a)):
				if a[i] * a[j] * a[k] == n and len(set([a[i], a[j], a[k]])) == 3:
					print('YES')
					print(str(a[i]) + ' ' + str(a[j]) + ' ' + str(a[k]))
					flag = 1
					break
			if flag:
				break
		if flag:
			break
	if flag == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	c = 0
	s = 0
	ss = 0
	nn = int(n ** 0.5)
	for i in range(2, nn):
		if n % i == 0:
			a = i
			ss = 50
			break
	if ss == 0:
		print('NO')
		continue
	ss = 0
	for i in range(a + 1, nn):
		if n / a % i == 0:
			b = i
			ss = 50
			break
	if ss == 0:
		print('NO')
		continue
	if n / (a * b) > b:
		print('YES')
		print(a, b, int(n / (a * b)))
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, j) = (1, 1, 1, 0)
	flag = 1
	num = int(input())
	for j in range(2, int(num ** 0.5)):
		if num % j == 0:
			a = j
			break
	num = num // a
	for k in range(j + 1, num + 1):
		if k > num ** 0.5:
			break
		if num % k == 0:
			b = k
			break
	if num % b == 0 and b != int(num / b) and (a != int(num / b)):
		c = int(num / b)
		flag = 0
	if a != 1 and b != 1 and (c != 1):
		print('YES')
		print('{0:} {1:} {2:}'.format(a, b, c))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = set()
	for i in range(2, int(pow(n, 0.5)) + 1):
		if n % i == 0:
			s.add(i)
			s.add(n // i)
	l1 = list(s)
	n1 = len(l1)
	if n1 < 3:
		print('NO')
	else:
		flag = 0
		for i in range(n1 - 2):
			if flag == 1:
				break
			for j in range(i + 1, n1 - 1):
				if flag == 1:
					break
				for k in range(j + 1, n1):
					v = l1[i] * l1[j] * l1[k]
					if n == v:
						flag = 1
						print('YES')
						print(l1[i], l1[j], l1[k])
						break
		if flag == 0:
			print('NO')


import math

def factorize(n):
	i = 2
	s = int(math.sqrt(n))
	f = dict()
	while n > 1:
		if i > s:
			f[i] = 1
			return f
		if n % i == 0:
			f[i] = f.get(i, 0) + 1
			n //= i
		else:
			i += 1
	return f
t = int(input())
for _ in range(t):
	n = int(input())
	f = factorize(n)
	if len(f) == 1:
		x = list(f.keys())[0]
		if f[x] >= 6:
			print('YES')
			print(int(x), int(x ** 2), int(x ** (f[x] - 3)))
		else:
			print('NO')
	elif len(f) == 2:
		x = list(f.keys())
		(x1, x2) = (x[0], x[1])
		if f[x1] == 2 and f[x2] == 2:
			print('YES')
			print(int(x1), int(x2), int(x1 * x2))
		elif f[x1] >= 3:
			print('YES')
			print(int(x1), int(x1 * x1), int(n // x1 ** 3))
		elif f[x2] >= 3:
			print('YES')
			print(int(x2), int(x2 * x2), int(int(n // x2 ** 3)))
		else:
			print('NO')
	else:
		print('YES')
		x = list(f.keys())
		print(int(x[0]), int(x[1]), n // (x[0] * x[1]))


import math as mt
n = int(input())
i = 0
while i < n:
	case = int(input())
	n1 = case
	(a, b, c) = (1, 1, 1)
	divisor = []
	for p in range(2, mt.ceil(mt.sqrt(case + 1))):
		if len(divisor) == 2:
			divisor.append(int(n1 / (divisor[0] * divisor[1])))
			break
		elif case % p == 0:
			divisor.append(p)
			case /= p
	try:
		(a, b, c) = tuple(divisor)
	except ValueError:
		(a, b, c) = (1, 1, 1)
	if a == 1 or b == 1 or c == 1 or (a == c) or (a == b) or (b == c):
		ans = False
	else:
		ans = True
	if ans:
		print('YES')
		print(a, b, c)
	else:
		print('NO')
	i += 1


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

def solve():
	f = factors(n)
	s = set()
	i = 0
	x = 1
	for i in f:
		if i not in s:
			s.add(i)
			if len(s) == 2:
				break
		else:
			x *= i
			if x != 1 and x not in s:
				s.add(x)
				if len(s) == 2:
					break
				x = 1
	ss = list(s)
	r = n // (ss[0] * ss[1]) if len(ss) == 2 else 1
	if len(s) == 2 and r != 1 and (r != ss[0]) and (r != ss[1]):
		s.add(r)
	if len(s) >= 3:
		print('YES')
		print(' '.join(map(str, list(s)[:3])))
	else:
		print('NO')

def main():
	global n
	for _ in range(int(input())):
		n = int(input())
		solve()
main()


from __future__ import division, print_function
import os
import sys
from collections import Counter
from io import BytesIO, IOBase
from math import gcd
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		f = prime_factors(n)
		s = [-1, -1, -1]
		for (v, c) in f.items():
			if s[1] != -1:
				break
			if c > 2 and s[0] == -1:
				s[0] = v
				s[1] = v * v
			elif s[0] == -1:
				s[0] = v
			elif s[1] == -1:
				s[1] = v
		(a, b, c) = (s[0], s[1], n // (s[0] * s[1]))
		if a > 1 and b > 1 and (c > 1) and (a != c) and (b != c):
			print('YES')
			print(a, b, c)
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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


q = int(input())
for rwre in range(q):
	n = int(input())
	dz = []
	nn = n
	kan = 2
	while nn > 1 and kan ** 2 <= n:
		if nn % kan == 0:
			nn //= kan
			dz.append(kan)
		else:
			kan += 1
	if nn > 1:
		dz.append(nn)
	dz.append(52525425542542)
	roz = []
	for i in range(1, len(dz)):
		if dz[i] != dz[i - 1]:
			roz.append(dz[i - 1])
	dz.pop(-1)
	if len(roz) >= 3:
		print('YES')
		print(roz[0], roz[1], n // (roz[0] * roz[1]))
	else:
		if len(roz) == 1:
			a = roz[0]
			b = roz[0] ** 2
			c = n // roz[0] ** 3
			if c > 1 and c != b and (c != a):
				print('YES')
				print(a, b, c)
			else:
				print('NO')
		if len(roz) == 2:
			c = n // (roz[1] * roz[0])
			if c != roz[1] and c != roz[0] and (c > 1):
				print('YES')
				print(roz[0], roz[1], c)
			else:
				print('NO')


from sys import stdin, stdout
from collections import defaultdict
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	cases = rll()
	for line in stdin:
		n = int(line)
		ans = []
		for f1 in range(2, math.ceil(math.sqrt(n))):
			if n % f1 == 0:
				ans.append(f1)
				break
		if len(ans) == 0:
			stdout.write('NO\n')
			continue
		m = n // ans[0]
		for f2 in range(f1 + 1, math.ceil(math.sqrt(m))):
			if m % f2 == 0:
				ans.append(f2)
				break
		if len(ans) == 1:
			stdout.write('NO\n')
			continue
		(a, b) = (ans[0], ans[1])
		c = n // (a * b)
		if c not in {a, b}:
			stdout.write('YES\n')
			stdout.write(' '.join((str(x) for x in [a, b, c])))
			stdout.write('\n')
		else:
			stdout.write('NO\n')
	stdout.close()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b, c) = (0, 0, 0)
	flag = 0
	flg = 0
	cnt = 0
	mx = 2
	l = []
	if n < 24:
		print('NO')
	else:
		for _ in range(3):
			for i in range(mx, int(n ** 0.5) + 1):
				if n % i == 0:
					flg = 1
					break
			if flg == 0:
				print('NO')
				flag = 1
				break
			mx = i + 1
			n = n // i
			flg = 0
			if i < n:
				l.append(i)
				cnt += 1
			else:
				print('NO')
				flag = 1
				break
			if cnt == 2:
				l.append(n)
				break
		if flag == 0:
			print('YES')
			print(l[0], l[1], l[2])


def fun(n, start):
	for i in range(max(2, start), int(n ** 0.5) + 2):
		if n % i == 0:
			return i
T = int(input())
for t in range(T):
	n = int(input())
	(a, b, c) = (None, None, None)
	a = fun(n, 2)
	if a:
		b = fun(n // a, a + 1)
		if b:
			c = n // (a * b)
	if a and b and c and (a > 1) and (b > 1) and (c > 1) and (a != b) and (b != c) and (c != a):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


m = int(input())
for l in range(m):
	n = int(input())
	(q, t) = (int(n ** 0.5) + 1, 0)
	for i in range(2, q):
		if n % i == 0:
			a = n // i
			w = int(a ** 0.5) + 1
			for j in range(2, w):
				if a % j == 0:
					r = a // j
					if r != j and j != i and (r != i):
						print('YES')
						print(i, j, r)
						t = 1
						break
		if t:
			break
	if not t:
		print('NO')


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
for _ in range(int(stdin.readline())):
	x = int(stdin.readline())
	i = 2
	q = []
	while len(q) < 2 and i * i < x:
		if x % i == 0:
			q.append(i)
			x //= i
		i += 1
	if len(q) == 2 and x not in q:
		print('YES')
		print(*q, x)
	else:
		print('NO')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	f = 2
	A = B = C = -1
	f1 = []
	while f * f <= n:
		if n % f == 0:
			f1 += [f]
		f += 1
	nn = len(f1)
	for i in range(nn):
		for j in range(i + 1, nn):
			c = n // (f1[i] * f1[j])
			if c * f1[i] * f1[j] == n and c != f1[i] and (c != f1[j]):
				(A, B, C) = (f1[i], f1[j], c)
				break
	if A == -1:
		print('NO')
	else:
		print('YES')
		print(A, B, C)


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	n = int(sys.stdin.readline().rstrip())
	i = 2
	sol = []
	while i <= n ** (1 / 2):
		if n % i == 0:
			n = n // i
			sol.append(str(i))
		i += 1
		if len(sol) == 2:
			if str(n) not in sol and n != 1:
				sol.append(str(n))
				break
	if len(sol) == 3:
		print('YES')
		print(' '.join(sol))
	else:
		print('NO')


import math

def getFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	k = 3
	while k <= math.sqrt(n):
		if n % k == 0:
			n = n // k
			factors.append(k)
		else:
			k += 2
	if n > 1:
		factors.append(n)
	return factors
t = int(input())
numbers = [int(input()) for _ in range(t)]
for n in numbers:
	factors = getFactors(n)
	distinct = set()
	i = 0
	num = 1
	while i < len(factors):
		num *= factors[i]
		if len(distinct) == 2:
			pass
		elif num not in distinct:
			distinct.add(num)
			num = 1
		else:
			pass
		i += 1
	if num != 1:
		distinct.add(num)
	if len(distinct) == 3:
		print('YES')
		print(' '.join(map(str, sorted(list(distinct)))))
	else:
		print('NO')


def factor(n):
	ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			ans.append(d)
			n = n // d
		else:
			d += 1
	if n > 1:
		ans.append(n)
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	ans = factor(n)
	if len(ans) < 3:
		print('NO')
	else:
		a = ans[0]
		b = 1
		c = 1
		for i in range(1, len(ans)):
			if b <= a:
				b *= ans[i]
			else:
				c *= ans[i]
		if c == 1 or c == a or c == b:
			print('NO')
		else:
			print('YES')
			print(a, b, c)


def solve(x):
	factors = []
	i = 2
	while i * i < x:
		if x % i == 0:
			x //= i
			factors.append(i)
			if len(factors) == 2:
				break
		i += 1
	factors.append(x)
	if len(factors) == 3:
		print('YES')
		print(f'{factors[0]} {factors[1]} {factors[2]}')
	else:
		print('NO')

def main():
	t = int(input())
	for i in range(t):
		x = int(input())
		solve(x)
main()


import math

def primeFactors(n):
	d = {}
	while n % 2 == 0:
		try:
			d[2] += 1
		except:
			d[2] = 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			try:
				d[i] += 1
			except:
				d[i] = 1
			n = n // i
	if n > 2:
		try:
			d[n] += 1
		except:
			d[n] = 1
	return d
t = int(input())
while t:
	t -= 1
	n = int(input())
	d = primeFactors(n)
	flag = 0
	s = 0
	toprint = []
	if len(d) == 1:
		for i in d:
			if d[i] >= 6:
				flag = 1
				toprint = [i, i ** 2, i ** (d[i] - 3)]
	elif len(d) >= 3:
		flag = 1
		cnt = 0
		mul = 1
		for i in d:
			if cnt == 0:
				toprint.append(i ** d[i])
			elif cnt == 1:
				toprint.append(i ** d[i])
			else:
				mul *= i ** d[i]
			cnt += 1
		toprint.append(mul)
	elif len(d) == 2:
		keys = list(d.keys())
		if d[keys[0]] + d[keys[1]] > 3:
			flag = 1
			toprint = [keys[0], keys[1], keys[0] ** (d[keys[0]] - 1) * keys[1] ** (d[keys[1]] - 1)]
	if len(set(toprint)) < 3:
		flag = 0
	if flag:
		print('YES')
		for i in toprint:
			print(i, end=' ')
		print()
	else:
		print('NO')


from bisect import *
from collections import *

def factorize(n):
	(c, ans) = (2, [])
	while c * c < n:
		if n % c == 0:
			ans.append(c)
			ans.append(n // c)
		c += 1
	if c * c == n:
		ans.append(c)
	return sorted(ans)
for i in range(int(input())):
	n = int(input())
	a = factorize(n)
	(c, l, ans) = (defaultdict(int, Counter(a)), len(a), 'NO')
	for i in range(l):
		for j in range(i + 1, l):
			num = n / (a[i] * a[j])
			if c[num] and num not in [a[i], a[j]]:
				print('YES')
				print(*[a[i], a[j], int(num)])
				ans = 'YES'
				break
		if ans == 'YES':
			break
	if ans == 'NO':
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if n < 24:
		print('NO')
		continue
	j = -1
	(a, b) = (0, 0)
	for i in range(2, int(n ** (1 / 3)) + 1):
		if n % i == 0:
			a = i
			n //= i
			j = i + 1
			break
	if j == -1:
		print('NO')
		continue
	o = -1
	for i in range(j, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			b = i
			n //= i
			o = 1
			break
	if o == -1 or n <= b:
		print('NO')
		continue
	print('YES')
	print(a, b, n)


for _ in range(int(input())):
	n = int(input())
	flag = 0
	for i in range(2, 1001):
		if n % i == 0:
			a = i
			n //= i
			flag = 1
			break
	if flag == 0:
		print('NO')
	else:
		i = a + 1
		flag1 = 0
		while i * i <= n:
			if n % i == 0:
				if i != n // i:
					print('YES')
					print(a, i, n // i)
					flag1 = 1
					break
			i += 1
		if flag1 == 0:
			print('NO')


def sol(n):
	ans = []
	i = 2
	cnt = 0
	while n > 0 and i * i <= n:
		if not n % i:
			cnt += 1
			n //= i
			ans.append(i)
		i += 1
		if cnt >= 2:
			break
	tr = cnt >= 2 and n not in ans
	print('YES' if tr else 'NO')
	if tr:
		print(*ans[:2], n)
t = int(input())
for _ in range(t):
	n = int(input())
	res = sol(n)


def prime(n):
	if n == 1:
		return []
	if n == 2:
		return [2]
	i = 2
	while i * i <= n:
		if n % i == 0:
			return prime(n // i) + [i]
		i += 1
	return [n]
for _ in range(int(input())):
	n = int(input())
	a = sorted(prime(n))
	if len(set(a)) >= 3:
		print('YES')
		prod = 1
		for x in a[1:-1]:
			prod *= x
		print(a[0], prod, a[-1])
	if len(set(a)) == 2:
		if len(a) >= 4:
			print('YES')
			prod = 1
			for x in a[1:-1]:
				prod *= x
			print(a[0], prod, a[-1])
		else:
			print('NO')
	if len(set(a)) == 1:
		if len(a) >= 6:
			print('YES')
			print(a[0], a[0] * a[0], a[0] ** (len(a) - 3))
		else:
			print('NO')
	if a == []:
		print('NO')


import sys
import time
import math
start_time = time.time()
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	sqrtn = math.ceil(n ** 0.5)
	(a, b, c) = (1, 1, 1)
	mod = 2
	while True:
		if n == 1 or mod > sqrtn:
			break
		if n % mod == 0:
			if a == 1:
				a *= mod
			else:
				b *= mod
			n //= mod
			if a > 1 and b > 1 and (a != b):
				c = n
				break
		elif mod == 2:
			mod = 3
		else:
			mod += 2
	if a == 1 or b == 1 or c == 1 or (a == b) or (b == c) or (a == c):
		print('NO')
	else:
		print('YES')
		print(a, b, c)


from math import *
from operator import *

def isPrime(x):
	if x in [1, 4]:
		return False
	elif x in [2, 3, 5]:
		return True
	else:
		for i in range(2, int(sqrt(x)) + 1):
			if x % i == 0:
				return False
		return True

def Sieve(x):
	checkPrime = [1 for i in range(x + 1)]
	zz = 2
	L = []
	while zz ** 2 <= x:
		if checkPrime[zz] == 1:
			for i in range(zz * 2, x + 1, zz):
				checkPrime[i] = 0
		zz += 1
	for i in range(2, x):
		if checkPrime[i] == 1:
			L.append(i)
	return checkPrime
checkPrime = Sieve(100001)

def primeFactors(x):
	d = {}
	i = 0
	X = x
	while x % 2 == 0:
		x //= 2
		i += 1
	if i > 0:
		d[2] = i
	for i in range(3, int(sqrt(x)) + 1, 2):
		zz = 0
		while x % i == 0:
			x //= i
			zz += 1
		if zz > 0:
			d[i] = zz
	if x > 2:
		d[x] = 1
	return d
T = int(input())
for tt in range(T):
	x = int(input())
	if x % 2 != 0 and x % 3 != 0 and isPrime(x):
		print('NO')
	elif isPrime(x):
		print('NO')
	else:
		d = primeFactors(x)
		ans = [0, 0, 0]
		if len(d) > 2:
			print('YES')
			for i in d:
				if ans[0] == 0:
					ans[0] = i
				elif ans[1] == 0:
					ans[1] = i
				else:
					break
			ans[2] = x // (ans[0] * ans[1])
			print(*ans)
		elif len(d) == 1:
			for i in d:
				if d[i] < 6:
					print('NO')
				else:
					print('YES')
					print(i, i ** 2, x // (i * i ** 2))
		else:
			ans = [0] * 3
			d = sorted(d.items(), key=itemgetter(1))
			if d[0][1] >= 6:
				print('YES')
				i = d[0][0]
				print(i, i ** 2, x // (i * i ** 2))
			elif d[0][1] + d[1][1] >= 4:
				print('YES')
				print(d[0][0], d[1][0], x // (d[0][0] * d[1][0]))
			else:
				print('NO')


def f(n):
	i = 2
	v = []
	while i <= int(n ** (1 / 2)) + 1:
		if n % i == 0:
			v.append(i)
			n //= i
			if len(v) >= 2:
				if n not in v and n != 1:
					return (v[0], v[1], n)
				else:
					return False
		i += 1
	return False
for _ in range(int(input())):
	v = f(int(input()))
	if v == False:
		print('NO')
	else:
		print('YES')
		print(*v)


for _ in range(int(input())):
	n = int(input())
	l = []
	a = 2
	m = n
	while a * a <= n:
		if n % a == 0:
			l.append(a)
			n = n // a
			break
		a += 1
	b = 2
	while b * b <= n:
		if n % b == 0:
			if b not in l:
				l.append(b)
				n = n // b
				break
		b += 1
	if len(l) == 2:
		c = m // (l[0] * l[1])
		if c not in l:
			print('YES')
			print(l[0], l[1], c)
		else:
			print('NO')
	else:
		print('NO')


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	ans = []
	for i in range(2, int(sqrt(n)) + 1):
		if len(ans) == 2 and n > ans[-1]:
			ans.append(n)
			n = 1
			break
		elif n % i == 0:
			ans.append(i)
			n //= i
		if n == 1:
			break
		if len(ans) and n <= ans[-1]:
			break
	if n != 1 or len(ans) < 3:
		print('NO')
	else:
		print('YES')
		prod = 1
		for i in range(2, len(ans)):
			prod *= ans[i]
		print(ans[0], ans[1], prod)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

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

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

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

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

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

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

class Prime:

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

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

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

	def divisions(self, n):
		if n in self.ds_memo:
			return self.ds_memo[n]
		for c in self.T:
			if n % c == 0:
				rs = set([c])
				for cc in self.divisions(n // c):
					rs.add(cc)
					rs.add(cc * c)
				self.ds_memo[n] = rs
				return rs
		rs = set([1, n])
		self.ds_memo[n] = rs
		return rs

	def sowa(self, n):
		r = 1
		for (k, v) in self.division(n):
			t = 1
			for i in range(1, v + 1):
				t += math.pow(k, i)
			r *= t
		return r

def main():
	t = I()
	pr = Prime(10 ** 10)
	rr = []
	for _ in range(t):
		n = I()
		ds = sorted(pr.division(n))
		r = []
		if len(ds) == 1:
			(k, v) = ds[0]
			if v < 6:
				rr.append('NO')
				continue
			r = [k, k ** 2, k ** (v - 3)]
		else:
			t = n // ds[0][0]
			t //= ds[1][0]
			if t < 2 or t == ds[0][0] or t == ds[1][0]:
				rr.append('NO')
				continue
			r = [ds[0][0], ds[1][0], t]
		rr.append('YES')
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


import math

def factor(b, n):
	d = math.ceil(math.sqrt(n))
	for i in range(b, d + 1):
		if n % i == 0:
			return i
	return
for _ in range(int(input())):
	n = int(input())
	ans = True
	(a, b, c) = (None, None, None)
	a = factor(2, n)
	if a != None:
		b = factor(a + 1, n // a)
		if b != None:
			c = n // (a * b)
		else:
			ans = False
	else:
		ans = False
	if not ans:
		print('NO')
	elif a == b or b == c or c == a:
		print('NO')
	else:
		print('YES')
		print(a, b, c)


import sys
sys.setrecursionlimit(10 ** 9)
import atexit
import io
from collections import defaultdict, Counter
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
IA = lambda : map(int, input().split())
ans = [0, 0, 0, 0]

def solve(n):
	num = int(0)
	i = int(2)
	tmp = 1
	m = n
	while i * i <= n:
		if n % i == 0:
			n = n // i
			tmp *= i
			if tmp not in ans:
				num += 1
				ans[num] = tmp
				tmp = 1
				if num >= 3:
					ans[num] *= n
					return 1
		i += 1
	if n > 1:
		if tmp * n not in ans:
			num += 1
			ans[num] = n * tmp
	if num >= 3:
		return 1
	else:
		return -1
T = int(input())
for t in range(0, T):
	ans = [0, 0, 0, 0]
	n = int(input())
	if solve(n) == 1:
		print('YES')
		for i in range(1, 4):
			print(ans[i], end=' ')
		print()
	else:
		print('NO')


import math

def calc(n: int):
	myStack: list = [n]
	for i in range(2, int(math.sqrt(myStack[-1])) + 1):
		(x, rem) = divmod(myStack[-1], i)
		if rem == 0:
			myStack.pop()
			myStack.append(i)
			myStack.append(x)
			break
	else:
		print('NO')
		return
	for i in range(2, int(math.sqrt(myStack[-1])) + 1):
		(x, rem) = divmod(myStack[-1], i)
		if rem == 0 and i not in myStack and (x not in myStack):
			myStack.pop()
			myStack.append(i)
			myStack.append(x)
			break
	else:
		print('NO')
		return
	if len(set(myStack)) == 3:
		if myStack[0] * myStack[1] * myStack[2] == n:
			print('YES')
			print('{0} {1} {2}'.format(myStack[0], myStack[1], myStack[2]))
		else:
			print('NO')
	else:
		print('NO')

def main():
	for _ in range(int(input())):
		calc(int(input()))
main()


from math import sqrt

def factorize3(n):
	(f, s) = (1, 1)
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			f = i
			n = n // i
			break
	for i in range(f + 1, int(sqrt(n)) + 1):
		if n % i == 0:
			s = i
			n = n // i
			break
	if s != n and f != 1 and (s != 1):
		print('YES')
		print(f, s, n)
	else:
		print('NO')
test_size = int(input())
for i in range(test_size):
	n = int(input())
	factorize3(n)


import math

def primeFactors(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n // i
	if n > 2:
		a.append(n)
	return a
t = int(input())
for _ in range(t):
	n = int(input())
	k = primeFactors(n)
	l = len(k)
	w = len(set(k))
	if l >= 6:
		p = 1
		print('YES')
		for i in range(3, l):
			p *= k[i]
		print(k[0], k[1] * k[2], p)
	elif l <= 2:
		print('NO')
	elif l == 3:
		if w == 3:
			print('YES')
			print(k[0], k[1], k[2])
		else:
			print('NO')
	elif w == 1:
		print('NO')
	else:
		print('YES')
		k.sort()
		if l == 4:
			print(k[0], k[1] * k[2], k[3])
		else:
			print(k[0], k[1] * k[2] * k[3], k[4])


import math
t = int(input())
for i in range(t):
	n = int(input())
	q = int(math.sqrt(n))
	l = set()
	for j in range(2, q + 1):
		if n % j == 0:
			l.add(j)
	if len(l) < 2:
		print('NO')
	else:
		l = sorted(list(l))
		res = False
		for k in range(len(l) - 1):
			for p in range(k + 1, len(l)):
				a = l[k]
				b = l[p]
				c = n // a // b
				if a * b * c == n and b != c and (a != c):
					res = True
					print('YES')
					print(str(a) + ' ' + str(b) + ' ' + str(c))
					break
			if res:
				break
		if not res:
			print('NO')


num = int(input())
answer = []
for i in range(num):
	target = int(input())
	lis = []
	k = 2
	while len(lis) < 2 and k ** 2 < target:
		if target % k == 0:
			target = target // k
			lis.append(k)
		k += 1
	if len(lis) == 2 and target not in lis:
		answer.append([lis[0], lis[1], target])
	else:
		answer.append('NO')
for i in answer:
	if i == 'NO':
		print(i)
	else:
		print('YES')
		print(i[0], i[1], i[2])


import math
for i in range(int(input())):
	n = int(input())
	l = []
	p = math.sqrt(n)
	p = int(p)
	i = 2
	while len(l) < 2 and i < p:
		if n % i == 0:
			l.append(i)
			n = n // i
		i += 1
	if len(l) == 2 and n not in l:
		print('YES')
		print(*l, n)
	else:
		print('NO')


import math
for t in range(int(input())):
	n = int(input())
	a = -1
	b = -1
	i = 2
	while i * i < n:
		if n % i == 0:
			a = i
			n /= i
			break
		i += 1
	i = 2
	while i * i < n:
		if n % i == 0 and i != a:
			b = i
			n /= i
			break
		i += 1
	if b == -1 or n == 1:
		print('NO')
	else:
		print('YES')
		print(a, b, int(n))


for t in range(int(input())):
	n = int(input())
	flag = 0
	for i in range(2, 10001):
		if n % i == 0:
			flag = 1
			break
	if flag == 1:
		a = i
		n = n // i
		for i in range(2, 100001):
			if n % i == 0 and i != a:
				flag = 2
				break
	b = i
	c = n // i
	if flag == 2 and b != c and (c != 1) and (c != a):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
from collections import defaultdict

def fun(n, dict1):
	if n % 2 == 0 and n // 2 != 2 and (dict1[2] == 0):
		return [2, n // 2]
	elif n % 3 == 0 and n // 3 != 3 and (dict1[n // 3] == 0) and (dict1[3] == 0):
		return [3, n // 3]
	else:
		i = 2
		while i * i < n:
			if n % i == 0 and n // i != i and (dict1[n // i] == 0) and (dict1[i] == 0):
				return [i, n // i]
			i += 1
	return -1
for _ in range(int(input())):
	n = int(input())
	if n < 8:
		print('NO')
	else:
		dict1 = defaultdict(int)
		a = fun(n, dict1)
		if a == -1:
			print('NO')
		else:
			(a, b) = a
			dict1[a] += 1
			c = fun(b, dict1)
			if c == -1:
				print('NO')
			else:
				print('YES')
				print(a, c[0], c[1])


import sys
from math import *
input = sys.stdin.readline
from math import *
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	d = {}
	for i in range(2, int(ceil(sqrt(n))) + 1):
		if n % i == 0:
			d[i] = 0
			while n % i == 0:
				n //= i
				d[i] += 1
	if n > 2:
		d[n] = 1
	if len(d) >= 3:
		a = []
		for i in d:
			a.append(i ** d[i])
		a.sort(reverse=True)
		p = a[0]
		q = a[1]
		s = 1
		for k in range(2, len(a)):
			s *= a[k]
		print('YES')
		print(p, q, s)
		continue
	elif len(d) == 2:
		a = []
		s = 0
		for i in d:
			s += d[i]
		if s <= 3:
			print('NO')
			continue
		s = 1
		for i in d:
			a.append(i)
			s *= i ** (d[i] - 1)
		a.sort()
		p = a[0]
		q = a[1]
		print('YES')
		print(p, q, s)
	else:
		c = 0
		a = []
		for i in d:
			if 6 > d[i] >= 3:
				a.append(i)
				d[i] -= 1
				a.append(i ** d[i])
			elif d[i] >= 6:
				a.append(i)
				a.append(i ** 2)
				a.append(i ** (d[i] - 3))
			else:
				a.append(i ** d[i])
		if len(a) < 3:
			print('NO')
			continue
		a.sort(reverse=True)
		p = a[0]
		q = a[1]
		s = 1
		for k in range(2, len(a)):
			s *= a[k]
		print('YES')
		print(p, q, s)
		continue


from math import factorial
from collections import Counter
from sys import stdin

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

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

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

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
from math import gcd
from math import sqrt
N = int(input())
for _ in range(N):
	n = int(input())
	tag = False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			for j in range(2, int(sqrt(n // i)) + 1):
				if i != j and n // i % j == 0 and (n // i // j != j) and (n // i // j != i) and (n // i // j != 1):
					print('YES')
					print(i, j, n // i // j)
					tag = True
				if tag:
					break
			if tag:
				break
	else:
		print('NO')


import math
t = int(input())
for i in range(t):
	n = int(input())
	f = 0
	l = []
	l1 = []
	for j in range(2, int(math.sqrt(n)) + 1):
		if n % j == 0:
			l.append(j)
			l.append(n // j)
	l1 = list(set(l))
	l1.sort()
	if len(l1) == 0:
		print('NO')
	else:
		a = l1[0]
		n = n // a
		for j in range(len(l1)):
			if n % l1[j] == 0 and l1[j] != a:
				b = l1[j]
				n = n // b
				f = 1
				break
		if f == 0:
			print('NO')
		elif n in l1 and n != a and (n != b):
			print('YES')
			print(a, b, n)
		else:
			print('NO')


import math
from collections import Counter

def primeFactors(n):
	a = []
	c = 0
	while n % 2 == 0:
		a.append(2)
		n = n // 2
		c += 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n // i
			c += 1
	if n > 2:
		a.append(n)
		c += 1
	return (Counter(a), c)
cases = int(input())
for t in range(cases):
	n = int(input())
	(d, c) = primeFactors(n)
	v = len(d)
	if v > 2:
		v = list(d.keys())
		print('YES')
		print(v[0], v[1], n // (v[0] * v[1]))
	elif v == 2:
		if c > 3:
			v = list(d.keys())
			print('YES')
			print(v[0], v[1], n // (v[0] * v[1]))
		else:
			print('NO')
	elif c > 5:
		v = list(d.keys())[0]
		print('YES')
		print(v, v ** 2, n // v ** 3)
	else:
		print('NO')


t = int(input())
for m in range(t):
	n = int(input())
	flag = 0
	u = int(pow(n, 1 / 3))
	i = 2
	while i < u + 1:
		if n % i == 0:
			v = n / i
			f = int(pow(v, 1 / 2))
			j = i + 1
			while j < f + 1:
				if v % j == 0:
					v = v / j
					flag = 1
					break
				j += 1
		if flag == 1:
			break
		i += 1
	if flag == 1 and j != v:
		print('YES')
		print('%d   %d    %d' % (i, j, v))
	else:
		print('NO')


from math import sqrt

def szuk_podz(liczba, a=1):
	for x in range(2, int(sqrt(liczba)) + 1):
		if liczba % x == 0 and x != a:
			return x
	return -1
for _ in range(int(input())):
	n = int(input())
	(a, b, c) = (szuk_podz(n), 0, 0)
	x = n // a
	if a == -1:
		print('NO')
		continue
	b = szuk_podz(x, a)
	c = x // b
	if c == a or c == b:
		print('NO')
		continue
	if c > 0 and b > 0:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


from itertools import combinations as com
from math import sqrt
for _ in range(int(input())):
	k = []
	a = int(input())
	for i in range(2, int(sqrt(a)) + 1):
		if a % i == 0:
			if a // i == i:
				k.append(i)
			else:
				k.append(i)
				k.append(a // i)
	if len(k) < 3:
		print('NO')
	else:
		p = com(k, 3)
		for i in p:
			if i[0] * i[1] * i[2] == a:
				print('YES')
				print(i[0], i[1], i[2])
				break
		else:
			print('NO')


t = int(input())
for i in range(t):
	count = 0
	flag = 0
	a = []
	n = int(input())
	for j in range(2, int(n ** 0.5) + 1):
		if count == 2 and n < j:
			print('NO')
			flag = 1
			break
		elif count == 2 and n > j:
			print('YES')
			for x in a:
				print(x, end=' ')
			print(int(n))
			count = count + 1
			break
		elif count == 2 and n == j:
			if j in a:
				print('NO')
				flag = 1
				break
			else:
				print('YES')
				for x in a:
					print(x, end=' ')
				print(int(n))
				count = count + 1
				break
		if n % j == 0:
			if j not in a:
				n = n / j
				count += 1
				a.append(j)
	if count <= 2 and flag == 0:
		print('NO')


def prime_factorize(n):
	a = []
	if n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n and len(a) < 2:
		if n % f == 0:
			a.append(f)
			n //= f
			f += 1
		else:
			f += 1
	if n != 1 and n not in a:
		a.append(n)
	return a
YN = []
N = int(input())
for i in range(N):
	P = int(input())
	p = prime_factorize(P)
	nums = ''
	num = 1
	if len(p) >= 3:
		YN.append('YES')
		for j in range(2, len(p)):
			num = num * p[j]
		nums += str(p[0]) + ' ' + str(p[1]) + ' ' + str(num)
		YN.append(nums)
	else:
		YN.append('NO')
for u in YN:
	print(u)


import math
t = int(input())
for i in range(t):
	n = int(input())
	f = 1
	for a in range(2, int(math.sqrt(n)) + 1):
		if f and n % a == 0:
			curn = n // a
			for b in range(2, int(math.sqrt(curn)) + 1):
				if f and b != a and (curn % b == 0):
					c = curn // b
					if c != b and c != a:
						print('YES')
						print(a, b, c)
						f = 0
	if f:
		print('NO')


def min_dev(n, temp):
	while temp < n ** 0.5 + 1:
		if n % temp == 0:
			return temp
		temp += 1
	return 0
for _ in range(int(input())):
	n = int(input())
	a = min_dev(n, 2)
	if a == 0:
		print('NO')
		continue
	b = min_dev(int(n / a), a + 1)
	if b == 0:
		print('NO')
		continue
	c = int(n / (a * b))
	if c == 0 or c == b or c == 1 or (c == a):
		print('NO')
		continue
	print('YES')
	print(a, b, c)


from sys import stdin, stdout

def main():
	t = int(input())
	for z in range(t):
		n = int(input())
		i = 2
		sw = 1
		while i * i < n and sw:
			if n % i == 0:
				j = 2
				tmp = n // i
				while j * j < tmp and sw:
					if tmp % j == 0 and j != i and (tmp // j != i):
						print('YES')
						print(i, j, tmp // j)
						sw = 0
					j += 1
			i += 1
		if sw:
			print('NO')
main()


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	uniq = set()
	for i in range(2, ceil(sqrt(n))):
		if n % i == 0:
			uniq.add(i)
			n /= i
			break
	for i in range(2, ceil(sqrt(n))):
		if n % i == 0 and i not in uniq:
			uniq.add(i)
			n /= i
			break
	if len(uniq) < 2 or n in uniq or n == 1:
		print('NO')
	else:
		print('YES')
		uniq.add(int(n))
		print(*uniq)


def solve():
	n = int(input())
	divs = []
	for i in range(2, int(n ** 0.5) + 2):
		if n % i == 0:
			n //= i
			divs.append(i)
			if len(divs) == 2:
				if n > divs[1]:
					print('YES')
					print(*divs, n)
					return
				else:
					print('NO')
					return
	print('NO')
t = int(input())
for _ in range(t):
	solve()


import math

def find(n):
	count = 0
	flag = 0
	ori = n
	for i in range(2, int(math.sqrt(n)) + 3):
		if n % i == 0:
			count += 1
			n = n // i
			liste.append(i)
		if count >= 2:
			r = ori // (liste[0] * liste[1])
			if r != liste[0] and r != liste[1] and (r != 1):
				liste.append(ori // (liste[0] * liste[1]))
				flag = 1
				break
			else:
				count = 1
				del liste[len(liste) - 1]
	if flag == 1:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	liste = []
	y = find(n)
	if y == 'YES':
		print(y)
		print(*liste)
	elif y == 'NO':
		print(y)


import math

def factor(n, a):
	l = []
	r = n
	k = int(math.sqrt(n)) + 1
	d = 1
	while n % 2 ** d == 0:
		if 2 ** d != a and r // 2 ** d != a and (r // 2 ** d != 2 ** d) and (2 ** d != r):
			l.append(2 ** d)
			l.append(r // 2 ** d)
			n //= 2 ** d
			d += 1
			break
		else:
			d += 1
	for i in range(3, k, 2):
		d = 1
		while n % i ** d == 0:
			if i ** d != a and r // i ** d != a and (r // i ** d != i ** d) and (i ** d != n):
				l.append(i ** d)
				l.append(r // i ** d)
				n //= i ** d
				d += 1
				break
			else:
				d += 1
	return l

def factors(n):
	l = []
	r = n
	k = int(math.sqrt(n)) + 1
	d = 1
	while n % 2 == 0:
		l.append(2 ** d)
		d += 1
		n //= 2
	for i in range(3, k, 2):
		d = 1
		while n % i == 0:
			l.append(i ** d)
			d += 1
			n //= i
	if n == 1:
		return l
	else:
		l.append(n)
		return l
for _ in range(int(input())):
	n = int(input())
	l = factors(n)
	if len(l) < 3:
		print('NO')
	else:
		t = x = y = z = 0
		for i in range(len(l)):
			a = n // l[i]
			f = factor(a, l[i])
			if len(f) > 1:
				x = f[0]
				y = f[1]
				z = l[i]
				t = 1
				break
		if t == 1:
			print('YES')
			print(z, x, y)
		else:
			print('NO')


def find_div(x, j):
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0 and i != j and (x // i != j) and (i != x // i):
			return (True, i, x // i)
	return (False, -1, -1)
t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			(ok, a, b) = find_div(n // i, i)
			if ok:
				print('YES')
				print(i, a, b)
				break
	else:
		print('NO')


from collections import defaultdict

def solve(n):
	table = set()
	i = 2
	while i * i <= n:
		if n % i == 0:
			table.add(i)
			n /= i
			break
		i += 1
	i = 2
	while i * i <= n:
		if n % i == 0 and i not in table:
			table.add(i)
			n /= i
			break
		i += 1
	if len(table) < 2 or n == 1 or n in table:
		print('NO')
	else:
		print('YES')
		table.add(int(n))
		print(' '.join([str(t) for t in table]))
T = int(input())
for t in range(T):
	n = int(input())
	solve(n)


import sys
import math
from functools import reduce

def getN():
	return int(input())

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

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

def getArray(intn):
	return [int(input()) for i in range(intn)]

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

def factorize(n):
	factors = []
	for i in range(2, int(math.sqrt(n) + 1)):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
for _ in range(int(input())):
	n = getN()
	factors = factorize(n)
	if len(factors) < 3:
		print('NO')
		continue
	if factors[0] == factors[1]:
		factors[1] = factors[1] * factors[2]
		factors.pop(2)
	if len(factors) < 3:
		print('NO')
		continue
	factors[2] = reduce(lambda x, y: x * y, factors[2:])
	if len(set(factors)) < 3:
		print('NO')
		continue
	print('YES')
	print(*factors[:3])


from math import ceil, sqrt
n = int(input())
for i in range(n):
	num = int(input())
	ans = []
	for mult in range(2, ceil(sqrt(num))):
		if num < mult:
			break
		if num % mult == 0:
			ans.append(mult)
			num = num / mult
			if len(ans) == 2 and ans[0] != num and (ans[1] != num) and (num != 1):
				ans.append(int(num))
				break
	if len(ans) == 3:
		print('YES')
		print(' '.join([str(x) for x in ans]))
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	num_factors = 0
	first_factor = -1
	second_factor = -1
	if n == 1 or n == 2:
		print('NO')
		continue
	n_copy = n
	s = int(math.sqrt(n))
	for i in range(2, s):
		if n_copy % i == 0:
			if first_factor == -1:
				first_factor = i
			elif second_factor == -1:
				second_factor = i
			else:
				break
			n_copy = n_copy // i
	if first_factor == -1 or second_factor == -1 or first_factor == n_copy or (second_factor == n_copy) or (n_copy == 1):
		print('NO')
	else:
		print('YES')
		print(first_factor, second_factor, n_copy)


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))

def isPrime(n, w):
	for i in range(w, int(sqrt(n)) + 1):
		if n % i == 0:
			return (False, i)
	return (True, 0)
t = sInt()
for _ in range(t):
	n = sInt()
	(q, a) = isPrime(n, 2)
	if q == True:
		print('NO')
	else:
		n = n // a
		(q, b) = isPrime(n, a + 1)
		if q == True or b == n // b:
			print('NO')
		else:
			print('YES')
			print(a, b, n // b)


gi = lambda : list(map(int, input().split()))
(t,) = gi()
for k in range(t):
	(n,) = gi()
	div = 1
	sq = int(n ** 0.5)
	for j in range(2, sq + 1):
		if n % j == 0:
			div = j
			break
	x = n // div
	sq = int(x ** 0.5)
	div2 = 1
	for j in range(2, sq + 1):
		if x % j == 0:
			if len({div, j, x // j}) == 3:
				div2 = j
				break
	if div == 1 or div2 == 1:
		print('NO')
	else:
		print('YES')
		print(div, div2, x // div2)


import os
import sys
import math
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')

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

def main():
	for _ in range(int(input())):
		n = int(input())
		res = pf(n)
		if len(res) <= 2:
			print('NO')
		elif len(res) == 3:
			if len(set(res)) == 3:
				print('YES')
				print(*res)
			else:
				print('NO')
		else:
			a1 = res[0]
			a2 = 1
			idx = -69
			for i in range(1, len(res)):
				if a2 != a1 and a2 != 1:
					idx = i
					break
				else:
					a2 *= res[i]
			a3 = 1
			for i in range(idx, len(res)):
				a3 *= res[i]
			if a3 != a2 and a3 != a1:
				print('YES')
				print(a1, a2, a3)
			else:
				print('NO')
main()


lines = [int(line) for line in [*open(0)][1:]]
for n in lines:
	sol = []
	d = 2
	done = False
	while d * d <= n:
		if n % d == 0:
			n //= d
			sol.append(d)
			if len(sol) == 2:
				done = True
				if n not in sol:
					sol.append(n)
					print('YES')
					print(' '.join(map(str, sol)))
				else:
					print('NO')
				break
		d += 1
	if not done:
		print('NO')


from math import sqrt
q = int(input())
for _ in range(q):
	n = int(input())
	cnt = 0
	save = [0] * 6
	for i in range(2, int(sqrt(n)) + 2):
		if n % i == 0:
			cnt += 1
			save[cnt] = i
			n = int(n / i)
		if cnt == 2:
			break
	if cnt < 2:
		print('NO')
	elif n <= save[cnt]:
		print('NO')
	else:
		print('YES')
		print(save[1], save[2], n, ' ')


t = int(input())
for _ in range(t):
	n = int(input())
	ad = False
	for i in range(2, 10001):
		if n % i == 0:
			ln1 = n // i
			n1 = i
			for j in range(i + 1, 10001):
				if ln1 % j == 0 and j * j != ln1 and (ln1 // j != i) and (ln1 // j != 1):
					ln2 = ln1 // j
					n2 = j
					n3 = ln2
					print('YES')
					print(n1, n2, n3)
					ad = True
					break
				if ad == True:
					break
			if ad == True:
				break
		if ad == True:
			break
	if ad == False:
		print('NO')


from math import sqrt
n = int(input())
for _ in range(n):
	a = 0
	b = 0
	k = int(input())
	for i in range(2, int(sqrt(k)) + 1):
		if k % i == 0:
			a = i
			break
	if a > 0:
		temp = int(sqrt(k / a + 1))
		for i in range(a + 1, temp + 1):
			if k / a % i == 0:
				b = i
				break
	if a == 0 or b == 0:
		print('NO')
	elif k / (a * b) > b:
		print('YES')
		print(a, b, int(k / (a * b)))
	else:
		print('NO')


import math
t = int(input())
for ii in range(0, t):
	n = int(input())
	a = 0
	b = 0
	c = 0
	if n < 24:
		print('NO')
		continue
	ifFind = 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if ifFind == 1:
			break
		if n % i != 0:
			continue
		n2 = n // i
		for j in range(i + 1, int(math.sqrt(n2)) + 1):
			if n2 % j != 0:
				continue
			n3 = n2 // j
			if j == n3:
				break
			ifFind = 1
			a = i
			b = j
			c = n3
			break
	if ifFind == 1:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	p = []
	m = 2
	while m * m <= n:
		if n % m == 0:
			n = n // m
			p.append(m)
			if len(p) == 2:
				break
		m += 1
	if len(p) < 2:
		print('NO')
	elif p[0] != p[1] != n and n > 2:
		print('YES')
		print(*p, n)
	else:
		print('NO')


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	fact = []
	while n % i == 0:
		n = n // i
		fact.append(i)
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n // i
			fact.append(i)
	if n != 1:
		fact.append(n)
	if len(fact) < 3:
		print('NO')
		continue
	ans = 1
	i = 0
	fact.sort()
	if len(fact) == 3:
		if len(set(fact)) < 3:
			print('NO')
			continue
	if 4 <= len(fact) <= 5:
		if len(set(fact)) < 2:
			print('NO')
			continue
	if len(set(fact)) == 1:
		a = fact[0] * fact[1]
		b = 1
		i = 2
		while i < len(fact) - 1:
			b *= fact[i]
			i += 1
		c = fact[-1]
		print('YES')
		print(a, b, c)
	else:
		a = fact[0]
		b = 1
		i = 1
		while i < len(fact) - 1:
			b *= fact[i]
			i += 1
		c = fact[-1]
		print('YES')
		print(a, b, c)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	x = int(input())
	ar = []
	l = 0
	a = 1
	b = 1
	c = 1
	ct = 0
	bl = False
	for j in range(2, int(x ** 0.5)):
		if x % j == 0 and ct == 0:
			a = j
			ct += 1
		elif x % j == 0 and ct == 1:
			temp = j
			if x % (a * temp) == 0 and x // (a * temp) != a and (x // (a * temp) != temp):
				b = temp
				c = x // (a * temp)
				bl = True
				break
	if bl == True:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


t = int(input())
for i in range(t):
	N = int(input())
	answer = []
	F = 0
	for i in range(2, int(N ** 0.5) + 1):
		if N % i == 0:
			X = i
			Z = N // i
			for j in range(2, int(Z ** 0.5) + 1):
				if Z % j == 0:
					ANS1 = Z // j
					if ANS1 != j and ANS1 != X and (j != X):
						print('YES')
						print(ANS1, j, X)
						F = 1
						break
			if F == 1:
				break
	if F == 0:
		print('NO')


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
get_int = lambda : int(input())
get_ints = lambda : map(int, input().split())
get_ints_list = lambda : list(get_ints())
from math import sqrt

def factorize(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i == 0:
			p = 0
			while n % i == 0:
				n //= i
				p += 1
				factors.append(i)
		i += 1
	if n != 1:
		factors.append(n)
	return factors
t = get_int()
for _ in range(t):
	n = get_int()
	factors = factorize(n)
	l = len(factors)
	if l < 3:
		print('NO')
		continue
	(a, b, c) = (1, 1, 1)
	a = factors[0]
	i = 1
	while i < l:
		b *= factors[i]
		i += 1
		if b != a:
			break
	while i < l:
		c *= factors[i]
		i += 1
	if a != b and a != c and (b != c) and (a != 1) and (b != 1) and (c != 1) and (a * b * c == n):
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import math
for _ in range(int(input())):
	n = int(input())
	g = 0
	for i in range(2, math.floor(math.sqrt(n)) + 1):
		if n % i == 0:
			if n // i != i:
				p = n // i
				for j in range(2, math.floor(math.sqrt(i)) + 1):
					if i % j == 0:
						if i // j != j and j != p and (p != i // j):
							g = 1
							l = [n // i, j, i // j]
							break
				for j in range(2, math.floor(math.sqrt(p)) + 1):
					if p % j == 0:
						if p // j != j and i != j and (i != p // j):
							g = 1
							l = [j, p // j, i]
							break
	if g == 0:
		print('NO')
	else:
		print('YES')
		print(*l)


def chay(a, n):
	i = a
	while i * i <= n:
		if n % i == 0:
			b = i
			c = int(n / i)
			if b == c:
				return (0, 0)
			else:
				return (b, c)
		i += 1
	return (0, 0)

def ktra(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			a = i
			(b, c) = chay(a + 1, int(n / i))
			if b != 0:
				return (1, a, b, c)
			break
		i += 1
	return (0, 0, 0, 0)
for i in range(int(input())):
	n = int(input())
	(kq, a, b, c) = ktra(int(n))
	if kq == 1:
		print('YES')
		print(a, b, c)
	else:
		print('NO')


import collections, math
for _ in range(int(input())):
	n = int(input())
	factors = []
	flag = False
	d = collections.defaultdict(int)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			d[i] = 1
			factors.append(i)
			if n // i != i:
				d[n // i] = 1
				factors.append(n // i)
	factors.sort()
	for i in range(len(factors) - 1):
		for j in range(i + 1, len(factors)):
			k = n // (factors[i] * factors[j])
			if d[k] == 1 and factors[i] * factors[j] * k == n and (factors[i] != k) and (factors[j] != k):
				flag = True
				print('YES')
				print(factors[i], factors[j], k)
				break
		if flag:
			break
	if not flag:
		print('NO')


prime = []
l = []
for i in range(40000):
	prime.append(True)
for i in range(2, 40000):
	if prime[i] == True:
		l.append(i)
		tmp = 2 * i
		while tmp < 40000:
			prime[tmp] = False
			tmp += i
t = int(input())
for i in range(t):
	n = int(input())
	flag = False
	for j in l:
		if j ** 2 > n:
			break
		if n % j == 0:
			q = n // j
			for k in range(j + 1, q):
				if k ** 2 > q:
					break
				if k != j and q % k == 0:
					if q // k != k:
						flag = True
						print('YES')
						print(j, k, q // k, sep=' ')
					break
			break
	if flag == False:
		print('NO')


import math
from operator import mul
from functools import reduce

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
T = int(input())
for _ in range(T):
	N = int(input())
	n = N
	zz = False
	for i in range(2, math.floor(n ** 0.5) + 1):
		if n % i == 0:
			n = n // i
			for j in range(2, math.floor(n ** 0.5) + 1):
				if n % j == 0 and j != i:
					n = n // j
					if n != i and n != j and (n > 1):
						print('YES')
						print('{} {} {}'.format(i, j, n))
						zz = True
						break
			if zz:
				break
	if zz:
		continue
	print('NO')


def sqrt(p):
	lo = 0.0
	hi = 1000000000.0
	for i in range(1, 64):
		mid = (lo + hi) / 2.0
		if mid * mid > p:
			hi = mid
		else:
			lo = mid
	return lo
test = int(input())

def solve():
	n = int(input())
	dp = []
	lmt = int(sqrt(n) + 1)
	for i in range(2, lmt):
		if n % i == 0:
			while n % i == 0:
				dp.append(i)
				n /= i
	if n != 1:
		dp.append(n)
	if len(dp) < 3:
		print('NO')
		return
	elif dp[0] == dp[len(dp) - 1]:
		dp[0] = dp[0] * dp[1]
		last = 0
		for i in range(2, len(dp)):
			if i == len(dp) - 1:
				break
			if i == 2:
				last = dp[i]
			else:
				last = last * dp[i]
		if dp[0] == last or dp[len(dp) - 1] == last or last == 0:
			print('NO')
		else:
			print('YES')
			print(int(dp[0]), ' ', int(dp[len(dp) - 1]), ' ', int(last))
	else:
		last = 0
		for i in range(1, len(dp)):
			if i == len(dp) - 1:
				break
			if i == 1:
				last = dp[i]
			else:
				last = last * dp[i]
		if last == dp[0] or last == dp[len(dp) - 1] or last == 0:
			print('NO')
		else:
			print('YES')
			print(int(dp[0]), ' ', int(last), ' ', int(dp[len(dp) - 1]))
while test > 0:
	solve()
	test -= 1


import math
tests = int(input())
prime = [1 for i in range(10 ** 6)]
prime[0] = 0
prime[1] = 0
for i in range(2, 10 ** 6):
	if prime[i] == 1:
		for j in range(i * i, 10 ** 6, i):
			prime[j] = 0
for te in range(tests):
	n = int(input())
	count = 0
	prime_list = []
	for i in range(2, int(math.sqrt(n)) + 2):
		if prime[i] == 1:
			while n % i == 0:
				n = n // i
				prime_list.append(i)
				count += 1
	if n > 1:
		count += 1
		prime_list.append(n)
	pro = [0 for i in range(len(prime_list))]
	pro[0] = prime_list[0]
	flag = 0
	for i in range(1, len(prime_list)):
		pro[i] = pro[i - 1] * prime_list[i]
	if count > 2:
		for i in range(len(prime_list) - 2):
			for j in range(i + 1, len(prime_list) - 1):
				a = pro[i]
				b = pro[j] // pro[i]
				c = pro[len(prime_list) - 1] // pro[j]
				if a != b and b != c and (a != c):
					print('YES')
					print(a, end=' ')
					print(b, end=' ')
					print(c, end='\n')
					flag = 1
					break
			if flag == 1:
				break
		if flag == 0:
			print('NO')
	else:
		print('NO')


N = int(input())
from math import *
for _ in range(N):
	n = int(input())
	sn = int(sqrt(n)) + 1
	cnt = 0
	ans = []
	for i in range(2, sn):
		if n % i == 0:
			ans.append(i)
			n //= i
			cnt += 1
			if cnt == 2:
				cnt = i
				break
	if n not in ans and len(ans) == 2:
		print('YES')
		print(' '.join(map(str, ans)), n)
	else:
		print('NO')


import sys
from functools import reduce
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

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

def product():
	for _ in range(t):
		n = int(input())
		yn = factors(n)
		yn.sort()
		if len(yn) >= 4:
			(a, b) = (yn[1], yn[3])
			c = n // yn[1] // yn[3]
			d = n // yn[1] % yn[3]
			(a1, b1) = (yn[1], yn[2])
			e = n // yn[1] // yn[2]
			f = n // yn[1] % yn[2]
			if c > 1 and c != a and (c != b) and (d == 0):
				yield 'YES'
				yield (str(a) + ' ' + str(b) + ' ' + str(c))
			elif e > 1 and e != a1 and (e != b1) and (f == 0):
				yield 'YES'
				yield (str(a1) + ' ' + str(b1) + ' ' + str(e))
			else:
				yield 'NO'
		else:
			yield 'NO'
t = int(input())
ans = product()
print(*ans, sep='\n')


import math

def prime(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(int(i))
			n = n / i
	if n > 2:
		a.append(int(n))
	return a
t = int(input())
while t > 0:
	n = int(input())
	a = prime(n)
	l = len(a)
	if l < 3:
		print('NO')
	elif l == 3 and len(set(a)) == 3:
		print('YES')
		for i in a:
			print(i, end=' ')
		print()
	else:
		i = 0
		k = 1
		temp = []
		temp.append(a[i])
		i += 1
		if a[i] != a[i - 1]:
			temp.append(a[i])
			i += 1
		else:
			temp.append(a[i] * a[i + 1])
			i += 2
		for j in range(i, l):
			k *= a[j]
		if k != 1 and k not in temp:
			temp.append(k)
		s = set(temp)
		if len(s) == 3 and temp[0] * temp[1] * temp[2] == n:
			print('YES')
			for i in s:
				print(i, end=' ')
			print()
		else:
			print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [i for i in range(2, int(n ** 0.5) + 1) if n % i == 0]
	f = False
	(a, b, c) = (0, 0, 0)
	for i in range(len(arr) - 2):
		for j in range(i + 1, len(arr) - 1):
			mul = arr[i] * arr[j]
			if n % (n // mul) == 0 and n // mul != arr[i] and (n // mul != arr[j]):
				f = True
				(a, b, c) = (arr[i], arr[j], n // mul)
				break
		if f:
			break
	if a + b + c == 0:
		print('NO')
	else:
		print('YES')
		print(a, b, c)


import math

def solve():
	n = int(input())
	a = 0
	b = 0
	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0:
			a = i
			n //= a
			break
	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0 and i != a:
			b = i
			n //= b
			break
	if a == 0 or b == 0 or n == 1:
		print('NO')
	else:
		print('YES')
		print(a, b, n)
t = int(input())
for _ in range(t):
	solve()


I = input
pr = print

def main():
	for _ in range(int(I())):
		ar = []
		(n, i) = (int(I()), 2)
		while i * i < n and len(ar) < 2:
			if n % i == 0:
				ar.append(i)
				n //= i
			i += 1
		if len(ar) == 2:
			pr('YES')
			pr(*ar, n)
		else:
			pr('NO')
main()


def three_multiply(n):
	(a, b, c) = (0, 0, 0)
	for i in range(2, n // 2):
		if i * i > n:
			break
		if n % i == 0:
			a = i
			n = n // i
			break
	for i in range(a + 1, n // 2):
		if i * i > n:
			break
		if n % i == 0:
			b = i
			if n // i > b:
				c = n // i
			break
	if a and b and c:
		print('YES')
		print(a, b, c)
	else:
		print('NO')
t = int(input())
X = []
x = [X.append(int(input())) for i in range(t)]
for x in X:
	three_multiply(x)


import math
for case in range(int(input())):
	n = int(input())
	(a, b, c) = (0, 0, 0)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			(a, b) = (i, n // i)
			break
	if a:
		for i in range(a + 1, int(math.sqrt(b)) + 1):
			if b % i == 0:
				(b, c) = (i, b // i)
				break
	print('YES\n' + ' '.join([str(a), str(b), str(c)]) if a >= 2 and b >= 2 and (c >= 2) and (b != c) else 'NO')


from math import sqrt

def solve(n):
	if isprime(n, 2) == -1:
		return 'NO'
	i = 2
	while i <= sqrt(n):
		if n % i == 0:
			p = isprime(n // i, i + 1)
			if p != -1:
				return (i, p)
		i += 1
	return 'NO'

def isprime(n, b):
	i = b
	while i <= sqrt(n):
		if n % i == 0 and i != n // i:
			return (i, n // i)
		i += 1
	return -1
for _ in range(int(input())):
	n = int(input())
	s = solve(n)
	if s == 'NO':
		print(s)
	else:
		print('YES')
		print(s[0], *s[1])