#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main()
{
	long int n,k,i,j,l;
	int flag;
	cin >> n>>k;
	long long int a[n],min;
	for(i=0;i<n;i++)
		cin >> a[i];
	for(l=0;l<k;l++)
	{ 	flag=0;
		min=1000000001;
		for(j=0;j<n;j++)
		{
			if(a[j]!=0)
				flag=1;
			if((a[j]<min)&&a[j]!=0)
				min=a[j];
		}
		if(flag==0)
		{
			for(int m=l;m<k;m++)
				cout <<0<<endl;
			return 0;
		}

		if(min==1000000001)
			min=0;
		cout <<min<<endl;
		for(i=0;i<n;i++)
				if(a[i]!=0)
					a[i]-=min;
	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main()
{
	long int n,k,i,j,l;
	cin >> n>>k;
	long long int a[n],min;
	for(i=0;i<n;i++)
		cin >> a[i];
	for(l=0;l<k;l++)
	{
		min=1000000001;
		for(j=0;j<n;j++)
			if((a[j]<min)&&(a[j]!=0))
				min=a[j];
		if(min==1000000001)
			min=0;
		cout <<min<<endl;
		for(i=0;i<n;i++)
			if(a[i]!=0)
				a[i]-=min;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
	long int n,k,i,j,l;
	cin >> n>>k;
	long long int a[n],min;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
	}
	sort(a,a+n);
	for(i=0;i<k;i++)
	{	min=0;
		for(j=0;j<n;j++)
		{
			if(a[j]!=0)
			{
				min=a[j];break;
			}

		}

		cout <<min<<endl;
		if(min!=0)
			for(l=j;l<n;l++)
				a[l]-=min;
	}
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
	long int n,k,i,j,l;
	cin >> n>>k;
	long long int a[n],min;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
	}
	sort(a,a+n);
	for(i=0;i<k;i++)
	{	min=0;
		if(a[n]==0)
		{
			cout <<0<<endl;continue;
		}
		for(j=0;j<n;j++)
		{
			if(a[j]!=0)
			{
				min=a[j];break;
			}

		}

		cout <<min<<endl;
		if(min!=0)
			for(l=j;l<n;l++)
				a[l]-=min;
	}
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
	long int n,k,i,j,l,s=-1;
	int flag=0;
	cin >> n>>k;
	long int a[n],min;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
	}
	sort(a,a+n);

	for(i=0;i<k;i++)
	{	min=0;
		if(a[n-1]==0)
		{
			cout <<0<<endl;continue;
		}
		for(j=s+1;j<n;j++)
		{
			if(a[j]!=0)
			{
				s=j;
				min=a[j];break;
			}

		}

		cout <<min<<endl;
		if(min!=0)
			for(l=j;l<n;l++)
				a[l]-=min;
	}
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
	long int n,k,i,j,l;
	int flag=0;
	cin >> n>>k;
	long int a[n],min;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]!=0)
			flag=1;
	}
	if(flag==1)
		sort(a,a+n);
	for(i=0;i<k;i++)
	{	min=0;
		if(a[n-1]==0)
		{
			cout <<0<<endl;continue;
		}
		for(j=0;j<n;j++)
		{
			if(a[j]!=0)
			{
				min=a[j];break;
			}

		}

		cout <<min<<endl;
		if(min!=0)
			for(l=j;l<n;l++)
				a[l]-=min;
	}
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v, int &index, int pos, int last_min)
{
	int min = 0;

	for (; pos < v.size(); pos++)
		if (v[pos] - last_min > 0)
		{
			min = v[pos];
			index = pos;
			return min;
		}

	return min;
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v;

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		if(find(v.begin(), v.end(), next) == v.end())
			v.push_back(next);
	}

	int min = 0;
	int index = -1;

	sort(v.begin(), v.end());

	for (int i = 0; i < k; i++)
	{
		if (min >= 0)
		{
			int cur_min = min_elem(v, index, index + 1, min);
			if (cur_min > 0)
			{
				cout << cur_min - min;
				min = cur_min;
			}
			else
			{
				cout << 0;
				min = -1;
			}
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v, int &index, int pos, int last_min)
{
	int min = 0;

	for (; pos < v.size(); pos++)
		if (v[pos] - last_min > 0)
		{
			min = v[pos];
			index = pos;
			return min;
		}

	return min;
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	int min = 0;
	int index = 0;

	sort(v.begin(), v.end());

	for (int i = 0; i < k; i++)
	{
		if (min >= 0)
		{
			int cur_min = min_elem(v, index, index + 1, min);
			if (cur_min > 0)
			{
				cout << cur_min - min;
				min = cur_min;
			}
			else
			{
				cout << 0;
				min = -1;
			}
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v, int &index, int pos, int last_min)
{
	int min = 0;

	for (; pos < v.size(); pos++)
		if (v[pos] - last_min > 0)
		{
			min = v[pos];
			index = pos;
			return min;
		}

	return min;
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	int min = 0;
	int index = 0;

	sort(v.begin(), v.end());

	for (int i = 0; i < k; i++)
	{
		if (min >= 0)
		{
			int cur_min = min_elem(v, index, index, min);
			if (cur_min > 0)
			{
				cout << cur_min - min;
				min = cur_min;
			}
			else
			{
				cout << 0;
				min = -1;
			}
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	int min = 0;

	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());

	for (int i = 0; i < k; i++)
	{
		if (i == 0)
			cout << v[i];
		else if (i < v.size())
			cout << v[i] - v[i - 1];
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v, int &index, int pos, int last_min)
{
	int min = 0;

	for (; pos < v.size(); pos++)
		if (v[pos] - last_min > 0)
		{
			min = v[pos];
			index = pos;
			return min;
		}

	return min;
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	int min = 0;
	int index = -1;

	unique(v.begin(), v.end());
	sort(v.begin(), v.end());

	for (int i = 0; i < k; i++)
	{
		if (min >= 0)
		{
			int cur_min = min_elem(v, index, index + 1, min);
			if (cur_min > 0)
			{
				cout << cur_min - min;
				min = cur_min;
			}
			else
			{
				cout << 0;
				min = -1;
			}
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v)
{
	int min = numeric_limits<int>::max();

	for (int i = 0; i < v.size(); i++)
		if (v[i] < min)
			min = v[i];

	return min;
}

void erase_zeros(vector<int> &v)
{
	while (find(v.begin(), v.end(), 0) != v.end())
		v.erase(find(v.begin(), v.end(), 0));
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	erase_zeros(v);

	int min;
	int index = -1;
	for (int i = 0; i < k; i++)
	{
		if (v.size() > 0)
		{
			min = min_elem(v);
			index = distance(v.begin(), find(v.begin(), v.end(), min));

			cout << min;

			for (int i = 0; i < v.size(); i++)
				v[i] -= min;

			erase_zeros(v);
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int min_elem(vector<int> v, int &index, int pos, int last_min)
{
	int min = 0;

	for (; pos < v.size(); pos++)
		if (v[pos] - last_min > 0)
		{
			min = v[pos];
			index = pos;
			return min;
		}

	return min;
}

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> v(n);

	for (int i = 0; i < n; i++)
	{
		int next;
		cin >> next;
		v[i] = next;
	}

	int min = 0;
	int index = -1;

	sort(v.begin(), v.end());

	for (int i = 0; i < k; i++)
	{
		if (min >= 0)
		{
			int cur_min = min_elem(v, index, index + 1, min);
			if (cur_min > 0)
			{
				cout << cur_min - min;
				min = cur_min;
			}
			else
			{
				cout << 0;
				min = -1;
			}
		}
		else
			cout << 0;

		if (i < k - 1)
			cout << endl;
	}

	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,h=0;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(k<n){

      for(i=0;i<n && h<k;i++){
//cout<<"in i" <<i<<"a[i]-smallest is "<<a[i]-smallest<<endl;
    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }

        return 0;
    }
    for(i=0;i<n && n<=k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    for(i=h;i<k;i++)
        cout<<'0'<<endl;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,h=0;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<n && i<=k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    if(n<k)
    for(i=h;i<k;i++)
        cout<<'0'<<endl;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main(){
int n,k,i,smallest,l=0;
int a[100000],kh[100000];
bool t =false;
cin>>n;
cin>>k;
for(i=0;i<n;i++){
    cin>>a[i];
}
while(!t){
     /*   if(n==0){
        cout<<'0'<<endl;
    continue;
    }*/
smallest=a[0];
for(i=0;i<n;i++){
    if(smallest>a[i]){
        smallest=a[i];
    }
}
kh[l]=smallest;
l++;
//cout<<smallest<<endl;
for(i=0;i<n;i++){
a[i]=a[i]-smallest;
}

for(i=0;i<n;i++){
bool h=false;
if(a[i]==0){
    for(int j=i;j<n;j++)
        a[j]=a[j+1];
        h=true;
}
if (h)
    n--;
}
if(n==0){
while(l<k){
kh[l]=0;
l++;
}
t=true;
}

}
for(l=0;l<k;l++){
cout<<kh[l]<<endl;
}
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main(){
int n,k,i,smallest=0,l=0,smallest2;
int a[100000],kh[100000];
bool t =false;
cin>>n;
cin>>k;
for(i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n);
for(i=0;(i<n ) || (i<k && k>=n);i++){
        if(a[i]>0 && i<n){
            if(a[i]-smallest==0)
            continue;
       cout<<a[i]-smallest<<endl;}
  else
    cout<<'0'<<endl;

    smallest2=a[i]-smallest;
    smallest=smallest2+smallest;
    }
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int a[100000];
int main(){
int n,k,i,smallest;
cin>>n;
cin>>k;
for(i=0;i<n;i++){
    cin>>a[i];
}
for(int l=1;l<=k;l++){
        if(n==0){
        cout<<'0'<<endl;
    continue;
    }
smallest=a[0];
for(i=0;i<n;i++){
    if(smallest>a[i]){
        smallest=a[i];
    }
}
cout<<smallest<<endl;
for(i=0;i<n;i++){
a[i]=a[i]-smallest;
}

for(i=0;i<n;i++){
bool h=false;
if(a[i]==0){
    for(int j=i;j<n;j++)
        a[j]=a[j+1];
        h=true;
}
if (h)
    n--;
}
}

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,h=0;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<n && h<=k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    if(n<k)
    for(i=h;i<k;i++)
        cout<<'0'<<endl;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,h=0;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<n && h<k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    if(n<k)
    for(i=h;i<k;i++)
        cout<<'0'<<endl;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,smallest2;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<n && i<=k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    if(n<k)
    for(i=n;i<k;i++)
        cout<<'0'<<endl;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,a[100000],i,smallest;
cin>>n;
cin>>k;
for(i=0;i<n;i++){
    cin>>a[i];
}
for(int l=1;l<=k;l++){
        if(n==0){
        cout<<'0'<<endl;
    continue;
    }
smallest=a[0];
for(i=0;i<n;i++){
    if(smallest>a[i]){
        smallest=a[i];
    }
}
cout<<smallest<<endl;
for(i=0;i<n;i++){
a[i]=a[i]-smallest;
}

for(i=0;i<n;i++){
bool h=false;
if(a[i]==0){
    for(int j=i;j<n;j++)
        a[j]=a[j+1];
        h=true;
}
if (h)
    n--;
}
}

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,i,smallest=0,l=0,h=0;
    int a[100000],kh[100000];
    bool t =false;
    cin>>n;
    cin>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<n && i<=k;i++){

    if(a[i]!=0 && a[i]-smallest>0){
            h++;
        cout<<a[i]-smallest<<endl;
    smallest=a[i];
    }

    }
    if(n<k)
    for(i=h;i<=k;i++)
        cout<<'0'<<endl;

}


#include <bits/stdc++.h>

using namespace std;
int a[9999999];
int main()
{
	int n, k, j = 0, x = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
	sort(a, a + n);
	for(int i = 0; i < k; i++)
		{
			while(a[j] - x == 0 && j < n - 1)
				{
					j ++;
				}
			cout << a[j] - x << '\n';
			x = a[j];
		}
}


#include <bits/stdc++.h>

using namespace std;
int a[30000];
int main()
{
	int n, k, j = 0, x = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
	sort(a, a + n);
	for(int i = 0; i < k; i++)
		{
			while(a[j] - x == 0 && j < n - 1)
				{
					j ++;
				}
			cout << a[j] - x << '\n';
			x = a[j];
		}
}


#include <bits/stdc++.h>

typedef long long ll;

using namespace std;
int a[30000], n, d, k, t, mn;
int main ()
{
	cin >> n >> d;
	t = n;
	mn = 100000;
	for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			mn = min(a[i], mn);
		}
	while (d--)
		{
			cout << mn << '\n';
			if (t > 1)
			{
				for (int i = 1; i <= n; i++)
					{
						a[i] -= mn;
					}
				mn = 100000;
				for (int i = 1; i <= n; i++)
					{
						if (a[i] > 0)
							mn = min(a[i], mn);
					}
				t--;
			}
			else
				if (t == 1)
					mn = 0;
		}
}


def arr_inp():
    return [str(x) for x in stdin.readline().split()]

from sys import stdin
from collections import defaultdict

mem = defaultdict(int)
ans, ans2, last = 0, 0, 0
for i in range(int(input())):
    sign, num = arr_inp()
    if sign == '-':
        if not mem[num]:
            ans2 += 1
        else:
            mem[num] = 0
    else:
        mem[num] = 1
        ans += 1
        if ans > ans2:
            ans -= 1
            ans2 += 1
    last = sign
    # ans2 = max(ans, ans2)
print(ans2)


def arr_inp():
    return [str(x) for x in stdin.readline().split()]

from sys import stdin

pos, neg, ans = [0] * 3
for i in range(int(input())):
    sign, num = arr_inp()
    if sign == '+':
        neg = 0
        pos += 1
    else:
        neg += 1
        pos = 0
    ans = max(pos, neg, ans)
print(ans)


def arr_inp():
    return [str(x) for x in stdin.readline().split()]

from sys import stdin
from collections import defaultdict

mem = defaultdict(int)
ans, ans2, last = 0, 0, 0
for i in range(int(input())):
    sign, num = arr_inp()
    if last == 0:
        ans += 1
        last = sign
        if sign == '+':
            mem[num] = 1
    elif sign == '+':
        mem[num] = 1
        if last == '+':
            ans += 1
        else:
            ans = 1
    else:
        if mem[num] == 0:
            ans += 1
    last, ans2 = sign, max(ans, ans2)

print(ans2)


d=set()
m=0
for _ in range(int(input())):
	x,i=input().split()
	if x=="-":
		if i in d:d.remove(i)
		else:m+=1
	else:
	  d.add(i)
	m=max(m,len(d))
print(m)


c=[]
n=int(input())
ma=k=0
for i in range(n):
 a,b=input().split()
  if a<"-":k+=1;c+=[b]
  else:
   if c.find(b)<0:ma+=1
   else:k-=1;c.pop(b)
  ma=max(ma,k)
print(ma)


c=[0]*1000001
n=int(input())
mi=ma=k=0
for i in range(n):
   a,b=input().split()
   b=int(b)
   if a=="+": k+=1; c[b]=1
   else:
      if c[b]: k-=1; c[b]=0
      else: ma+=1
   ma=max(ma,k)
   mi=min(mi,k)
print(ma-mi)


c=[]
n=int(input())
ma=k=0
for i in range(n):
 a,b=input().split()
 if a<"-":k+=1;c+=[b]
 else:
  if c.find(b)<0:ma+=1
  else:k-=1;c.pop(b)
 ma=max(ma,k)
print(ma)


c=[]
n=int(input())
ma=k=0
for i in range(n):
 a,b=input().split()
  if a<"-":k+=1;c+=[b]
  else:
   if c.find(b)<0:ma+=1
   else:k-=1;pop(b)
  ma=max(ma,k)
print(ma)


c=[0]*1000001
n=int(input())
mi=ma=k=0
for i in range(n):
   a,b=input().split()
   b=int(b)
   if a=="+": k+=1; c[b]=1
   else:
      if c[b]: k-=1; c[b]=0
      else: mi-=1
   ma=max(ma,k)
   mi=min(mi,k)
print(ma-mi)


c=[0]*1000001
n=int(input())
ma=k=0
for i in range(n):
   a,b=input().split()
   b=int(b)
   if a=="+": k+=1; c[b]=1
   else:
      if c[b]: k-=1; c[b]=0
      else: ma+=1
   ma=max(ma,k)
print(ma)


c=[]
n=int(input())
ma=k=0
for i in range(n):
 a,b=input().split()
 if a<"-":k+=1;c+=[b]
 else:
  p=c.find(b)
  if p<0:ma+=1
  else:k-=1;c.pop(p)
 ma=max(ma,k)
print(ma)


c=[]
n=int(input())
ma=k=0
for i in range(n):
 a,b=input().split()
 if a<"-":k+=1;c+=[b]
 else:
  if c.count(b):k-=1;c.remove(b)
  else:ma+=1
 ma=max(ma,k)
print(ma)


In = set(); Out = set(); ans = 0
for t, r in [input().split() for i in range(int(input()))]:
    if t == '+':
        In.add(r)
    else:
        ans = max(ans, len(In))
        if r in In:
            In.remove(r)
        else:
            ans += 1
ans = max(ans, len(In))
print(ans)


def main():
    n = int(input())

    result = 0
    d = set()
    for i in range(n):
        t, a = input().split()
        a = int(a)
        if t == "+":
            d.add(a)
            result = max(result, len(d))
        else:
            if a in d:
                d.remove(a)
            else:
                result += 1

    print(result)

main()


n=int(input())

cache={}
a=[set() for i in range(n+1)]

for i in range(n):
    inputs=input().split()
    operation=inputs[0]=='+'
    id=int(inputs[1])

    a[i+1]=a[i].copy()

    if cache.get(id)==None:
        cache[id]=True if operation else None

    if operation:
        a[i+1].add(id)
    else:
        if not cache.get(id):
            for j in range(0,i+2):
                a[j].add(id)
        a[i+1].remove(id)

mx=0
for i in a:
    if len(i)>mx:
        mx=len(i)

print(mx)


n = int(input())
visitors = set()
max_size = 0
for i in range(n):
	action, id = input().split()
	id = int(id)
	if action == '-':
		if id in visitors:
			visitors.remove(id)
		else:
			max_size += 1
	else:
		visitors.add(id)
		max_size = max(max_size, len(visitors))
print(max_size)


import os
from math import*

t=int(input())
ans=0
count=0
arr=[]
while t:
	#print(ans,count,arr)
	if count>ans:
		ans=count
	t-=1
	s=input()
	#print(s,s[0])
	if s[0]=="+":
		count+=1
		arr.append(s[2:])
	else:
		if s[2:] in arr:
			count-=1
		else:
			ans+=1
print(max(ans,count))


import os
from math import*

t=int(input())
ans=0
count=0
arr=[]
while t:
	#print(ans,count,arr)
	if count>ans:
		ans=count
	t-=1
	s=input()
	#print(s,s[0])
	if s[0]=="+":
		count+=1
		arr.append(s[2:])
	else:
		if s[2:] in arr:
			count-=1
		else:
			ans+=1
print(ans)


n = int(input())
has = []
ans = 0
for i in range(n):
    c,x = input().split()
    x = int(x)
    if c=="+":
        has+=c
    else:
        if x in has:
            has.remove(x)
        else:
            ans+=1
    ans = max(ans,len(has))
print(ans)


n = int(input())
has = []
ans = 0
for i in range(n):
    c,x = input().split()
    if c=="+":
        has.append(x)
    else:
        if x in has:
            has.remove(x)
        else:
            ans+=1
    ans = max(ans,len(has))
print(ans)


n = int(input())
has = []
ans = 0
for i in range(n):
    c,x = input().split()
    if c=="+":
        has+=x
    else:
        if x in has:
            has.remove(x)
        else:
            ans+=1
    ans = max(ans,len(has))
print(ans)


n= int(input())
mas = set()
submas=set()
ma=0

l = list()
for i in range(n):
    sob = input().split(" ")
    l.append(sob)
    if sob[0]=="+":
        mas.add(sob[1])
    if sob[0]=="-":
        if sob[1] in mas:
            mas.remove(sob[1])
        else:
            submas.add(sob[1])
ma=max(len(submas),ma)
for i in l:
    if i[0]=="+":
        submas.add(i[1])
        ma=max(len(submas),ma)
    if i[0]=="-":
        submas.remove(i[1])

print(ma)


import sys
input = sys.stdin.readline

n, cnt, res = int(input()), 0, 0
s = [0 for i in range(int(1e6)+5)]
for i in range(n):
    op, x = input()[:-1].split(); x = int(x)
    if op == '+': s[x] = 1; cnt += 1
    else:
        if s[x] == 0: res += 1
        else: s[x] = 0; cnt -= 1
    if cnt > res: res = cnt
print(res)


n = int(input())
people = []
current = 0
num = [0]
for i in range(n):
    x, y = input().split()
    if x == "+":
        people.append(y)
        current += 1
        num.append(current)
    else:
        try:
            people.remove(y)
            current -= 1
        except:
            num = [*map(lambda x : x + 1, num)]
        num.append(current)
print(max(num))


n = int(input())
people = []
current = 0
num = [0]
for i in range(n):
    x, y = input().split()
    if x == "+":
        people.append(y)
        current += 1
        num.append(current)
    else:
        try:
            people.remove(y)
        except:
            pass
        current -= 1
        num.append(current)
num = [*map(lambda x : x - min(num + [0]), num)]
print(max(num))


#include<iostream>
using namespace std;
int main(){
 int t;
 cin>>t;
 while(t--){
  long int t;
  cin>>t;
  if(t<30)
  cout<<"NO"<<endl;
  if(t>=30){
  cout<<"YES"<<endl;
  cout<<6<<" "<<10<<" "<<14<<" "<<t-30<<endl;}
 }
 return 0;
}


#include<iostream>
using namespace std;
int main(){
 int t;
 cin>>t;
 while(t--){
  long int t;
  cin>>t;
  if(t<30)
  cout<<"NO"<<endl;
  if(t>=30)
  cout<<6<<" "<<10<<" "<<14<<" "<<t-30<<endl;
 }
 return 0;
}


#include<iostream>
using namespace std;
int main(){
 int t;
 cin>>t;
 while(t--){
  long int t;
  cin>>t;
  if(t<30)
  cout<<"NO"<<endl;
  if(t>=30){
   cout<<"YES"<<endl;
  }
  cout<<6<<" "<<10<<" "<<14<<" "<<t-30<<endl;}
 }
 return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int c=3,x=0;
		while((n-(2*c)) > 0)
		{
            n=n-(2*c);
            x++;
            if(x==3)
              break;
            c=c+2;
		}
		if(x==3)
		{
		  if(n==14)
		    cout<<"YES\n"<<"6 10 15 "<<n-1<<endl;
          else
		    cout<<"YES\n"<<"6 10 14 "<<n<<endl;
	    }
        else
          cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int c=3,x=0;
		while((n-(2*c)) > 0)
		{
            n=n-(2*c);
            x++;
            if(x==3)
              break;
            c=c+2;
		}
		if(x==3)
		{
		  if(n==14)
		    cout<<"YES\n"<<"6 10 15 "<<n-1<<endl;
          else if(n==6)
            cout<<"YES\n"<<"5 10 14 "<<n+1<<endl;
          else
		    cout<<"YES\n"<<"6 10 14 "<<n<<endl;
	    }
        else
          cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int c=3,x=0;
		while((n-(2*c)) > 0)
		{
            n=n-(2*c);
            x++;
            if(x==3)
              break;
            c=c+2;
		}
		if(x==3)
		{
		  if(n==14)
		    cout<<cout<<"YES\n"<<"6 10 15 "<<n-1<<endl;
          else
		    cout<<"YES\n"<<"6 10 14 "<<n<<endl;
	    }
        else
          cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		if(n<=30)
		  cout<<"NO"<<endl;
		else
		{
			if((n-30)!=6 && (n-30)!=10 && (n-30)!=14)
			  cout<<"YES\n"<<"6 10 14 "<<n-30<<endl;
	        else
	          cout<<"YES\n"<<"6 10 15 "<<n-31<<endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int c=3,x=0;
		while((n-(2*c)) > 0)
		{
            n=n-(2*c);
            x++;
            if(x==3)
              break;
            c=c+2;
		}
		if(x==3)
		  cout<<"YES\n"<<"6 10 14 "<<n<<endl;
        else
          cout<<"NO"<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main()
{
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		if(n<=30)
		  cout<<"NO";
		else
		{
			if((n-30)!=6 && (n-30)!=10 && (n-30)!=14)
			  cout<<"YES\n"<<"6 10 14 "<<n-30<<endl;
	        else
	          cout<<"YES\n"<<"6 10 15 "<<n-31<<endl;
		}
	}
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                int n=n-30;
                for(int i=1;i<=5;i++)
                {
                    if((n+i)%3==0 && (n+i)/3>3)
                    {
                        cout<<"YES"<<endl<<(n+i)/3<<" "<<10<<" "<<14<<" "<<n-24-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%5==0 && (n+i)/5!=5 && (n+i)/5>2 )
                    {
                        cout<<"YES"<<endl<<(n+i)/5<<" "<<6<<" "<<14<<" "<<n-20-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%7==0 && (n+i)/7!=7 && (n+i)/7>2)
                    {
                        cout<<"YES"<<endl<<(n+i)/7<<" "<<10<<" "<<6<<" "<<n-16-(n+i)<<endl;
                        break;
                    }
                }
            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            cout<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<-1<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                n=n-30;
                //cout<<n;
                if(n>=9)
                {

                    cout<<"YES"<<endl<<15<<" "<<10<<" "<<14<<" "<<n-39<<endl;
                    continue;
                }
                if(n>=7)
                {
                    cout<<"YES"<<endl<<6<<" "<<10<<" "<<21<<" "<<n-37<<endl;
                    continue;
                }
                if(n>=5)
                {
                    cout<<"YES"<<endl<<6<<" "<<15<<" "<<14<<" "<<n-35<<endl;
                    continue;
                }

            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                int n=n-30;
                for(int i=1;i<=;i++)
                {
                    if((n+i)%3==0 && (n+i)/3>3)
                    {
                        cout<<"YES"<<endl<<(n+i)/3<<" "<<10<<" "<<14<<" "<<n-24-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%5==0 && (n+i)/5!=5 && (n+i)/5>2 )
                    {
                        cout<<"YES"<<endl<<(n+i)/5<<" "<<6<<" "<<14<<" "<<n-20-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%7==0 && (n+i)/7!=7 && (n+i)/7>2)
                    {
                        cout<<"YES"<<endl<<(n+i)/7<<" "<<10<<" "<<6<<" "<<n-16-(n+i)<<endl;
                        break;
                    }
                }
            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                n=n-30;
                cout<<n;
                if(n>=9)
                {

                    cout<<"YES"<<endl<<15<<" "<<10<<" "<<14<<" "<<n+6-15<<endl;
                    continue;
                }
                if(n>=7)
                {
                    cout<<"YES"<<endl<<6<<" "<<10<<" "<<21<<" "<<n+14-21<<endl;
                    continue;
                }
                if(n>=5)
                {
                    cout<<"YES"<<endl<<6<<" "<<15<<" "<<14<<" "<<n+10-15<<endl;
                    continue;
                }

            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                n=n-30;
                //cout<<n;
                if(n>=9)
                {

                    cout<<"YES"<<endl<<15<<" "<<10<<" "<<14<<" "<<n+6-15<<endl;
                    continue;
                }
                if(n>=7)
                {
                    cout<<"YES"<<endl<<6<<" "<<10<<" "<<21<<" "<<n+14-21<<endl;
                    continue;
                }
                if(n>=5)
                {
                    cout<<"YES"<<endl<<6<<" "<<15<<" "<<14<<" "<<n+10-15<<endl;
                    continue;
                }

            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;
int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int power(int x,  int y, int p){
    int res = 1;      // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1; // y = y/2
            x = (x*x) % p;
    }
    return res;
}

int mod_inv(int a,int m){
    a=a%m;
    return power(a,m-2,m)%MOD;
}

int lcm(int a, int b){
    return (a*b)/gcd(a, b);
}

bool mod(double a,double b) {
    return a/b - floor(a/b);}

int logb(int base, int x) {
    return (log(x) / log(base));
}
char ToLower(char c)
{
    if ((c >= 'A') && (c <= 'Z')) return (char)((int)c - 'A' + 'a');
    else return c;
}

int Vowel(char c)
{
    c = ToLower(c);
    return (c == 'a') || (c == 'o') || (c == 'i') || (c == 'y') || (c == 'u') || (c == 'e');
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{
    if(a.first!=b.first)
    return a.first<b.first;
    return a.second>b.second;
}
int countSetBits(int x)
{
    if(x==0)return 0;
    else return 1+countSetBits(x&(x-1));
}
int fact(int n);

int nCr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int n;
bool in_range(int x,int y)
{
    if(x>=0 && x<=n-1 && y>=0 && y<=n-1)return true;

    return false;
}
bool palindrom(string s)
{
    int len=s.length();
    bool okay=true;
    for(int i=0;i<=len/2;i++)
    {
        if(s[i]!=s[len-i-1]){okay=false; break;}
    }
    return okay;
}
signed main()
{
    fastio;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>30)
        {
            int num1=6;
            int num2=10;
            int num3=14;
            set<int> s;
            s.insert(num1);
            s.insert(num2);
            s.insert(num3);
            if(s.find(n-30)!=s.end())
            {
                n=n-30;
                //cout<<n;
                for(int i=1;i<=5;i++)
                {
                    if((n+i)%3==0 && (n+i)/3>3)
                    {
                        cout<<"YES"<<endl<<(n+i)<<" "<<10<<" "<<14<<" "<<n+6-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%5==0 && (n+i)/5!=5 && (n+i)/5>2 )
                    {
                        cout<<"YES"<<endl<<(n+i)<<" "<<6<<" "<<14<<" "<<n+10-(n+i)<<endl;
                        break;
                    }
                    if((n+i)%7==0 && (n+i)/7!=7 && (n+i)/7>2)
                    {
                        cout<<"YES"<<endl<<(n+i)<<" "<<10<<" "<<6<<" "<<n+14-(n+i)<<endl;
                        break;
                    }
                }
            }
            else cout<<"YES"<<endl<<6<<" "<<10<<" "<<14<<" "<<n-30<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>19&&n-19!=(4||6||9))cout << "YES\n" << 4 << ' ' << 6 << ' ' << 8 << ' ' << n-19 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>19&&n-19!=4&&n-19!=6&&n-19!=9)cout << "YES\n" << 4 << ' ' << 6 << ' ' << 9 << ' ' << n-19 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>18&&n-18!=(4||6||8))cout << "YES\n" << 4 << ' ' << 6 << ' ' << 8 << ' ' << n-18 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>12)cout << "YES\n" << 4 << ' ' << 4 << ' ' << 4 << ' ' << n-12 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>19&&n-18!=(4||6||9))cout << "YES\n" << 4 << ' ' << 6 << ' ' << 8 << ' ' << n-19 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>30){
            if(n-30!=6&&n-30!=10&&n-30!=14)cout << "YES\n" << 6 << ' ' << 10 << ' ' << 14 << ' ' << n-30 << '\n';
            else cout << "YES\n" << 6 << ' ' << 10 << ' ' << 15 << ' ' << n-31 << '\n';
        }
        else cout << "NO\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {

    int t,n;
    cin >> t;
    while(t--){
        cin >> n;
        if(n>19&&n-19!=4&&n-19!=6&&n-19!=9)cout << "YES\n" << 4 << ' ' << 6 << ' ' << 8 << ' ' << n-19 << '\n';
        else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n < 30) {
			cout << "NO\n";
		}
		else {
			if (n == 30) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << endl;
			}
			else if (n == 31) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << " " << n-31 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n <= 30) {
			cout << "NO\n";
		}
		else {
			if (n == 36 || n == 40 || n == 44) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << " " << n-31 << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << n-30 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n < 30) {
			cout << "NO\n";
		}
		else {
			if (n == 30) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << " " << n-31 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n < 30) {
			cout << "NO\n";
		}
		else {
			if (n == 30) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << endl;
			}
			else if (n == 31) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << 1 << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << " " << n-31 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n <= 30) {
			cout << "NO\n";
		}
		else {
			else if (n == 36 || n == 40 || n == 44) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 15 << " " << n-31 << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << n-30 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long lld;

int main() {
	int tc;
	cin >> tc;
	while (tc--) {
		int n;
		cin >> n;
		if (n < 30) {
			cout << "NO\n";
		}
		else {
			if (n == 30) {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << endl;
			}
			else {
				cout << "YES\n";
				cout << 6 << " " << 10 << " " << 14 << " " << n-30 << endl;
			}
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if((n<31)||(n==41)||(n==37)||(n==47))
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }

	    if(n>31)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if(n<31||n==37)
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }
	    if(n>31&&n!=37)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if((n<31))
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }
	    if(n==41)
	    {
	        cout<<"YES"<<endl;
	        cout<<"6 10 11 14"<<endl;
	        continue;
	    }
	    if(n==37)
	    {

	        cout<<"YES"<<endl;
	        cout<<"6 7 10 14"<<endl;
	        continue;
	    }
	    if(n==47)
	    {
	        cout<<"YES"<<endl;
	        cout<<"6 10 14 17"<<endl;
	        continue;

	    }
	    if(n>31)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if(n<31)
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }
	    if(n==37)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 2"<<endl;
	        continue;
	    }
	    if(n>31)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if((n<31)||(n==41)||(n==47))
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }
	    if(n==41)
	    {
	        cout<<"YES"<<endl;
	        cout<<"6 10 11 14"<<endl;
	        continue;
	    }
	    if(n==37)
	    {

	        cout<<"YES"<<endl;
	        cout<<"6 7 10 14"<<endl;
	        continue;
	    }
	    if(n>31)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    if((n<31))
	    {
	        cout<<"NO"<<endl;
	        continue;
	    }
	    if(n==31)
	    {
	        cout<<"YES"<<endl;
	        cout<<"14 10 6 1"<<endl;
	        continue;
	    }
	    if(n==41)
	    {
	        cout<<"YES"<<endl;
	        cout<<"6 10 11 14"<<endl;
	        continue;
	    }
	    if(n==37)
	    {

	        cout<<"YES"<<endl;
	        cout<<"6 7 10 14"<<endl;
	        continue;
	    }
	    if(n==46)
	    {
	        cout<<"YES"<<endl;
	        cout<<"6 10 14 16"<<endl;
	        continue;

	    }
	    if(n>31)
	    {
	        cout<<"YES"<<endl;
	        cout<<6<<" "<<10<<" "<<15<<" "<<n-31<<endl;
	        continue;
	    }
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int t,n;
	cin>>t;
	while(t--)
	{
		cin>>n;

		if(n<=30) {cout<<"NO\n";continue;}
		else if(n!=44&&n!=36&&n!=40){cout<<"YES\n6 10 14 "<<n-30<<endl;}
		else{cout<<"YES\n6 10 15 "<<n-31<<endl;}

	}
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        long long int n;
        cin>>n;
        if(n <= 30){
            cout<<"NO\n";
            continue;
        }
        if(n==36 || n==40 || n==44){
            cout<<"6 10 14 "<<n-31<<"\n";
            continue;
        }
        vector<int> nearly;
        nearly.push_back(6);nearly.push_back(10);nearly.push_back(14);
        long long int sum = accumulate(nearly.begin(),nearly.end(),0);
        long long int last = n - sum;
        for(auto i : nearly){
            cout<<i<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        long long int n;
        cin>>n;
        vector<long long int> primes;
        for (long long int i = 2; i <= n; i++)
        {
            long long int c = 0;
            for (long long int j = 1; j <= i; j++)
            {
                if (i % j == 0)
                {
                    c++;
                }
            }

            if (c == 2)
            {
                primes.push_back(i);
            }
        }
        vector<long long int> nearly;
        for(long long int i=0;i<primes.size();i++){
            for(long long int j=i+1;j<primes.size();j++){
                if (primes[i] * primes[j] < n)
                    nearly.push_back(primes[i] * primes[j]);
            }
        }
        if(nearly.size() < 3){
            cout<<"NO\n";
            continue;
        }
        sort(nearly.begin(),nearly.end());
        vector<long long int> ans;set<long long int> s;
        for(long long int i=0;i<3;i++){
            ans.push_back(nearly[i]);
        }
        s.insert(ans[0]);
        s.insert(ans[1]);
        s.insert(ans[2]);
        long long int sum = accumulate(ans.begin(),ans.end(),0);
        long long int last = n - sum;
        s.insert(last);
        if(s.size() != 4){
            if(nearly.size() < 4){
                cout<<"NO\n";
                continue;
            }
            if(last==ans[0]){
                // cout<<last<<" "<<ans[0];
                ans[2] = nearly[3];
                // cout<<nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
                // cout<<last;
            }else if(last == ans[1]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }else if(last == ans[2]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }
        }
        if(last < 0){
            cout<<"NO\n";
            continue;
        }
        cout << "YES\n";
        for(long long int i=0;i<3;i++){
            cout<<ans[i]<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
long long int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        long long int n;
        cin>>n;
        vector<long long int> primes;
        for (long long int i = 2; i <= n; i++)
        {
            long long int c = 0;
            for (long long int j = 1; j <= i; j++)
            {
                if (i % j == 0)
                {
                    c++;
                }
            }

            if (c == 2)
            {
                primes.push_back(i);
            }
        }
        vector<long long int> nearly;
        for(long long int i=0;i<primes.size();i++){
            for(long long int j=i+1;j<primes.size();j++){
                if (primes[i] * primes[j] < n)
                    nearly.push_back(primes[i] * primes[j]);
            }
        }
        if(nearly.size() < 3){
            cout<<"NO\n";
            continue;
        }
        sort(nearly.begin(),nearly.end());
        vector<long long int> ans;set<long long int> s;
        for(long long int i=0;i<3;i++){
            ans.push_back(nearly[i]);
        }
        s.insert(ans[0]);
        s.insert(ans[1]);
        s.insert(ans[2]);
        long long int sum = accumulate(ans.begin(),ans.end(),0);
        long long int last = n - sum;
        s.insert(last);
        if(s.size() != 4){
            if(nearly.size() < 4){
                cout<<"NO\n";
                continue;
            }
            if(last==ans[0]){
                // cout<<last<<" "<<ans[0];
                ans[2] = nearly[3];
                // cout<<nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
                // cout<<last;
            }else if(last == ans[1]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }else if(last == ans[2]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }
        }
        if(last < 0){
            cout<<"NO\n";
            continue;
        }
        cout << "YES\n";
        for(long long int i=0;i<3;i++){
            cout<<ans[i]<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> primes;
        for (int i = 2; i <= n; i++)
        {
            int c = 0;
            for (int j = 1; j <= i; j++)
            {
                if (i % j == 0)
                {
                    c++;
                }
            }

            if (c == 2)
            {
                primes.push_back(i);
            }
        }
        vector<int> nearly;
        for(int i=0;i<primes.size();i++){
            for(int j=i+1;j<primes.size();j++){
                if (primes[i] * primes[j] < n)
                    nearly.push_back(primes[i] * primes[j]);
            }
        }
        if(nearly.size() < 3){
            cout<<"NO\n";
            continue;
        }
        sort(nearly.begin(),nearly.end());
        vector<int> ans;
        for(int i=0;i<3;i++){
            ans.push_back(nearly[i]);
        }
        int sum = accumulate(ans.begin(),ans.end(),0);
        int last = n - sum;
        if(last < 0){
            cout<<"NO\n";
            continue;
        }
        cout<<"YES\n";
        for(int i=0;i<3;i++){
            cout<<ans[i]<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> primes;
        for (int i = 2; i <= n; i++)
        {
            int c = 0;
            for (int j = 1; j <= i; j++)
            {
                if (i % j == 0)
                {
                    c++;
                }
            }

            if (c == 2)
            {
                primes.push_back(i);
            }
        }
        vector<int> nearly;
        for(int i=0;i<primes.size();i++){
            for(int j=i+1;j<primes.size();j++){
                if (primes[i] * primes[j] < n)
                    nearly.push_back(primes[i] * primes[j]);
            }
        }
        if(nearly.size() < 3){
            cout<<"NO\n";
            continue;
        }
        sort(nearly.begin(),nearly.end());
        vector<int> ans;set<int> s;
        for(int i=0;i<3;i++){
            ans.push_back(nearly[i]);
        }
        s.insert(ans[0]);
        s.insert(ans[1]);
        s.insert(ans[2]);
        int sum = accumulate(ans.begin(),ans.end(),0);
        int last = n - sum;
        s.insert(last);
        if(s.size() != 4){
            if(nearly.size() < 4){
                cout<<"NO\n";
                continue;
            }
            if(last==ans[0]){
                // cout<<last<<" "<<ans[0];
                ans[2] = nearly[3];
                // cout<<nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
                // cout<<last;
            }else if(last == ans[1]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }else if(last == ans[2]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }
        }
        if(last < 0){
            cout<<"NO\n";
            continue;
        }
        cout << "YES\n";
        for(int i=0;i<3;i++){
            cout<<ans[i]<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        long long int n;
        cin>>n;
        if(n <= 30){
            cout<<"NO\n";
            continue;
        }
        if(n==36 || n==40 || n==44){
            cout<<"YES\n";
            cout<<"6 10 14 "<<n-31<<"\n";
            continue;
        }
        vector<int> nearly;
        nearly.push_back(6);nearly.push_back(10);nearly.push_back(14);
        long long int sum = accumulate(nearly.begin(),nearly.end(),0);
        long long int last = n - sum;
        cout<<"YES\n";
        for(auto i : nearly){
            cout<<i<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int> primes;
        for (int i = 2; i <= n; i++)
        {
            int c = 0;
            for (int j = 1; j <= i; j++)
            {
                if (i % j == 0)
                {
                    c++;
                }
            }

            if (c == 2)
            {
                primes.push_back(i);
            }
        }
        vector<int> nearly;
        for(int i=0;i<primes.size();i++){
            for(int j=i+1;j<primes.size();j++){
                if (primes[i] * primes[j] < n)
                    nearly.push_back(primes[i] * primes[j]);
            }
        }
        if(nearly.size() < 3){
            cout<<"NO\n";
            continue;
        }
        sort(nearly.begin(),nearly.end());
        vector<int> ans;set<int> s;
        for(int i=0;i<3;i++){
            ans.push_back(nearly[i]);
        }
        s.insert(ans[0]);
        s.insert(ans[1]);
        s.insert(ans[2]);
        int sum = accumulate(ans.begin(),ans.end(),0);
        int last = n - sum;
        s.insert(last);
        if(s.size() != 4){
            if(nearly.size() < 4){
                cout<<"NO\n";
                continue;
            }
            if(last==ans[0]){
                // cout<<last<<" "<<ans[0];
                ans[2] = nearly[3];
                // cout<<nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
                // cout<<last;
            }else if(last == ans[1]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }else if(last == ans[2]){
                ans[2] = nearly[3];
                last = n - accumulate(ans.begin(),ans.end(),0);
            }
        }
        if(last < 0){
            cout<<"NO\n";
            continue;
        }
        cout << "YES\n";
        for(int i=0;i<3;i++){
            cout<<ans[i]<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        long long int n;
        cin>>n;
        if(n <= 30){
            cout<<"NO\n";
            continue;
        }
        if(n==36 || n==40 || n==44){
            cout<<"YES\n";
            cout<<"6 10 15 "<<n-31<<"\n";
            continue;
        }
        vector<int> nearly;
        nearly.push_back(6);nearly.push_back(10);nearly.push_back(14);
        long long int sum = accumulate(nearly.begin(),nearly.end(),0);
        long long int last = n - sum;
        cout<<"YES\n";
        for(auto i : nearly){
            cout<<i<<" ";
        }
        cout<<last<<"\n";
    }
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,38,39};
   int d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=15;
   }
   d=n-(x+y+z);
   int k=3;
   while(d>0 && ( d==x || d==y || d==z))
   {
       z=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }
   if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }
   cout<<"YES"<<endl;
   cout<<x<<" "<<y<<" "<<z<<" "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,39};
   int d=n-x+y+z;
   int k=3;
   while(d>0 && ( d==x || d==y || d==z))
   {
       x=arr[k++];
       d=n-x+y+z;
       if(d<0)
        break;
   }
   if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }
   cout<<"YES"<<endl;
   cout<<"6 "<<"10 "<<"14 "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,39};
   int d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=15;
   }
   d=n-(x+y+x);
   //int k=3;
  /* while(d>0 && ( d==x || d==y || d==z))
   {
       x=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }*/
   /*if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }*/
   cout<<"YES"<<endl;
   cout<<x<<" "<<y<<" "<<z<<" "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int k=6+10+14;
   int d=n-k;
   if(d==6 || d==10 || d==14)
    {
        cout<<"NO"<<endl;
        return;
    }
   cout<<"YES"<<endl;
   cout<<"6 "<<"10 "<<"14 "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,39};
   int d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=15;
   }
   d=n-(x+y+z);
   //int k=3;
  /* while(d>0 && ( d==x || d==y || d==z))
   {
       x=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }*/
   /*if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }*/
   cout<<"YES"<<endl;
   cout<<x<<" "<<y<<" "<<z<<" "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,39};
   int d=n-(x+y+z);
   int k=3;
   while(d>0 && ( d==x || d==y || d==z))
   {
       x=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }
   if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }
   cout<<"YES"<<endl;
   cout<<"6 "<<"10 "<<"14 "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int k=6+10+14;
   int d=n-k;
   cout<<"YES"<<endl;
   cout<<"6 "<<"10 "<<"14 "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,38,39};
   int d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=15;
   }
   d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=21;
   }
   d=n-(x+y+z);

  /* int k=3;
   while(d>0 && ( d==x || d==y || d==z))
   {
       z=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }*/
   if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }
   cout<<"YES"<<endl;
   cout<<x<<" "<<y<<" "<<z<<" "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<string.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<unordered_set>
#include<set>

using namespace std;

#define ll              long long int
#define llu             long long unsigned int
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define vi              vector<int>
#define vl              vector<ll>
#define vii             vector<pii>
#define vll             vector<pll>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vector<int>,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007 //1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(k,n)        for(int i=k;i<n;i++)
#define clr(x)          memset(x, 0, sizeof(x))
#define PI              3.1415926535897932384626
#define boost           ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)

void solve()
{
   //printf("debug..\n");
   int n;
   cin>>n;
   if(n<=30)
   {
       cout<<"NO"<<endl;
       return;
   }
   int x=6,y=10,z=14;
   int arr[]={6,10,14,15,21,35,22,26,33,38,39};
   int d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=15;
   }
   d=n-(x+y+z);
   if(d==x || d==y || d==z)
   {
       z=21;
   }
   d=n-(x+y+z);

  /* int k=3;
   while(d>0 && ( d==x || d==y || d==z))
   {
       z=arr[k++];
       d=n-(x+y+z);
       if(d<0)
        break;
   }*/
   if(d<0)
   {
       cout<<"NO"<<endl;
       return;
   }
   cout<<"YES"<<endl;
   cout<<x<<" "<<y<<" "<<z<<" "<<d<<endl;

}
int main()
{
  #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif
   boost;

   int t=1;
   cin>>t;
   while(t--)
     solve();
   return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{

            cout<<"YES\n";
            if(n==36)
                cout<<"5 6 10 15"<<"\n";
            else if(n==44)
                cout<<"6 10 15 13"<<"\n";
            else if(n==40)
                cout<<"6 14 15 5"<<"\n";
            else{
                cout<<"6 10 14 "<<n-30<<"\n";
            }
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{

            cout<<"YES\n";
            if(n-30!=14)
                cout<<"6 10 14 "<<n-30<<"\n";
            else{
                cout<<"6 10 15 "<<n-31<<"\n";
            }
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{
            cout<<"YES\n";
            cout<<"6 10 14 "<<n-30<<"\n";
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{
            cout<<"6 10 14 "<<n-30<<"\n";
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{

            cout<<"YES\n";
            if(n==36)
                cout<<"5 6 10 15"<<"\n";
            else{
                cout<<"6 10 14 "<<n-30<<"\n";
            }
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n<31)
        {
            cout<<"No\n";
        }
        else{

            cout<<"YES\n";
            if(n-30!=14)
                cout<<"6 10 14 "<<n-30<<"\n";
            else{
                cout<<"6 10 15 "<<n-30<<"\n";
            }
        }
        //cout<<count<<"\n";
    }
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n>30){
            if(n==36){
                cout<<"NO"<<endl;
            } else if(n==40){
                cout<<"YES"<<endl<<"6 14 15 5"<<endl;
            } else if(n==44){
                cout<<"YES"<<endl<<"6 10 15 13"<<endl;
            } else
                cout<<"YES"<<endl<<"6 10 14 "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n>30){}
            if(n==36){
                cout<<"NO"<<endl;
            } else if(n==40){
                cout<<"YES"<<endl<<"6 14 15 5"<<endl;
            } else if(n==44){
                cout<<"YES"<<endl<<"6 10 15 13"<<endl;
            } else
                cout<<"YES"<<endl<<"6 10 14 "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n>30){
            if(n==36){
                cout<<"YES"<<endl<<"6 10 15 5"<<endl;
            } else if(n==40){
                cout<<"YES"<<endl<<"6 14 15 5"<<endl;
            } else if(n==44){
                cout<<"YES"<<endl<<"6 10 15 13"<<endl;
            } else
                cout<<"YES"<<endl<<"6 10 14 "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n>30){
            cout<<"YES"<<endl<<"6 10 14 "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n==36){
            cout<<"NO"<<endl;
        } else if(n==40){
            cout<<"YES"<<endl<<"6 14 15 5"<<endl;
        } else if(n==44){
            cout<<"YES"<<endl<<"6 10 15 13"<<endl;
        } else if(n>30){
            cout<<"YES"<<endl<<"6 10 14 "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t=0, n=0;
    cin>>t;
    while(t--){
        cin>>n;
        if(n>30){
            cout<<"YES"<<endl<<"6, 10, 14, "<<(n-30)<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
void solve(){
	int n;
	cin>>n;
	if(n<30)
		cout<<"NO"<<endl;
	else{
		cout<<"YES"<<endl;
		if(abs(n-30)==6 || abs(n-30)==14 ||abs(n-30)==10)
			cout<<"6 "<<"15 "<<"14 "<<abs(n-35)<<endl;
		else
			cout<<"6 "<<"10 "<<"14 "<<abs(n-30)<<endl;
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
		solve();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
void solve(){
	int n;
	cin>>n;
	if(n<30)
		cout<<"NO"<<endl;
	else{
		cout<<"YES"<<endl;
		cout<<"6 "<<"10 "<<"14 "<<abs(n-30)<<endl;
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
		solve();
}