# Problem Description

You are given one integer number n. Find three distinct integers a,b,c such that 2≤a,b,c and a⋅b⋅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≤t≤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≤n≤109).

# Output

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

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

Input

5
64
32
97
2
12345

Output

YES
2 4 8
NO
NO
NO
YES
3 5 823

# Source Program

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
#define Pair pair<int,int>
LL quickPow(LL a,LL b){ LL res=1; while(b){if(b&1)res*=a; a*=a; b>>=1;} return res; }
LL multMod(LL a,LL b,LL mod){ a%=mod; b%=mod; LL res=0; while(b){if(b&1)res=(res+a)%mod; a=(a<<=1)%mod; b>>=1; } return res%mod;}
LL quickMultPowMod(LL a, LL b,LL mod){ LL res=1,k=a; while(b){if((b&1))res=multMod(res,k,mod)%mod; k=multMod(k,k,mod)%mod; b>>=1;} return res%mod;}
LL quickPowMod(LL a,LL b,LL mod){ LL res=1; while(b){if(b&1)res=(a*res)%mod; a=(a*a)%mod; b>>=1; } return res; }
LL getInv(LL a,LL mod){ return quickPowMod(a,mod-2,mod); }
LL GCD(LL x,LL y){ return !y?x:GCD(y,x%y); }
LL LCM(LL x,LL y){ return x/GCD(x,y)*y; }
const double EPS = 1E-6;
const int MOD = 1000000000+7;
const int N = 1000+5;
const int dx[] = {0,0,-1,1,1,-1,1,1};
const int dy[] = {1,-1,0,0,-1,1,-1,1};
using namespace std;

map<LL, int> num;   //记录素因子个数
LL factor[N], cntF; //记录素因子
void getFactor(LL n) {
cntF = 0;
num.clear();
for (LL i = 2; i <= n / i; i++) {
if (n % i == 0) //记录素因子
factor[cntF++] = i;
while (n % i == 0) {
n /= i;
num[i]++; //记录素因子个数
}
}
if (n > 1) {
factor[cntF++] = n;
num[n]++;
}
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
LL n;
scanf("%lld", &n);
getFactor(n);
if (cntF == 1) {
if (num[factor[0]] >= 6) {
LL a = factor[0];
LL b = factor[0] * factor[0];
LL c = n / (a * b);
printf("YES\n");
printf("%lld %lld %lld\n", a, b, c);
}
else
printf("NO\n");
}
else if (cntF == 2) {
if (num[factor[0]] + num[factor[1]] >= 4) {
LL a = factor[0];
LL b = factor[1];
LL c = n / (a * b);
printf("YES\n");
printf("%lld %lld %lld\n", a, b, c);
}
else
printf("NO\n");
}
else {
LL a = factor[0];
LL b = factor[1];
LL c = n / (a * b);
printf("YES\n");
printf("%lld %lld %lld\n", a, b, c);
}
}
return 0;
}

• 点赞
• 评论
• 分享
x

海报分享

扫一扫，分享海报

• 收藏
• 手机看

分享到微信朋友圈

x

扫一扫，手机阅读

• 打赏

打赏

Alex_McAvoy

你的鼓励将是我创作的最大动力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文
01-23 1941

07-10 113
01-23 98
01-30 372
03-21 78