Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- //#pragma GCC optimize("O3")
- //#pragma GCC target("sse4")
- #define int long long
- #define pb push_back
- #define fr first
- #define sc second
- #define _ << ' ' <<
- #define pairs pair<int, int>
- const int mod = 1e9 + 7;
- typedef long long ll;
- typedef long double ld;
- using namespace std;
- void solve(){
- int n;
- cin >> n;
- int a = -1, b = -1;
- int i = 2, pos = 1;
- while(i * i <= n && n != 1){
- while(n % i == 0){
- if(a == -1){
- a = i;
- }
- else{
- pos *= i;
- if(pos != a){
- b = pos;
- n /= i;
- break;
- }
- }
- n/=i;
- }
- i++;
- }
- if(a != -1 && b != -1 && a != b && a != n && b != n && n != 1){
- cout << "YES\n";
- cout << a << ' ' << b << ' ' << n << '\n';
- }
- else cout << "NO\n";
- }
- signed main(){
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int t = 1;
- cin >> t;
- while(t--){
- solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement