1. 程式人生 > 實用技巧 >CodeForces 1388A Captain Flint and Crew Recruitment

CodeForces 1388A Captain Flint and Crew Recruitment

Despite his bad reputation, Captain Flint is a friendly person (at least, friendly to animals). Now Captain Flint is searching worthy sailors to join his new crew (solely for peaceful purposes). A sailor is considered as worthy if he can solve Flint's task.

Recently, out of blue Captain Flint has been interested in math and even defined a new class of integers. Let's define a positive integer

xasnearly primeif it can be represented asp⋅q, where1<p<qandpandqare prime numbers. For example, integers6and10are nearly primes (since2⋅3=6and2⋅5=10), but integers1,3,4,16,17or44are not.

Captain Flint guessed an integernand asked you: can you represent it asthe sum of4different positiveintegerswhereat least

3of them should benearly prime.

Uncle Bogdan easily solved the task and joined the crew. Can you do the same?

Input

The first line contains a single integert(1≤t≤1000)— the number of test cases.

Nexttlines contain test cases— one per line. The first and only line of each test case contains the single integer

n(1≤n≤2⋅105)— the number Flint guessed.

Output

For each test case print:

  • YESand4differentpositive integers such that at least3of them are nearly prime and their sum is equal ton(if there are multiple answers print any of them);
  • NOif there is no way to representnasthe sum of4different positiveintegerswhere at least3of them are nearly prime.

You can print each character ofYESorNOin any case.Example

Input
7
7
23
31
36
44
100
258
Output
NO
NO
YES
14 10 6 1
YES
5 6 10 15
YES
6 7 10 21
YES
2 10 33 55
YES
10 21 221 6

6 10 14 15都由質陣列成,又因為6和10 10和14都差4,不能用來做填平用的數,所以選擇15,d=n-a-b-c,d如果和abc相等,那麼d減一加給14即可

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define Inf 0x3f3f3f3f
#define Maxn 20



int main() {
    int t, n, a, b, c, d;
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        a = 6;
        b = 10;
        c = 14;
        d = a + b + c;
        d = n - d;
        if (d == a || d == b || d == c) {
            c = 15, d -= 1;
            printf("YES\n");
            printf("%d %d %d %d\n", a, b, c, d);
        }
        else if (d > 0) {
            printf("YES\n");
            printf("%d %d %d %d\n", a, b, c, d);
        }
        else printf("NO\n");
    }
    return 0;

    
}