310775: CF1886A. Sum of Three

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Sum of Threetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Monocarp has an integer $n$.

He wants to represent his number as a sum of three distinct positive integers $x$, $y$, and $z$. Additionally, Monocarp wants none of the numbers $x$, $y$, and $z$ to be divisible by $3$.

Your task is to help Monocarp to find any valid triplet of distinct positive integers $x$, $y$, and $z$, or report that such a triplet does not exist.

Input

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of testcases.

The only line of each testcase contains a single integer $n$ ($1 \le n \le 10^{9}$).

Output

For each testcase, if there is no valid triplet $x$, $y$, and $z$, print NO on the first line.

Otherwise, print YES on the first line. On the second line, print any valid triplet of distinct positive integers $x$, $y$, and $z$ such that $x + y + z = n$, and none of the printed numbers are divisible by $3$. If there are multiple valid triplets, you can print any of them.

ExampleInput
4
10
4
15
9
Output
YES
4 5 1
NO
YES
2 8 5
NO
Note

In the first testcase, one of the valid triplets is $x = 4$, $y = 5$, $z = 1$. None of these numbers are divisible by three, and $4 + 5 + 1 = 10$.

In the second testcase, there is no valid triplet.

In the third testcase, one of the valid triplets is $x = 2$, $y = 8$, $z = 5$. None of these numbers are divisible by three, and $2 + 8 + 5 = 15$.

In the fourth testcase, there is no valid triplet.

Output

题目大意:
Monocarp有一个整数n。他想将这个数字表示为三个不同的正整数x、y和z的和。此外,Monocarp希望x、y和z都不被3整除。你的任务是帮助Monocarp找到任意有效的三个不同的正整数x、y和z的三元组,或者报告说不存在这样的三元组。

输入数据格式:
第一行包含一个整数t(1≤t≤10^4)——测试用例的数量。
每个测试用例只有一行,包含一个整数n(1≤n≤10^9)。

输出数据格式:
对于每个测试用例,如果没有有效的三元组x、y和z,则在第一行打印NO。
否则,在第一行打印YES。在第二行,打印任意有效的三个不同的正整数x、y和z,使得x+y+z=n,并且打印的数字都不被3整除。如果有多个有效的三元组,你可以打印其中任何一个。

示例:
输入
```
4
10
4
15
9
```
输出
```
YES
4 5 1
NO
YES
2 8 5
NO
```
注意:
在第一个测试用例中,有效的三元组之一是x=4,y=5,z=1。这些数字都不被3整除,并且4+5+1=10。
在第二个测试用例中,没有有效的三元组。
在第三个测试用例中,有效的三元组之一是x=2,y=8,z=5。这些数字都不被3整除,并且2+8+5=15。
在第四个测试用例中,没有有效的三元组。题目大意: Monocarp有一个整数n。他想将这个数字表示为三个不同的正整数x、y和z的和。此外,Monocarp希望x、y和z都不被3整除。你的任务是帮助Monocarp找到任意有效的三个不同的正整数x、y和z的三元组,或者报告说不存在这样的三元组。 输入数据格式: 第一行包含一个整数t(1≤t≤10^4)——测试用例的数量。 每个测试用例只有一行,包含一个整数n(1≤n≤10^9)。 输出数据格式: 对于每个测试用例,如果没有有效的三元组x、y和z,则在第一行打印NO。 否则,在第一行打印YES。在第二行,打印任意有效的三个不同的正整数x、y和z,使得x+y+z=n,并且打印的数字都不被3整除。如果有多个有效的三元组,你可以打印其中任何一个。 示例: 输入 ``` 4 10 4 15 9 ``` 输出 ``` YES 4 5 1 NO YES 2 8 5 NO ``` 注意: 在第一个测试用例中,有效的三元组之一是x=4,y=5,z=1。这些数字都不被3整除,并且4+5+1=10。 在第二个测试用例中,没有有效的三元组。 在第三个测试用例中,有效的三元组之一是x=2,y=8,z=5。这些数字都不被3整除,并且2+8+5=15。 在第四个测试用例中,没有有效的三元组。

加入题单

上一题 下一题 算法标签: