#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

//#define for(i,a,b) for(int i=a ; i<=b ; i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
const int N = (int)1e6 + 7;

//std::priority_queue<int>q;
//vector<int>iterator it;
//ll a[N];
//vector<int>v;
int main()
{
  set<int>set;
  int t,n,a[200005],k;
  cin>>t;
  while(t--)
  {
    cin>>n;
   for(int i=0;i<n;i++)
   {
      cin>>k;
      set.insert(k);

   }
  int size=set.size();
  if (size<n)
  cout<<1<<endl;
  else
  cout<<n<<endl;
  set.clear();

  }
   return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;

int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n];
        for(ll i =0;i<n;i++)
        cin>>a[i];
        ll ans = *max_element(a,a+n)-*min_element(a,a+n);
        if(ans>0)
        cout<<1<<endl;
        else
        cout<<n<<endl;

    }
}


#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        list<int>q;
        for(int i =0;i<n;i++)
        {
            ll x;
            cin>>x;
            q.pb(x);
        }
        q.sort();
        while(!q.empty())
        {
            ll a = q.front(),b=q.back();

            if(q.size()==1)
            break;
            if(a==b)
            break;
            else
            {
                q.pop_back();
                q.pop_front();
                q.pb(a + b);
            }
        }
        cout<<q.size()<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        list<int>q;
        for(int i =0;i<n;i++)
        {
            int x;
            cin>>x;
            q.pb(x);
        }
        q.sort();
        while(!q.empty())
        {
            int a = q.front(),b=q.back();

            if(q.size()==1)
            break;
            if(a==b)
            break;
            else
            {
                q.pop_back();
                q.pop_front();
                q.pb(a + b);
            }
        }
        cout<<q.size()<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        list<int>q;
        for(int i =0;i<n;i++)
        {
            ll x;
            cin>>x;
            q.pb(x);
        }
        q.sort();
        if(q.front()==q.back())cout<<n<<endl;
        else
            cout<<1<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        list<int>q;
        for(int i =0;i<n;i++)
        {
            ll x;
            cin>>x;
            q.pb(x);
        }
        q.sort();
       #include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        list<int>q;
        for(int i =0;i<n;i++)
        {
            ll x;
            cin>>x;
            q.pb(x);
        }
        q.sort();
        if(q.front()==q.back())cout<<n<<endl;
        else
            cout<<1<<endl;

    }
    return 0;
}
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
        }
        for (long int k = 1; k<n; k++)
        {
            if (a[k]! = a[k-1])
            {
                flag++;
            }
        }
        if (flag == 0)
        {
            cout<<n<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
            if (j==0)
            {
                test = a[j];
            }
            else
            {
                if (a[j] != test)
                {
                    flag++;
                    break;
                }
            }
        }
        if (flag == 0)
        {
            cout<<n<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
            if (j==0)
            {
                test = a[j];
            }
            else
            {
                if (a[j] != test)
                {
                    flag++;
                    break;
                }
            }
        }
        if (flag == 0)
        {
            cout<<n;
        }
        else
        {
            cout<<1;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
        }
        for (long int k = 1; k<n; k++)
        {
            if (a[k] != a[k-1])
            {
                flag++;
            }
        }
        if (flag == 0)
        {
            cout<<n<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
            if (j==0)
            {
                test = a[j];
            }
            else
            {
                if (a[j] != test)
                {
                    flag++;
                    break;
                }
            }
        }
        if (flag == 0)
        {
            cout<<n<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for (int i=1; i<=t; i++)
    {
        long int n;
        cin>>n;
        long int a[n], test;
        int flag = 0;
        for (long int j = 0; j<n; j++)
        {
            cin>>a[j];
            if (j==0)
            {
                test = a[j];
            }
            else
            {
                if (a[j] != test)
                {
                    flag++;
                    break;
                }
            }
        }
        if (flag == 0)
        {
            cout<<n;
        }
        else
        {
            cout<<1;
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int t,n,i,a[200000],flag;
	cin>>t;
	while(t--)
	{
		cin>>n;
		flag=0;
		for(i=0;i<n;i++)
		 cin>>a[i];
		for(i=0;i<n-1;i++)
		{
		  if(a[i]!=a[i+1])
		   {
		   	 flag=1;
		   	 cout<<"1\n";
			 break;
		   }
	    }
	    if(flag==0)
	 cout<<n<<endl;
    }
 return 0;
}


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

using namespace std;

int main()
{
	/*vector<int>* a = new vector<int>;
	a->push_back(10);
	a->push_back(4);
	a->push_back(20);

	a->insert(a->begin() + 1, 100);

	a->erase(a->begin());
	a->erase(a->begin()+)

	for (int i = 0; i < a->size(); i++) {
		cout << a->at(i) << endl;
	}*/

	int* n_tests = new int;
	cin >> *n_tests;

	vector<int>* answers = new vector<int>;

	for (int w = 0; w < *n_tests; w++) {

		int* n_nums = new int;
		cin >> *n_nums;

		int* nums = new int[*n_nums];

		for (int i = 0; i < *n_nums; i++) {
			cin >> nums[i];
		}

		for (int i = 0; i < *n_nums; i++) {
			if (nums[i] == 0) {
				continue;
			}
			for (int j = 0; j < *n_nums; j++) {
				if (nums[j] == 0) {
					continue;
				}
				if (nums[i] != nums[j]) {
					nums[i] = nums[i] + nums[j];
					nums[j] = 0;
				}
			}
		}
		int* count = new int(0);

		for (int i = 0; i < *n_nums; i++) {
			if (nums[i] == 0) {
				continue;
			}
			*count += 1;
		}

		answers->push_back(*count);
		delete[] nums;
		delete n_nums;

	}

	delete n_tests;

	for (int i = 0; i < answers->size(); i++) {
		cout << answers->at(i) << endl;
	}
	delete answers;

}


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

using namespace std;

int main()
{
	/*vector<int>* a = new vector<int>;
	a->push_back(10);
	a->push_back(4);
	a->push_back(20);

	a->insert(a->begin() + 1, 100);

	a->erase(a->begin());
	a->erase(a->begin()+)

	for (int i = 0; i < a->size(); i++) {
		cout << a->at(i) << endl;
	}*/

	int* n_tests = new int;
	cin >> *n_tests;

	vector<int>* answers = new vector<int>;

	for (int w = 0; w < *n_tests; w++) {

		int* n_nums = new int;
		cin >> *n_nums;

		int* nums = new int[*n_nums];

		for (int i = 0; i < *n_nums; i++) {
			cin >> nums[i];
		}
		bool* goh = new bool(false);
		for (int i = 0; i < *n_nums; i++) {
			if (nums[i] == 0) {
				continue;
			}
			for (int j = 0; j < *n_nums; j++) {
				if (nums[j] == 0) {
					continue;
				}
				if (nums[i] != nums[j]) {
					*goh = true;
					nums[i] = nums[i] + nums[j];
					nums[j] = 0;
				}
			}
			if (!*goh) {
				break;
			}
		}
		int* count = new int(0);
		if (!*goh) {
			answers->push_back(*goh);
			delete[] nums;
			delete n_nums;
			delete count;
			delete goh;
			continue;
		}

		for (int i = 0; i < *n_nums; i++) {
			if (nums[i] == 0) {
				continue;
			}
			*count += 1;
		}

		answers->push_back(*count);
		delete[] nums;
		delete n_nums;
		delete count;
		delete goh;

	}

	delete n_tests;

	for (int i = 0; i < answers->size(); i++) {
		cout << answers->at(i) << endl;
	}
	delete answers;

}


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

using namespace std;

void min_max(int* arr, int* size, int* min, int* max) {

	for (int i = 0; i < *size; i++) {
		if (arr[i] > * max) {
			*max = arr[i];
		}
		if (arr[i] < *min) {
			*min = arr[i];
		}
	}

}

int main()
{
	/*vector<int>* a = new vector<int>;
	a->push_back(10);
	a->push_back(4);
	a->push_back(20);

	a->insert(a->begin() + 1, 100);

	a->erase(a->begin());
	a->erase(a->begin()+)

	for (int i = 0; i < a->size(); i++) {
		cout << a->at(i) << endl;
	}*/

	int* n_tests = new int;
	cin >> *n_tests;

	vector<int>* answers = new vector<int>;

	for (int w = 0; w < *n_tests; w++) {

		int* n_nums = new int;
		cin >> *n_nums;

		int* nums = new int[*n_nums];

		for (int i = 0; i < *n_nums; i++) {
			cin >> nums[i];
		}

		int* min = new int(9999999999);
		int* max = new int(-9999999999);

		min_max(nums, n_nums, min, max);

		delete[] nums;

		if (*min == *max) {
			answers->push_back(*n_nums);
		}
		else {
			answers->push_back(1);
		}

		delete n_nums;

	}

	delete n_tests;

	for (int i = 0; i < answers->size(); i++) {
		cout << answers->at(i) << endl;
	}
	delete answers;

}


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

using namespace std;

int main()
{

	int* n_tests = new int;
	cin >> *n_tests;

	vector<int>* answers = new vector<int>;

	for (int w = 0; w < *n_tests; w++) {

		int* n_nums = new int;
		cin >> *n_nums;

		vector<int>* nums = new vector<int>;

		for (int i = 0; i < *n_nums; i++) {
			int* temp = new int;
			cin >> *temp;
			nums->push_back(*temp);
			delete temp;
		}

		sort(nums->begin(), nums->end());

		for (int i = 0; i < *n_nums; i++) {
			for (int j = nums->size() - 1; j > 0; j--) {
				if (nums->at(j) != nums->at(j - 1)) {
					int* temp = new int;
					*temp = nums->at(j) + nums->at(j - 1);
					nums->erase(nums->begin() + j);
					nums->erase(nums->begin() + j - 1);
					nums->push_back( *temp);
					delete temp;
				}
			}
		}

		answers->push_back(nums->size());

		delete nums;
		delete n_nums;

	}

	delete n_tests;

	for (int i = 0; i < answers->size(); i++) {
		cout << answers->at(i) << endl;
	}
	delete answers;

}


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

using namespace std;

int main()
{

	int* n_tests = new int;
	cin >> *n_tests;

	vector<int>* answers = new vector<int>;

	for (int w = 0; w < *n_tests; w++) {

		int* n_nums = new int;
		cin >> *n_nums;

		vector<int>* nums = new vector<int>;

		for (int i = 0; i < *n_nums; i++) {
			int* temp = new int;
			cin >> *temp;
			nums->push_back(*temp);
			delete temp;
		}

		for (int i = 0; i < *n_nums; i++) {
			int* j = new int(0);
			while (true) {
				if (*j == nums->size() - 1) { break; }
				if (nums->at(*j) != nums->at(*j + 1)) {
					int* temp = new int;
					*temp = nums->at(*j) + nums->at(*j + 1);
					nums->erase(nums->begin() + *j + 1);
					nums->erase(nums->begin() + *j);
					nums->insert(nums->begin() + *j, *temp);
					delete temp;
				}
			}
			delete j;
		}
		answers->push_back(nums->size());

		delete nums;
		delete n_nums;

	}

	delete n_tests;

	for (int i = 0; i < answers->size(); i++) {
		cout << answers->at(i) << endl;
	}
	delete answers;

}


#include <iostream>
#include <algorithm>
using namespace std;
int t,n[100];
long long a[100][200000];
void input()
{
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>n[i];
        for(int j=0;j<n[i];j++)cin>>a[i][j];
    }
}
int ans(int i)
{
    long long s=0,m=0;
    for(int j=0;j<n[i];j++)m=max(m,a[i][j]);
    for(int j=0;j<n[i];j++)
    {
        if(a[i][j]==m)
        {
            if(((j>0)&&(a[i][j-1]<m))||((j<n[i]-1)&&(a[i][j+1]<m)))return(1);
        }
    }
    return(n[i]);
}
void output()
{
    for(int i=0;i<t;i++)cout<<ans(i)<<endl;
}
int main()
{
    input();
    output();
}


#include <iostream>

using namespace std;
int t,n[100];
long long a[100][200000];
void input()
{
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>n[i];
        for(int j=0;j<n[i];j++)cin>>a[i][j];
    }
}
int ans(int i)
{
    long long s=0,m=0;
    for(int j=0;j<n[i];j++)m=max(m,a[i][j]);
    for(int j=0;j<n[i];j++)
    {
        if(a[i][j]==m)
        {
            if(((j>0)&&(a[i][j-1]<m))||((j<n[i]-1)&&(a[i][j+1]<m)))return(1);
        }
    }
    return(n[i]);
}
void output()
{
    for(int i=0;i<t;i++)cout<<ans(i)<<endl;
}
int main()
{
    input();
    output();
}


// 0.cpp : Questo file contiene la funzione 'main', in cui inizia e termina l'esecuzione del programma.
//

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int T;
	cin >> T;

	while (T--)
	{
		int n;
		cin >> n;
		vector<int> a(n);

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

		int i;
		for (i = 1; i < n; i++)
		{
			if (a[0] != a[i])
			{
				cout << 1 << endl;
				break;
			}
		}
		if(i >= n)
			cout << a.size() << endl;
	}
}


// 0.cpp : Questo file contiene la funzione 'main', in cui inizia e termina l'esecuzione del programma.
//

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int T;
	cin >> T;

	while (T--)
	{
		int n;
		cin >> n;
		vector<int> a(n);

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

		for (int i = 1; i < n; i++)
		{
			if (a[0] != a[i])
			{
				cout << 1 << endl;
				break;
			}
		}

		cout << a.size() << endl;
	}
}


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

using namespace std;

void solve() {
	int n;
	cin >> n;
	int first_num;
	cin >> first_num;
	int tmp;
	bool one = true;
	for (size_t i = 1; i < n; ++i) {
		cin >> tmp;
		if (first_num != tmp) {
			one = false;
		}
	}
	if (one) {
		cout << n << "\n";
	}
	else {
		cout << 1 << "\n";
	}
	return;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	cin >> t;
	while (t--)solve();
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb;
typedef vector<ull> vul;
typedef vector<pair<ll, ll>> vpl;
typedef pair<ll, ll> pl;
#define For(i, n) for(ll i = 0; i < n; i++)
#define len(n) (ll)(n).size()
#define Sort(a) sort(a.begin(), a.end())
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t, n;
	cin >> t;
	while (t--) {
		cin >> n;
		vl a(n);
		For(i, n) cin >> a[i];
		bool fl = true;
		For(i, n) {
			if (a[i] != a[0]) {
				fl = false;
			}
		}
		if (fl) {
			cout << n << endl;
		}
		else {
			cout << 1 << endl;
		}
	}
	return 0;
}


// codeforces A. Omkar and Password.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <vector>

int main()
{
    int test_case = 0;
    std::cin >> test_case;
    for (int i = 0; i < test_case; i++) {
        int number = 0, max = 0, max_num = 0;
        std::cin >> number;

        std::vector<int> arr(number, 0);
        for (int j = 0; j < number; j++) {
            std::cin >> arr[j];
            max = arr[j] > max ? arr[j] : max;
            if (arr[j] == max) {
                max_num++;
            }
            else
            {
                max_num = 1;
            }
        }

        if (arr.size() == max_num) {
            std::cout << max_num << std::endl;
        }
        else {
            std::cout << 1 << std::endl;
        }
    }
    return 0;
}

// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门使用技巧:
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件


// codeforces A. Omkar and Password.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <vector>

int main()
{
    int test_case = 0;
    std::cin >> test_case;
    for (int i = 0; i < test_case; i++) {
        int number = 0;
        std::cin >> number;

        bool flag = true;
        std::vector<int> arr(number, 0);
        for (int j = 0; j < number; j++) {
            std::cin >> arr[j];
            if (j - 1 >= 0 && arr[j - 1] != arr[j]) {
                flag = false;
            }
        }

        if (flag) {
            std::cout << arr.size() << std::endl;
        }
        else {
            std::cout << 1 << std::endl;
        }
    }
    return 0;
}

// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门使用技巧:
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件


#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>

#define F first
#define S second
#define PB push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t, n;
    cin >> t;
    for (int j = 0; j < t; j++)
    {
        cin >> n;
        int counter = 0, prev=0;
        for (int i = 0; i < n; i++)
        {
            int a;
            cin >> a;
            if (i != 0 && prev != a)
            {
                counter++;
            }

            prev = a;

        }
        if (counter != 0)
        {
            cout << 1 << "\n";
        }
        else
        {
            cout << n << "\n";
        }
    }
    return 0;
}


#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <iomanip>
#include <float.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ll long long

#define FOR(i,a,b)        for(ll i=(a);i<(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SORT(v)            sort((v).begin(),(v).end())
#define UN(v)            SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define CL(a,b)            memset(a,b,sizeof a)
#define pb                push_back

#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif

using namespace std;

//#define N 1000009
ll denom = 1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=denom; for(;b;b>>=1){if(b&1)res=res*a%denom;a=a*a%denom;}return res;}

int main(int argc, const char * argv[])
{
    ios_base::sync_with_stdio(false);
    ll t; cin >> t;
    REP(i, t) {
        ll n; cin >> n;
        vector<ll> a(n); REP(j, n) cin >> a[j];
        bool flag = true;
        FOR(j, 1, n) if (a[0] != a[j]) {flag = false; break;}
        if (!flag) cout << 1 << endl;
        else cout << n << endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <set>

using namespace std;

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int _;
	cin >> _;
	while (_--) {
		long long int n;
		cin >> n;
		set <long long int> a;
		for (int i =0 ; i < n; ++i) {
			long long int tmp;
			cin >> tmp;
			a.insert(tmp);
		}
		if (a.size() == 1) {
			cout << n;
		}
		else {
			cout << 1;
		}
		cout << "\n";

	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
    int t,n,a;
    cin >> t;
    for(int i = 0; i < t;i++){
        cin >> n;
        bool tf = true;
        cin >> a;
        int temp = a;
        for(int j = 0; j < n - 1;j++){
        cin >> a;
        if(temp != a)
            tf = false;
        temp = a;
        }
        if(tf)
        cout << n << '\n';
        else
        cout << 1 << '\n';
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <long long> func(vector <long long>& a) {
	vector <long long> temp;
	int pok = 0;
	for (int i = 0; i < a.size(); i++) {
		temp.push_back(a[i]);
		if (i + 1 == a.size() - 1 && a[i] != a[i + 1]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
		else if (i + 1 < a.size() - 1 && a[i] != a[i + 1] && a[i] + a[i + 1] != a[i + 2]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
	}
	return temp;
}

bool equal(vector <long long>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		if (a[i] != a[i + 1])
			return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		long long n;
		cin >> n;
		vector <long long> a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		vector <long long> temp;
		bool r;
		temp = func(a);
		while (!equal(temp)) {
			temp = func(temp);
		}
		cout << temp.size() << endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <long long> func(vector <long long>& a) {
	vector <long long> temp;
	int pok = 0;
	for (int i = 0; i < a.size(); i++) {
		temp.push_back(a[i]);
		if (i + 2 < a.size() && a[i] != a[i + 1] && a[i] + a[i + 1] != a[i + 2]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
		else if (i + 1 == a.size() - 1 && a[i] != a[i + 1]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
	}
	return temp;
}

bool equal(vector <long long>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		if (a[i] != a[i + 1])
			return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		long long n;
		cin >> n;
		vector <long long> a(n);
		bool r = false;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			if (i > 0 && a[i] != a[i - 1])
				r = true;
		}
		if (r)
			cout << 1 << endl;
		else
			cout << n << endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <long long> func(vector <long long>& a) {
	vector <long long> temp;
	int pok = 0;
	for (int i = 0; i < a.size(); i++) {
		temp.push_back(a[i]);
		if (i + 2 < a.size() && a[i] != a[i + 1] && a[i] + a[i + 1] != a[i + 2]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
		else if (i + 1 == a.size() - 1 && a[i] != a[i + 1]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
	}
	return temp;
}

bool equal(vector <long long>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		if (a[i] != a[i + 1])
			return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		long long n;
		cin >> n;
		vector <long long> a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		vector <long long> temp = a;
		if (!equal(temp))
			temp = func(temp);
		while (!equal(temp)) {
			temp = func(temp);
		}
		cout << temp.size() << endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <long long> func(vector <long long>& a) {
	vector <long long> temp;
	int pok = 0;
	for (int i = 0; i < a.size(); i++) {
		temp.push_back(a[i]);
		if (i + 2 < a.size() && a[i] != a[i + 1] && a[i] + a[i + 1] != a[i + 2]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
		else if (i + 1 < a.size() && a[i] != a[i + 1]) {
			temp[i - pok] = a[i] + a[i + 1];
			pok++;
			i++;
		}
	}
	return temp;
}

bool equal(vector <long long>& a) {
	for (int i = 0; i < a.size() - 1; i++) {
		if (a[i] != a[i + 1])
			return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--) {
		long long n;
		cin >> n;
		vector <long long> a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		vector <long long> temp = a;
		temp = func(temp);
		while (!equal(temp)) {
			temp = func(temp);
		}
		cout << temp.size() << endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#define endl "\n"

using ll = long long;
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> V(n);
        for (auto &it : V)cin >> it;
        sort(V.begin(), V.end());
        if (V.front() == V.back())cout << n << endl;
        else cout << 1 << endl;
    }

    return 0;
}


#include <stdio.h>
int t, n, m, x;
int a[200000];
int main() {
	scanf("%d", &t);
	for (int q = 0; q < t; q++) {
		scanf("%d", &n);
		m = 0;
		x = 0;
		for (int i = 0; i < n; i++) {
			scanf("%d", a + i);
			if (a[i] > m)m = a[i];
		}
		for (int i = 0; i < n; i++) {
			if (a[i] == m)x++;
		}
		if (x == n)printf("%d\n", x);
		else printf("1\n");
	}
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include <queue>
#include <deque>
#include <numeric>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long LL;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< LL > vl;
typedef vector< vl > vvl;
typedef vector< bool > vb;
typedef pair <int, int> ii;
#define tr(c,it) for(decltype(c.begin()) it = c.begin(); it != c.end(); it++)
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define in(a,b) ( (b).find(a) != (b).end())

void solve();

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;

	rep(tt, t) {
		cout << "Case #" << tt+1 << ": ";
		solve();
		cout << '\n';
	}
}

void solve() {
	int n, a, b, c;
	cin >> n >> a >> b >> c;

	int da = a-c, db = b-c;
	if (da+db+c > n || c < 1) {
		cout << "IMPOSSIBLE";
	}
	else if (n == 1) {
		if (c == 1 && a == 1 && b == 1)
			cout << 1;
		else
			cout << "IMPOSSIBLE";
	}
	else if (n == 2) {
		if (c == 1 && (da+db) == 1) {
			cout << (da>0 ? "1 2" : "2 1");
		}
		else cout << "IMPOSSIBLE";
	}
	else {
		int hidden = n - c - da - db;
		if (da + db == 0) {
			if (c == 1)
				cout << "IMPOSSIBLE";
			else {
				cout << 2 << ' ';
				rep(i, hidden) cout << 1 << ' ';
				rep(i, c-1) cout << 2 << ' ';
			}
		}
		else {
			rep(i, da) cout << 2 << ' ';
			if (da > 0) rep(i, hidden) cout << 1 << ' ';
			rep(i, c) cout << 3 << ' ';
			if (da == 0) rep(i, hidden) cout << 1 << ' ';
			rep(i, db) cout << 2 << ' ';
		}
	}
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include <queue>
#include <deque>
#include <numeric>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long LL;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< LL > vl;
typedef vector< vl > vvl;
typedef vector< bool > vb;
typedef pair <int, int> ii;
#define tr(c,it) for(decltype(c.begin()) it = c.begin(); it != c.end(); it++)
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define in(a,b) ( (b).find(a) != (b).end())

void solve();

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	bool HAST = true;

	if (HAST) {
		int t;
		cin >> t;

		rep(tt, t) {
			solve();
			cout << '\n';
		}
	}
	else {
		solve();
	}
}

void solve() {
	int n, a, b;
	cin >> n;

	bool valid = 1;
	cin >> a;
	rep(i, n-1) {
		cin >> b;
		if (b != a) valid = 0;
	}

	cout << (valid ? n : 1);
}


#include <iostream>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <memory>
#include <iterator>
#include <stdexcept>
#include <utility>
#include <string>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

template<typename T>
string convert(T t) {
    ostringstream out;
    out << t;
    return out.str();
}

string convert(string s) {
    return '"' + s + '"';
}

string convert(const char* s) {
    string out("\"");
    return out + s + "\"";
}

template<typename T, typename V>
string convert(pair<T, V> p) {
    return "(" + convert(p.first) + ' ' + convert(p.second) + ")";
}

template<class Iterator>
string convert(Iterator start, Iterator end) {
    string out = "";
    out += '{';
    for (Iterator s = start; s != end; s++) {
        out += convert(*s) + ' ';
    }
    out += '}';
    return out;
}
template<typename T> string convert(vector<T> container) { return convert(container.begin(), container.end()); }
template<typename T> string convert(set<T> container) { return convert(container.begin(), container.end()); }
template<typename T, typename V> string convert(map<T, V> container) { return convert(container.begin(), container.end()); }
template<typename T> string convert(unordered_set<T> container) { return convert(container.begin(), container.end()); }
template<typename T, typename V> string convert(unordered_map<T, V> container) { return convert(container.begin(), container.end()); }

template<typename... Args>
void debug(int id, Args... args) {
    cout << '(' << id << "):";
    ostream* rubbish[] = { &(cout << ' ' << convert(args))... };
    cout << '\n';
}

template<typename T = int>
vector<T> listinput(int length) {
    vector<T> out(length);
    for (int i = 0; i < length; i++) {
        cin >> out[i];
    }
    return out;
}

template<typename T = int>
vector<T> listinput() {
    int length;
    cin >> length;
    return listinput<T>(length);
}

template<typename T = int>
vector<vector<T>> gridinput(int rows, int cols) {
    vector<vector<T>> out(rows, vector<T>(cols));
    for (int r = 0; r < rows; r++) {
        for (int c = 0; c < cols; c++) {
            cin >> out[r][c];
        }
    }
    return out;
}

int main() {
    vector<int> stones = listinput();
    vector<int> DP(stones.size(), 0);

    DP[0] = 0;
    DP[1] = DP[0] + abs(stones[0] - stones[1]);

    for (int i = 2; i < stones.size(); i++) {
        DP[i] = min(DP[i - 1] + abs(stones[i] - stones[i-1]), DP[i - 2] + abs(stones[i] - stones[i-2]));
    }

    cout << DP[stones.size() - 1] << '\n';
}


#include <iostream>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <memory>
#include <iterator>
#include <stdexcept>
#include <utility>
#include <string>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

#define testcases int testcases;\
cin >> testcases;\
for (int testcase = 0; testcase < testcases; testcase++)

#define input(...) long __VA_ARGS__;\
inputhelper(__VA_ARGS__);

template<typename T>
string convert(T t) {
    ostringstream out;
    out << t;
    return out.str();
}

string convert(string s) {
    return '"' + s + '"';
}

string convert(const char* s) {
    string out("\"");
    return out + s + "\"";
}

template<typename T, typename V>
string convert(pair<T, V> p) {
    return "(" + convert(p.first) + ' ' + convert(p.second) + ")";
}

template<class Iterator>
string convert(Iterator start, Iterator end) {
    string out = "";
    out += '{';
    for (auto s = start; s != end; s++) {
        out += convert(*s) + ' ';
    }
    out += '}';
    return out;
}
template<typename T> string convert(vector<T> container) { return convert(container.begin(), container.end()); }
template<typename T> string convert(set<T> container) { return convert(container.begin(), container.end()); }
template<typename T, typename V> string convert(map<T, V> container) { return convert(container.begin(), container.end()); }
template<typename T> string convert(unordered_set<T> container) { return convert(container.begin(), container.end()); }
template<typename T, typename V> string convert(unordered_map<T, V> container) { return convert(container.begin(), container.end()); }

template<typename... Args>
void debug(int id, Args... args) {
    cout << '(' << id << "):";
    ostream* rubbish[] = { &(cout << ' ' << convert(args))... };
    cout << '\n';
}

template<typename T = int>
vector<T> listinput(int length) {
    vector<T> out(length);
    for (int i = 0; i < length; i++) {
        cin >> out[i];
    }
    return out;
}

template<typename T = int>
vector<T> listinput() {
    int length;
    cin >> length;
    return listinput<T>(length);
}

template<typename T>
void inputhelper(T& t) {
    cin >> t;
}

template<typename... Args, typename T>
void inputhelper(T& t, Args&...args) {
    cin >> t;
    inputhelper(args...);
}

template<typename T = int>
vector<vector<T>> gridinput(int rows, int cols) {
    vector<vector<T>> out(rows, vector<T>(cols));
    for (int r = 0; r < rows; r++) {
        for (int c = 0; c < cols; c++) {
            cin >> out[r][c];
        }
    }
    return out;
}

int main() {
    testcases{
    vector<int> pass = listinput();
    int po = pass[0];
    bool found = false;
    for (int i : pass) {
        found = found || i != po;
    }
    if (found) {
        cout << 1 << '\n';
    }
    else {
        cout << pass.size() << '\n';
    }
    }
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <string>
#include <tuple>
#include <functional>
using namespace std;
typedef long long ll;
int arr[200001];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int n;
		scanf("%d",&n);
		for(int i = 0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		int val = arr[0];
		int ans = 0;
		for(int i = 1;i<n;i++){
			if(arr[i] != val){
				ans = 1;
				break;
			}
		}
		if(ans == 1){
			printf("1\n");
		}
		else{
			printf("%d\n",n);
		}
	}
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int kolvo, n, q = -1, a;
	bool flag = true;
	vector <int> result;
	cin >> kolvo;
	for (int i = 0; i < kolvo; ++i)
	{
		cin >> n;

		for (int j = 0; j < n; ++j)
		{
			cin >> a;

			if (a != q && j != 0)
			{
				flag = false;
			}
			q = a;
		}
		if (flag == true)
		{
			result.push_back(n);
		}
		else
		{
			result.push_back(1);
			flag = true;
		}
	}
	for (int i = 0; i < result.size(); ++i)
	{
		cout << result[i] << endl;
	}
}


#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;

int main()
{
	int t; cin >> t;
	while (t--)
	{
		int n; cin >> n;
		vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i];
		sort(a.begin(), a.end());
		if (a[0] == a[n - 1]) cout << n << endl;
		else cout << 1 << endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
using namespace std;
using ll = long long;

void solve() {
	int n; cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; ++i) {
		cin >> vec[i];
	}
	sort(all(vec));
	if (vec.front() == vec.back()) cout << n << "\n";
	else cout << "1\n";
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int nbTests;
	cin >> nbTests;
	for (int iTest = 0; iTest < nbTests; ++iTest) {
		solve();
	}
}


#include <bits/stdc++.h>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()

using namespace std;

void solve() {
	int n; cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; ++i) {
		cin >> vec[i];
	}
	sort(all(vec));
	if (vec.front() == vec.back()) cout << n << "\n";
	else cout << "1\n";
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int nbTests;
	cin >> nbTests;
	for (int iTest = 0; iTest < nbTests; ++iTest) {
		solve();
	}
}


/*
URL_HERE
*/
/*

*/
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <queue>
#include <iostream>
using namespace std;

FILE* _fin = stdin;
FILE* _fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var,n) for(int var=0;var<n;++var)
#define repi(n) rep(i,n)
#define repj(n) rep(j,n)
#define repi1(n) for(int i=1;i<n;++i)
#define repj1(n) for(int j=1;j<n;++j)
int _min(int a, int b) { return a <= b ? a : b; }
ll _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
ll _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int* data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll* data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(unsigned long long* data, int n) { memset(data, 0, sizeof(unsigned long long) * n); }
void zero(char* data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() { char var; fscanf(_fin, "%c", &var); return var; }
int readi() { int var; fscanf(_fin, "%d", &var); return var; }
double readlf() { double var; fscanf(_fin, "%lf", &var); return var; }
ll readll() { ll var; fscanf(_fin, "%lld", &var); return var; }
void repread(int* data, int n) { repi(n) data[i] = readi(); }
void repread(ll* data, int n) { repi(n) data[i] = readll(); }
int reads(char* str, int maxsize)
{
	for (;;) { if (fgets(str, maxsize, _fin) == NULL) break; if (str[0] != '\n' && str[0] != '\r') break; }
	int slen = strlen(str); if (slen == 0) return 0;
	if (str[slen - 1] == '\n' || str[slen - 1] == '\r') str[--slen] = 0;
	return slen;
}

#define writec(var) fprintf(_fout,"%c",var)
#define writecsp(var) fprintf(_fout,"%c ",var)
#define writecln(var) fprintf(_fout,"%c\n",var)
#define writei(var) fprintf(_fout,"%d",var)
#define writeisp(var) fprintf(_fout,"%d ",var)
#define writellsp(var) fprintf(_fout,"%lld ",var)
#define writeiln(var) fprintf(_fout,"%d\n",var)
#define writellln(var) fprintf(_fout,"%lld\n",var)
#define writeulln(var) fprintf(_fout,"%llu\n",var)
#define writefln(var) fprintf(_fout,"%f\n",var)
#define writes(str) fprintf(_fout,"%s",str)
#define writesp() fprintf(_fout," ")
#define writeln() fprintf(_fout,"\n")
#define RUN_LOCAL(testfilename) {_fin = fopen(testfilename, "r"); if(_fin==NULL) _fin=stdin;}
#define swap(type,a, b) {type t=a;a=b;b=t;}
#define sort(data,n) std::sort(data,data+n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell is this...
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return (a / g) * b; }
void reverse(char* data, int n) { int k = n >> 1; repi(k) { char tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(int* data, int n) { int k = n >> 1; repi(k) { int tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(ll* data, int n) { int k = n >> 1; repi(k) { ll tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }

#define _Vec(type, name) \
struct name { type* data; int size; int n; };\
void init(name* t, int size) { t->data = (type*)malloc(sizeof(type) * size); t->size = size; t->n = 0; }\
void resize(name* t) { int ns = t->size * 1.2f; t->data = (type*)realloc(t->data, sizeof(type) * ns); t->size = ns; }\
void add(name* t, type val) { if (t->n >= t->size) resize(t); int k = t->n; t->data[k] = val; t->n = k + 1; }\
void free(name* t) { free(t->data);}
_Vec(int, Veci)
_Vec(long long, Vecll)
_Vec(char*, Vecs)

#define _ispal(type, name) int name(type* a, type* b, int n){repi(n){if (a[i] != b[n - i - 1]){return 0;}}return 1;}
_ispal(int, ispali)
_ispal(char, ispalc)

#define _Pair(type, name) struct name{type x, y;}; \
int cmp_##name(const void* _a, const void* _b)\
{\
	name* a = (name*)_a;name* b = (name*)_b;\
	if (a->x < b->x) return -1;\
	else\
	{\
		if (a->x == b->x)\
		{\
			if (a->y == b->y) return 0;\
			if (a->y < b->y) return -1;\
			else return 1;\
		}\
		else\
		{\
			return 1;\
		}\
	}\
}\
void sort_##name(name* d, int n){qsort(d, n, sizeof(name), cmp_##name);}
	_Pair(int, Pairi)
	_Pair(double,Pairlf)

	int cmp_Str(const void* _a, const void* _b) { char* a = *((char**)_a); char* b = *((char**)_b); return strcmp(a, b); }
void sort_Str(char** str, int n) { qsort(str, n, sizeof(char*), cmp_Str); }

ll expmod(ll x, ll n, ll m) {
	ll ans = 1;
	for (; n;) {
		if (n & 1) ans = (ans * x) % m;
		x = (x * x) % m;
		n >>= 1;
	}
	return ans;
}

ll combmod(ll n, ll k, ll m) {
	ll ret = 1;
	ll div = 1;
	for (ll i = 0; i < k; ++i) {
		ret = (ret * (n - i) % m) % m;
		div = (div * (i + 1)) % m;
	}
	div = expmod(div, m - 2, m) % m;
	return (ret * div) % m;
}

int next_perm(int* data, int n)
{
	//find first i,i+1 where d[i]<d[i+1]
	int rootidx = -1;
	for (int i = n - 2; i >= 0; --i)
	{
		if (data[i] < data[i + 1])
		{
			rootidx = i;
			break;
		}
	}

	if (rootidx == -1) return 0;

	int ceilingidx = rootidx + 1;
	//find smallest d[x] after d[rooti] where d[x]>d[rooti]
	for (int i = rootidx + 2; i < n; ++i)
	{
		if (data[i] > data[rootidx] && data[i] < data[ceilingidx])
		{
			ceilingidx = i;
		}
	}

	swap(int, data[rootidx], data[ceilingidx]);
	sort(&data[rootidx + 1], n - rootidx - 1);
	return 1;
}
int count_digits(ll a)
{
	int k = 0;
	for (;;)
	{
		if (a == 0)break;
		k++;
		a /= 10;
	}
	return k;
}

/*
use only when val EXISTS in data
*/
int bs_exists(int* data, int n, int val)
{
	int left = 0;
	int right = n - 1;
	for (; left < right;)
	{
		int mid = (left + right + 1) >> 1;
		if (data[mid] <= val) left = mid;
		else right = mid - 1;
	}
	return right;
}

ll simple_factorial(int x)
{
	ll f = 1.0;
	repi(x)
	{
		f *= (i + 1);
	}
	return f;
}

unsigned long long djb2(char* data, int n)
{
	unsigned long long h = 5381;
	for (int i = 0; i < n; ++i) h = (h << 5) + h + data[i];
	return h;
}

struct Hashcount
{
	int* count;
	unsigned long long* keys;
	int size_bits;
};
void init(Hashcount* h, int size_bits)
{
	h->size_bits = size_bits;
	int size = 1 << h->size_bits;
	h->count = (int*)malloc(sizeof(int) * size);
	zero(h->count, size);
	h->keys = (unsigned long long*)malloc(sizeof(unsigned long long) * size);
	zero(h->keys, size);
}

int set(Hashcount* h, unsigned long long key)
{
	//knuth's golden ratio multiplicative hashing for 64-bit keys
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key) //if key exists, overwrite data
		{
			h->count[index]++;
			return index;
		}

		if (h->keys[index] == 0) //empty spot
		{
			h->count[index] = 1;
			h->keys[index] = key;
			return index;
		}

		index++;
		index &= size - 1;
	}

	return -1;//return invalid index if data was not placed. this could be used as an indicator to resize.
}

int get(Hashcount* h, unsigned long long key)
{
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key)//found original key
		{
			return h->count[index];
		}

		if (h->keys[index] == 0) return 0;//if you see a zero,key was never there

		index++;
		index &= size - 1;
	}
	return 0;
}
//not sure if this works
int sub(Hashcount* h, unsigned long long key)
{
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key)//found original key
		{
			--h->count[index];
			if (h->count[index] < 0) h->count[index] = 0;
			return h->count[index];
		}

		if (h->keys[index] == 0) return 0;//if you see a zero,key was never there

		index++;
		index &= size - 1;
	}
	return 0;
}

const ll MOD  = 1e9 + 7;
/*
//proper binary search???
//tested on 1 problem it works!!!!!!!
int left = 0;
int right = n-1;
for (;;)
{
	if (left >= right)break;
	int mid = (left + right) >> 1;
	if (x <= a[mid]) right = mid;
	else left = mid+1;
}

printf("%d %d\n",right, a[right]);
*/

//------------------------------------------

//------------

int main()
{

	RUN_LOCAL("input.txt");
	int t = readi();
	rep(_t,t)
	{
		int n = readi();
		static int a[2*ten5p1];
		repread(a, n);
		int allsame = 1;
		repi1(n)
		{
			if (a[i] != a[i - 1])
			{
				allsame = 0;
				break;
			}
		}

		if (allsame == 1)
		{
			printf("%d\n", n);
		}
		else
		{
			printf("1\n");
		}
	}
	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <iostream>
#include <queue>

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

//const double PI = 3.141592653589793238463;
//const int MAXN = 1000500;
//const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;
const i64 INF = 1e18;
//i64 mod = 1e9 + 7;

i64 T, n, m;
//vector <vector<i64>> a;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);

    cin >> T;

    for (i64 tt = 0; tt < T; ++tt) {

        cin >> n;
        set <i64> x;

        for (i64 i = 0; i < n; ++i) {
            i64 y;
            cin >> y;
            x.emplace(y);
        }

        i64 res = 0;

        if (x.size() == 1) {
            res = n;
        }
        else {
            res = 1;
        }

        cout << res << endl;

    }
    return 0;
}


#include <iostream>
#include <string>
#include <iterator>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <sstream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <iomanip>
#include <functional>
#include <fstream>
#include <limits.h>
#pragma comment(linker, "/STACK:100000000")	//100*1mb
#pragma comment(linker, "/HEAP:100000000")
//*****for simple code*****
//#pragma GCC target("avx,avx2,fma")	//avx-packed floats/doubles, avx2-packed integral types, fma-more effective instructions
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //brute_force_optimization(lots of loops etc.)
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)	//sync cout cin with printf/scaf
#define ll long long
#define sp system("pause");
#define mod 998244353
#define sz(a) signed((a).size())
#define REPI(a,n) for(int i = a; i < n; i++)
#define REPJ(a,n) for(int j = a; j < n; j++)
#define REPK(a,n) for(int k = a; k < n; k++)
#define MOD 1000000007

#define DEBUG false

typedef vector<vector<int>> adj_mat;
typedef vector<vector<pair<int, int>>> adj_mat_c;
typedef vector<bool> vis_vec;

template<typename T>
void print_mat(vector<vector<T>>& mat) {
	REPI(0, mat.size()) {
		REPJ(0, mat[i].size()) {
			cout << mat[i][j] << ' ';
		}
		cout << endl;
	}
}

int neg_mod(int a, int b) {
	return (b + (a % b)) % b;
}

void solve() {
	int n;
	cin >> n;

	vector<int> a(n);
	cin >> a[0];
	bool good = false;
	REPI(1, n) {
		cin >> a[i];
		if (a[i] != a[i - 1] && !good)
			good = true;
	}
	if (good)
		cout << 1 << endl;
	else
		cout << n << endl;
}

int main() {
	fast;
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}


#include <iostream>
#include <math.h>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <map>
#include<stdio.h>
using std::vector;
using std::pair;
using std::cin;
using std::cout;
using std::endl;
using std::make_pair;
using std::string;
using std::min;
using std::max;
using std::unordered_map;
using std::unordered_set;

int n;
long long  x,a,b,c, l, r, m;

std::string str1, str2;
std::vector<long long> v_aux;
std::vector<long long> v;
std::vector<std::pair<long long, long long>> v_pair;
#define ll long long
std::vector<std::string> ans;

std::vector<std::vector<long long>> v2;

std::vector<std::vector<std::vector<long long>>> v3;

std::unordered_set<long long> un_set;

std::vector<char> char_vector;
std::unordered_map<long long , std::vector<long long>> g_out;
std::unordered_map<long long , long long> g_in;
std::unordered_map<long long , std::vector<long long>> un_map_1;
std::unordered_map<long long , std::vector<long long>> un_map_2;
std::unordered_map<long long , long long> un_map_3;

int main()
{

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    for (int j = 0; j < n; ++j) {

        cin >> m;

        for(int i = 0; i < m; ++i) {
            ll t;
            cin >> t;
            un_set.insert(t);
        }
        if (un_set.size() == 1) {
            cout << m << endl;
        } else {
            cout << 1 << endl;
        }
        un_set.clear();
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
using namespace std;
using ll = long long;

void solve() {
	int n; cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; ++i) {
		cin >> vec[i];
	}
	sort(all(vec));
	if (vec.front() == vec.back()) cout << n << "\n";
	else cout << "1\n";
}

int main() {
	int nbTests;
	cin >> nbTests;
	for (int iTest = 0; iTest < nbTests; ++iTest) {
		solve();
	}
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int t,n,i,x,k,c,Sum=0;
    cin>>t;
    while(t--)
    {
        k=0;
        c=0;
        cin>>n;
        Sum+=n;
        vector<int>a;
        for(i=0;i<n;i++)
        {
           cin>>x;
           a.push_back(x);
        }
        if(Sum<=200000){
        for(i=1;i<n;i++)
        {
            if(a[i]!=a[0])
            c++;
            if(c!=0)
            {
                k++;
                break;
            }
        }
        if(k==0)
            cout<<n<<endl;
        else
            cout<<1<<endl;
        }
        else
            break;
    }
}


#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <cstdio>
#include <utility>
using namespace std;

using lli = long long int;

int tNum;
int n, a[200001];
bool isSame;

int main(void)
{
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> tNum;
    for(int tt = 0; tt < tNum; tt++) {
        cin >> n;
        cin >> a[0];
        isSame = true;
        for(int i = 1; i < n; i++) {
            cin >> a[i];
            if(a[0] != a[i]) isSame = false;
        }

        if(isSame == true) cout << n << endl;
        else cout << "1" << endl;
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:10000000000")
//#pragma GCC optimize("O3")
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <cstring>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fr(i, l, r) for(int i = l; i < r; ++i)
#define fr_sl(i, l, r) for(auto i = l; i != r; ++i)
#define elif else if
#define mp make_pair
#define pb push_back
//#define or ||
//#define and &&

ll inf = 1000000007, ans;
bool pr, pr2;
int n, v, t, a, b, mx;
string s;
int mas[200010];

int main() {
	//freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	scanf("%d", &t);
	fr(qwerty, 0, t) {
		scanf("%d", &n);
		mx = 0;
		v = 0;
		fr(i, 0, n) {
			scanf("%d", &mas[i]);
			mx = max(mx, mas[i]);
		}
		fr(i, 0, n) {
			if (mas[i] == mx)
				++v;
		}
		if (v != n)
			printf("1\n");
		else
			printf("%d\n", n);
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:10000000000")
//#pragma GCC optimize("O3")
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <cstring>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fr(i, l, r) for(int i = l; i < r; ++i)
#define fr_sl(i, l, r) for(auto i = l; i != r; ++i)
#define elif else if
#define mp make_pair
#define pb push_back
//#define or ||
//#define and &&

ll inf = 1000000007, ans;
bool pr, pr2;
int n, v, t, a, b, mx;
string s;
int mas[200010];

int main() {
	//freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	scanf("%d", &t);
	fr(qwerty, 0, t) {
		scanf("%d", &n);
		mx = 0;
		v = 0;
		fr(i, 0, n) {
			scanf("%d", &mas[i]);
			mx = max(mx, mas[i]);
		}
		fr(i, 0, n) {
			if (mas[i] == mx)
				++v;
		}
		printf("%d\n", v);
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
      int t;
      cin>>t;
      while(t--){
            int n;
            cin>>n;
            vector<int> a(n);
            for(int i=0;i<n;i++){
                  cin>>a[i];
            }
            sort(a.begin(),a.end());
            if(n==1||a[0]==a[a.size()-1]){
                  cout<<"NO"<<endl;
            }
            {
                  cout<<"YES"<<endl;
            }
      }
      return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
      int t;
      cin>>t;
      while(t--){
            int n;
            cin>>n;
            vector<int> a(n);
            for(int i=0;i<n;i++){
                  cin>>a[i];
            }
            sort(a.begin(),a.end());
            if(n==1||a[0]==a[a.size()-1]){
                  cout<<n<<endl;
            }
            else{
                  cout<<1<<endl;
            }
      }
      return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
      int t;
      cin>>t;
      while(t--){
            int n;
            cin>>n;
            vector<int> a(n);
            for(int i=0;i<n;i++){
                  cin>>a[i];
            }
            sort(a.begin(),a.end());
            if(n==1||a[0]==a[a.size()-1]){
                  cout<<n<<endl;
            }
            {
                  cout<<1<<endl;
            }
      }
      return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <iomanip>
#include <set>

using namespace std;
#define ll long long

int main() {
	int t;
	cin >> t;
	while (t--) {
		int n, x;
		cin >> n;
		set <int> s;
		for (int i = 0; i < n; i++) {
			cin >> x;
			s.insert(x);
		}
		if (s.size() == 1) cout << n << endl;
		else cout << 1 << endl;
	}
}


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

using namespace std;

int T, n;
int arr[200001];
int Max;
int cnt;

int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> T;

	while (T--) {
		cin >> n;
		Max = 0;
		cnt = 0;
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
			Max = max(Max, arr[i]);
		}
		for (int i = 0; i < n; i++)
			if (arr[i] == Max)
				cnt++;

		if (cnt == n)
			cout << n << '\n';
		else
			cout << 1 << '\n';
	}

	return 0;
}


#include <iostream>
#include <math.h>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <set>
#include <algorithm>
typedef long long ll;
typedef long double ld;
typedef double db;
ld eps = 1e-10;
using namespace std;

ld binarySearch(ld d){
  ld l = 0;
  ld r = sqrt(d);
  while(r - l > eps){ //log(40 * 10^8) ~ 40
    ld a = (r + l) / 2;
    ld b = d / a;
    if (b + a > d){
      l = a;
    }
    else{
      r = a;
    }
  }
  return r;
}

int main()
{
  int t;
  ld d;
  cin >> t;
  cout << fixed << setprecision(10);
  for(int i = 0; i < t; i++){
    cin >> d;
    if (d == 0){
      cout << "Y 0.0000000000 0.000000000\n";
      continue;
    }
    ld a = binarySearch(d);
    ld b = d / a;
    //cout << a << " " << b;
    if(fabs(a + b - d) <= 1e-6){
      cout << "Y "<< a << " " << b;
    }
    else{
      cout << "N";
    }
    cout << endl;
  }

}


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

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double d;
		cin >> d;
		double d1 = (d + pow((d * d - 4 * d), (1.0 / 2.0))) / 2,
			d2 = (d - pow((d * d - 4 * d) , (1.0 / 2.0))) / 2;
		if (d == 0)
		{
			cout << "Y " << fixed << setprecision(12) << 0.0 << ' ' << 0.0 << '\n';
			continue;
		}
		if (d < 4 && d > 0)
			cout << "N\n";
		else cout << "Y " <<  fixed << setprecision(12) << d1 << ' ' << d2 << '\n';
	}
}


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

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double d;
		cin >> d;
		double d1 = (d + pow((d * d - 4 * d), (1.0 / 2.0))) / 2,
			d2 = (d - pow((d * d - 4 * d) , (1.0 / 2.0))) / 2;
		if (d == 0)
		{
			cout << fixed << setprecision(12) << 0.0 << ' ' << 0.0 << '\n';
			continue;
		}
		if (d < 4 && d > 0)
			cout << "N\n";
		else cout << "Y " <<  fixed << setprecision(12) << d1 << ' ' << d2 << '\n';
	}
}


#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
	unsigned int n, num;
	double l, r, med;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> num;
		r = num;
		l = (num + 0.0) / 2;
		for (int j = 0; j < 1000; j++) {
			med = (l + r) / 2;
			if (med * (num - med) > num)
				l = med;
			else
				r = med;
		}
		if (num == 1 || num == 3 || num == 2)
			cout << "N";
		else cout << "Y " << fixed << setprecision(10) << r << ' ' << num - r << endl;
	}
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{DE84F146-877D-46AE-B3E5-74A0EE64D617}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Debug|x64.ActiveCfg = Debug|x64
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Debug|x64.Build.0 = Debug|x64
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Debug|x86.ActiveCfg = Debug|Win32
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Debug|x86.Build.0 = Debug|Win32
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Release|x64.ActiveCfg = Release|x64
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Release|x64.Build.0 = Release|x64
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Release|x86.ActiveCfg = Release|Win32
		{DE84F146-877D-46AE-B3E5-74A0EE64D617}.Release|x86.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {9681F216-D44B-4BB5-A1C6-4B5E01A3CB1F}
	EndGlobalSection
EndGlobal


#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
	unsigned int n, num;
	double l, r, med;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> num;
		r = num;
		l = (num + 0.0) / 2;
		for (int j = 0; j < 1000; j++) {
			med = (l + r) / 2;
			if (med * (num - med) > num)
				l = med;
			else
				r = med;
		}
		if (num == 1 || num == 3 || num == 2)
			cout << "N" << endl;
		else cout << "Y " << fixed << setprecision(10) << r << ' ' << num - r << endl;
	}
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#include<conio.h>
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int d;
		cin>>d;
		if(d==0)
		{
		//cout<<"Y "<<ld(0.0)<<" "<<ld(0.0)<<endl;
		printf("%c %0.9lf ",'Y',0.0);
		printf("%0.9lf\n",0.0);
		}
		else if(d<4)
		cout<<"N "<<endl;
		else {
			double sq = sqrt(d*d-ld(4)*d);
			double m1= ld(d+sq)/ld(2.0);
			double m2= ld(d-sq)/ld(2.0);
			//cout<<"Y "<<double(m1)<<" "<<double(m2)<<endl;
			printf("%c %0.9lf %0.9lf\n",'Y',m1,m2);
		}
	}
	return 0;
}


#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#define ll long long
#define ld double
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int d;
		cin>>d;
		if(d==0)
		cout<<"Y "<<ld(0.0)<<" "<<ld(0.0)<<endl;
		else if(d<4)
		cout<<"N "<<endl;
		else {
			double sq = sqrt(d*d-ld(4)*d);
			double m1= ld(d+sq)/ld(2.0);
			double m2= ld(d-sq)/ld(2.0);
			cout<<"Y "<<double(m1)<<" "<<double(m2)<<endl;
		}
	}
	return 0;
}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	int t, d;
	cin >> t;
	while (t--)
	{
		cin >> d;
		int D = d * d - 4 * d;
		if (D < 0)
			cout << 'N' << endl;
		else
			cout << fixed << setprecision(9) << "Y " << (d + sqrt(D)) / 2 << ' ' << d - (d + sqrt(D)) / 2 << endl;
	}
	return 0;
}


#include <cmath>
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void Init(){
    ios::sync_with_stdio(false);
    cin.tie(0);
}
int main(){
    Init();
    int T;
    cin>>T;
    while(T--){
        double d;
        cin>>d;
        if(d*d-4*d<0)cout<<"N"<<endl;
        else {
            double a=(d+sqrt(d*d-4.0*d))/2.0;
            double b=d-a;
            printf("Y %.9lf %.9lf\n",a,b);
//            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <utility>

using namespace std;

int main() {
	iostream::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	double d, D, a, b;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		cin >> d;
		D = d * d - 4 * d;
		if (D < 0) {
			cout << 'N' <<endl;
		}
		else {
			cout.setf(ios::fixed);
			cout.precision(10);
			cout << "Y " << (d + sqrt(D)) / 2 << ' ' << d - (d + sqrt(D)) / 2 << endl;

		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <utility>

using namespace std;

int main() {
	iostream::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	double d, D, a, b;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		cin >> d;
		D = d * d - 4 * d;
		if (D < 0) {
			cout << 'N';
		}
		else {
			cout.setf(ios::fixed);
			cout.precision(10);
			cout << "Y " << (d + sqrt(D)) / 2 << ' ' << d - (d + sqrt(D)) / 2 << endl;

		}
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//方法二，推公式,a^2-an-n<=0.000001,▲=n(n-4),所以n>=4,x=(n+-sqrt(▲))/2
	{
		double n;
		scanf_s("%lf", &n);
		if (n <4&&n!=0)
			printf("N\n");
		else
		{
			double tem = sqrt(n*n-4*(n-0.000001));
			if (n == 0)
				tem = 0;
			printf("Y %.9f %.9f\n", (n + tem) / 2, (n - tem) / 2);
		}
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//方法二，推公式,a^2-an-n<=0.000001,▲=n(n-4),所以n>=4,x=(n+-sqrt(▲))/2
	{
		double n;
		scanf_s("%lf", &n);
		if (n <4&&n!=0 )
			printf("N\n");
		else
		{
			double tem = sqrt(n*n-4*(n-0.000001));
			printf("Y %.9f %.9f\n", (n + tem) / 2, (n - tem) / 2);
		}
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//方法二，推公式,a^2-an-n<=0.000001,▲=n(n-4),所以n>=4,x=(n+-sqrt(▲))/2
	{
		double n;
		scanf_s("%lf", &n);
		if (n <4&&n!=0)
			printf("N\n");
		else
		{
			double tem = sqrt(n*n-4*n);
			printf("Y %.9f %.9f\n", (n + tem) / 2, n-(n+tem)/2);
		}
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//给一个结果，要求找到一对数，使得他们相加或者相乘都能得到这个数
	{
		double n;
		scanf_s("%lf", &n);
		double l = n / 2, r = n;
		for (int i = 0; i < 100; i++)
		{
			double mid = (l + r) / 2;
			if ((n - mid) * mid > n)
				l = mid;
			else
				r = mid;
		}
		if (abs(l * (n - l) - n) <= 0.000001)
			printf("Y %.9f %.9f\n", l, n - l);
		else
			printf("N\n");
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//方法二，推公式,a^2-an-n<=0.000001,▲=n(n-4),所以n>=4,x=(n+-sqrt(▲))/2
	{
		double n;
		scanf_s("%lf", &n);
		if (n <4&&n!=0 )
			printf("N\n");
		else
		{
			double tem = sqrt(n*n-4*(n-0.000001));
			printf("%.9f %.9f\n", (n + tem) / 2, (n - tem) / 2);
		}
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//给一个结果，要求找到一对数，使得他们相加或者相乘都能得到这个数
	{
		double n;
		scanf_s("%lf", &n);
		double l = n / 2, r = n;
		for (int i = 0; i < 100; i++)
		{
			double mid = (l + r) / 2;
			if ((n - mid) * mid > n)
				l = mid;
			else
				r = mid;
		}
		if (abs(l * (n - l) - n) <= 0.000001)
			printf("Y %f %f\n", l, n - l);
		else
			printf("N\n");
	}
	return 0;
}


#include<cstdio>
#include<string>
#include<cstring>
#include<string.h>
#include<map>
#include<queue>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#define inf_int 0x3f3f3f3f
#define inf_ll 0x3f3f3f3f3f3f3f3f
#define P(x,y)  make_pair(x,y)
#define lowbit(i1) (i1)&(-i1)
using namespace std;

int main()
{
	int q;
	scanf_s("%d", &q);
	while (q--)//方法二，推公式,a^2-an-n<=0.000001,▲=n(n-4),所以n>=4,x=(n+-sqrt(▲))/2
	{
		double n;
		scanf_s("%lf", &n);
		if (n <4&&n!=0)
			printf("N\n");
		else
		{
			double tem = sqrt(n*n-4*(n-0.000001));
			if (n == 0)
				tem = 0;
			printf("Y %.9f %.9f\n", (n + tem) / 2, n-(n+tem)/2);
		}
	}
	return 0;
}


#include <iostream>
#include <ostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <list>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <unordered_map>
#include <deque>
#include <random>
#include <map>
#include <assert.h>
#include <unordered_set>
#include <stack>
#include <bitset>
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#pragma warning(disable : 4996)
#define ft first
#define sd second
#define pb push_back
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()

typedef long long ll;
typedef long long unsigned llu;
typedef double dl;

long double eps = 1e-6;

using namespace std;

string LNSort(string s)
{
	int arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = 0;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a']++;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		for (size_t j = 0; j < arr[i]; j++)
			res += ch;
	}
	return res;
}

string LNUniq(string s)
{
	bool arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = false;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a'] = true;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		if(arr[i])
			res += ch;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int t;
	cin >> t;
	while (t--) {
		long double d;
		cin >> d;
		long double Dis;
		Dis = d * d - 4 * d;
		if (Dis < 0)
			cout << "N\n";
		else {
			long double b2 = (d - sqrt(Dis)) / 2;
			long double a2 = b2 / (b2 - 1);
			cout <<"Y "<<a2 << ' ' << b2 << '\n';
		}
	}
	return 0;
}


#include <iostream>
#include <ostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <list>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <unordered_map>
#include <deque>
#include <random>
#include <map>
#include <assert.h>
#include <unordered_set>
#include <stack>
#include <bitset>
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#pragma warning(disable : 4996)
#define ft first
#define sd second
#define pb push_back
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()

typedef long long ll;
typedef long long unsigned llu;
typedef double dl;

long double eps = 1e-6;

using namespace std;

string LNSort(string s)
{
	int arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = 0;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a']++;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		for (size_t j = 0; j < arr[i]; j++)
			res += ch;
	}
	return res;
}

string LNUniq(string s)
{
	bool arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = false;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a'] = true;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		if(arr[i])
			res += ch;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int t;
	cin >> t;
	while (t--) {
		long double d;
		cin >> d;
		long double Dis;
		Dis = d * d - 4 * d;
		if (Dis < 0)
			cout << "N\n";
		else {
			long double b2 = (d - sqrt(Dis)) / 2;
			long double a2 = b2 / (b2 - 1);
			if (a2 == -0) a2 = 0;
			if (b2 == -0) b2 = 0;
			cout <<fixed<<setprecision(9)<<"Y "<<a2 << ' ' << b2 << '\n';
		}
	}
	return 0;
}


#include <iostream>
#include <ostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <list>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <unordered_map>
#include <deque>
#include <random>
#include <map>
#include <assert.h>
#include <unordered_set>
#include <stack>
#include <bitset>
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#pragma warning(disable : 4996)
#define ft first
#define sd second
#define pb push_back
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()

typedef long long ll;
typedef long long unsigned llu;
typedef double dl;

long double eps = 1e-6;

using namespace std;

string LNSort(string s)
{
	int arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = 0;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a']++;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		for (size_t j = 0; j < arr[i]; j++)
			res += ch;
	}
	return res;
}

string LNUniq(string s)
{
	bool arr[28];
	for (size_t i = 0; i < 28; i++)
	{
		arr[i] = false;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		arr[s[i] - 'a'] = true;
	}
	string res = "";
	for (size_t i = 0; i < 28; i++)
	{
		char ch = ('a' + i);
		if(arr[i])
			res += ch;
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int t;
	cin >> t;
	while (t--) {
		long double d;
		cin >> d;
		long double Dis;
		Dis = d * d - 4 * d;
		if (Dis < 0)
			cout << "N\n";
		else {
			long double b2 = (d - sqrt(Dis)) / 2;
			long double a2 = b2 / (b2 - 1);
			if (a2 == -0) a2 = 0;
			if (b2 == -0) b2 = 0;
			cout <<"Y "<<a2 << ' ' << b2 << '\n';
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include<iomanip>
#include <cstring>
#include <string.h>
#include <iterator>
#include<math.h>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <limits.h>
#include <string>
#include <bitset>
#include <map>
#include <numeric>

#define endl cout<<"\n"
#define lli long long int

using namespace std;

//fast-exponentiation-lli
lli expo_fast(lli a, lli b) {
	a = a;
	lli result = 1;
	while (b) {
		//multiplyint(tos(result), a);
		if (b & 1)result = (result * a);
		b >>= 1;
		a = (a*a);
	}
	return (result);
}

void take_in(vector<lli> *arr) {
	for (int i = 0; i < arr->size(); i++)cin >> (*(arr))[i];
}

void disp_arr(vector<lli>* arr) {
	for (int i = 0; i < arr->size(); i++)cout << (*(arr))[i] << " ";
}

lli gcd(lli a, lli b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t; cin >> t;
	while (t--) {
		int d; cin >> d;
		if (pow(d, 2) - 4 * d < 0)cout << "N\n";
		else {
			cout << "Y ";
			long double b = (d + sqrt(pow(d, 2) - 4 * d)) / 2;
			long double a = d - b;
			cout << fixed << setprecision(10) << a << " " << b; endl;
		}

	}
	//system("PAUSE");
}


#include <iostream>
#include <vector>
#include<iomanip>
#include <cstring>
#include <string.h>
#include <iterator>
#include<math.h>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <limits.h>
#include <string>
#include <bitset>
#include <map>
#include <numeric>

#define endl cout<<"\n"
#define lli long long int

using namespace std;

//fast-exponentiation-lli
lli expo_fast(lli a, lli b) {
	a = a;
	lli result = 1;
	while (b) {
		//multiplyint(tos(result), a);
		if (b & 1)result = (result * a);
		b >>= 1;
		a = (a*a);
	}
	return (result);
}

void take_in(vector<lli> *arr) {
	for (int i = 0; i < arr->size(); i++)cin >> (*(arr))[i];
}

void disp_arr(vector<lli>* arr) {
	for (int i = 0; i < arr->size(); i++)cout << (*(arr))[i] << " ";
}

lli gcd(lli a, lli b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t; cin >> t;
	while (t--) {
		int d; cin >> d;
		if (pow(d, 2) - 4 * d < 0)cout << "N\n";
		else {
			long double b = (d + sqrt(pow(d, 2) - 4 * d)) / 2;
			long double a = d - b;
			cout << fixed << setprecision(10) << a << " " << b; endl;
		}

	}
	//system("PAUSE");
}


#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <deque>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
const LL INF = (1LL << 60) - 1;
const LL MOD = 1e9 + 7;
const LL N = 200005;
int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
    int t;
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        double D = x * x - 4 * x;
        if (D < 0) {
            cout << "N" << endl;
            continue;
        }
        cout << "Y" << " ";
        double root = (x + sqrt(D)) / 2;
        cout << root << " " << x - root << " " << endl;
    }
}


#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <deque>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
const LL INF = (1LL << 60) - 1;
const LL MOD = 1e9 + 7;
const LL N = 200005;
int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
    int t;
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        double D = x * x - 4 * x;
        if (D < 0) {
            cout << "N" << endl;
            continue;
        }
        cout << "Y" << " ";
        double ans = (x + sqrt(D)) / 2;
        cout << ans << " " << x - ans << endl;
    }
}


#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <deque>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
const LL INF = (1LL << 60) - 1;
const LL MOD = 1e9 + 7;
const LL N = 200005;
int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(20), cout.setf(ios::fixed);
    int t;
    cin >> t;
    while (t--) {
        int x;
        cin >> x;
        double D = sqrt(x * x - 4 * x);
        if (D < 0) {
            cout << "N" << endl;
            continue;
        }
        cout << "Y" << " ";
        double root = (x + D) / 2;
        cout << root << " " << x - root << " " << endl;
    }
}


#include <iostream>
#include <iomanip>

using namespace std;

int main() {

	int q,d;
	cin >> q;
	while (q--)
	{
		cin >> d;

		 long double x, y;
		if (d == 0) {
			cout << "Y 0.000000000 0.000000000" << endl;
		}
		else if (d < 4) {
			cout << "N\n";
		}
		else {
			y = (long double)((d +  sqrt(d*d - 4 * d)) / (long double)2);
			x = (long double)(d - y);
			cout << "Y "<< std::setprecision(9) << std::fixed << x << " " << std::setprecision(9) << std::fixed << y << endl;
		}
	}

}


#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{   int t;
    cin >> t;
    for (int i = 0; i < t; i++){
        int d;
        cin >> d;
        if (d > 0 && d < 4){cout << "N"<<endl;}
        else {cout << "Y ";
        cout << fixed << setprecision(9);
        cout << (d + sqrt(d*d - 4*d))/2 << " ";
        cout << d - (d + sqrt(d*d - 4*d))/2<<endl;
        }
    }
}


#include <iostream>
#include <math.h>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <set>
#include <algorithm>
typedef long long ll;
typedef long double ld;
typedef double db;
ld eps = 1e-10;
using namespace std;

ld binarySearch(ld d){
  ld l = 0;
  ld r = sqrt(d);
  while(r - l > eps){ //log(40 * 10^8) ~ 40
    ld a = (r + l) / 2;
    ld b = d / a;
    if (b + a > d){
      l = a;
    }
    else{
      r = a;
    }
  }
  return r;
}

int main()
{
  int t;
  ld d;
  cin >> t;
  cout << fixed << setprecision(10);
  for(int i = 0; i < t; i++){
    cin >> d;
    if (d == 0){
      cout << "Y 0.0000000000 0.000000000\n";
      continue;
    }
    ld a = binarySearch(d);
    ld b = d / a;
    //cout << a << " " << b;
    if(fabs(a + b - d) <= 1e-6){
      cout << "Y "<< a << " " << b;
    }
    else{
      cout << "N";
    }
    cout << endl;
  }

}


#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<cmath>
#include<string>
#include<cstring>
#include<iostream>
#include<iomanip>
#include<numeric>
// #define SGN(n) (n>0? 1 :-1)

using namespace std;
typedef long long ll;

int main(){
	int t;
	int d;
	cin>>t;
	cout.precision(10);
	while(t-->0){
		cin>>d;
		if(d*d - 4*d >= 0){
			cout<<'Y'<<' '<< (d-sqrt(d*d-4*d))/2 <<' '<<(d+sqrt(d*d-4*d))/2<<'\n';
		}else cout<<'N'<<'\n';
	}
    return 0;
}


#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <utility>
#include <queue>
#include <string.h>
#include <climits>

#define SZ size()
#define VEC vector
#define PB push_back
#define MP make_pair
#define SS second
#define FF first
#define PII pair <int,int>
#define LL long long

#define IN_NAME input.txt
#define OUT_NAME output.txt
#define double long double

using namespace std;

const int MAXN = (int) 1e3 + 15;
const double EPS = 1e-7;

int t;
VEC <int> v;
VEC <pair <double, double>> ans;
bool isAns[MAXN];

void in()
{
    //ifstream cin("input.txt");
    ios_base:: sync_with_stdio(false);
    cin.tie(0);
    cin >> t;
    v.resize(t + 5);
    ans.resize(t + 5);
    for (int i = 0; i < t; ++i) {
        cin >> v[i];
    }
}

void solution()
{
    for (int i = 0; i < t; ++i) {
        if (v[i] == 0) {
            isAns[i] = 1;
            ans[i] = MP(0, 0);
            continue;
        }
        double L = 1, R = 2;
        for (int k = 0; k < 3000; ++k) {
            double M = (L + R) / 2;
            double b = v[i] - M;
            if (M * b > v[i] + EPS) {
                R = M;
            } else {
                L = M;
            }
        }
        //cout << L << " " << R << "\n";
        double tmp = L * (v[i] - L);
        if (tmp >= v[i] - EPS && tmp <= v[i] + EPS) {
            isAns[i] = 1;
            ans[i] = MP((v[i] - L), L);
        }
        tmp = R * (v[i] - R);
        if (tmp >= v[i] - EPS && tmp <= v[i] + EPS) {
            isAns[i] = 1;
            ans[i] = MP((v[i] - R), R);
        }
    }
}

void out()
{
    //ofstream cout("output.txt");
    cout.precision(12);
    cout << fixed;
    for (int i = 0; i < t; ++i) {
        if (isAns[i]) {
            cout << "Y " << ans[i].FF << " " << ans[i].SS << "\n";
        } else {
            cout << "N \n";
        }
    }
}

int main()
{
    in();
    solution();
    out();
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{

    double d;
    double x1, x2;
    int t;

    scanf("%d", &t);
    while(t--)
    {
        scanf("%lf", &d);
        if( d*d - 4.0*d < 0)
        {
            printf("N\n");
            continue;
        }
        x1 = fabs( (-d + sqrt(d*d - 4.0*d)) / 2.0);
        x2 = fabs( (-d - sqrt(d*d - 4.0*d)) / 2.0);
        if( x1 < x2)
        {
            x1 += x2;
            x2 = x1 - x2;
            x1 -= x2;

        }
        printf("Y %.9lf %.9lf\n", x1, x2);
    }
    return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
	int t; cin >> t;
	for (int i = 0; i < t; i++)
	{
		double d;
		cin >> d;

		double a = 1;
		double b = -d;
		double c = d;
		double delta = b * b - 4 * a*c;
		if (delta < 0) { cout << "N" << endl; }
		else
		{
			double x1 = (-b - pow(delta, 0.5)) / 2;
			double x2 = (-b + pow(delta, 0.5)) / 2;

			if (x1 < 0 || x2 < 0) { cout << "N" << endl; }
			else
			{
				cout << "Y" << fixed << setprecision(10) << " " << x1 << " " << x2 << endl;
			}
		}
	}
	return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
	int t; cin >> t;
	for (int i = 0; i < t; i++)
	{
		double d;
		cin >> d;

		double a = 1;
		double b = -d;
		double c = d;
		double delta = b * b - 4 * a*c;

		double x1 = (-b - pow(delta, 0.5)) / 2;
		double x2 = (-b + pow(delta, 0.5)) / 2;

		if (x1 < 0 || x2 < 0) { cout << "N" << endl; }
		else
		{
			cout << "Y" << fixed << setprecision(10) << " " << x1 << " " << x2 << endl;
		}
	}
	return 0;
}


// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//

//#include "stdafx.h"
#include<iostream>
#include<String>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		double a,b,d;
		cin >> d;

		double  dis = d*d - 4 * d;
		if (dis < 0)
		{
			cout << 'N'<<endl;
			continue;
		}

		a = (d + sqrt(dis)) / 2;
		b = d - a;
		//cout << 'Y' << ' ' << a <<' ' << b << endl;
		printf("Y %.8f %.8f", a,b);
	}

//	system("pause");
    return 0;

}


// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//

//#include "stdafx.h"
#include<iostream>
#include<String>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		float a,b,d;
		cin >> d;

		float  dis = d*d - 4 * d;
		if (dis < 0)
		{
			cout << 'N'<<endl;
			continue;
		}

		a = (d + sqrt(dis)) / 2;
		b = d - a;
		//cout << 'Y' << ' ' << a <<' ' << b << endl;
		printf("Y %.9f %.9f", a,b);
	}

//	system("pause");
    return 0;

}


// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//

//#include "stdafx.h"
#include<iostream>
#include<String>
#include<math.h>

using namespace std;

int main()
{

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		double a,b,d;
		cin >> d;

		double dis = d*d - 4 * d;
		if (dis < 0)
		{
			cout << 'N'<<endl;
			continue;
		}

		a = (d + sqrt(dis)) / 2;
		b = d - a;
		cout << 'Y' << ' ' << a <<' ' << b << endl;
	}

//	system("pause");
    return 0;

}


// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//

//#include "stdafx.h"
#include<iostream>
#include<String>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		double a,b,d;
		cin >> d;

		double  dis = d*d - 4 * d;
		if (dis < 0)
		{
			cout << 'N'<<endl;
			continue;
		}

		a = (d + sqrt(dis)) / 2;
		b = d - a;
		//cout << 'Y' << ' ' << a <<' ' << b << endl;
		printf("Y %.9f %.9f", a,b);
	}

//	system("pause");
    return 0;

}


// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//

//#include "stdafx.h"
#include<iostream>
#include<String>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		double a,b,d;
		cin >> d;

		double  dis = d*d - 4 * d;
		if (dis < 0)
		{
			cout << 'N'<<endl;
			continue;
		}

		a = (d + sqrt(dis)) / 2;
		b = d - a;
		//cout << 'Y' << ' ' << a <<' ' << b << endl;
		printf("Y %.9f %.9f \n", a,b);
	}

	//system("pause");
    return 0;

}


#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <unordered_map>
#include <assert.h>

using namespace std;

#define mp make_pair
typedef long long ll;
typedef long double ldb;
typedef pair <int, int> pii;

ll el[200010], h[200010];
double eps = 1e-8;
int comp(double x, double y)
{
	if (x < y - eps)
	{
		return -1;
	}
	if (fabs(x - y) < eps)
		return 0;
	if (x > y + eps)
		return 1;
}
void solve()
{
	double d;
	cin >> d;
	double A = -1, B = d, C = -d;
	double D = B * B - 4 * A * C;
	if (comp(D, 0.0) == -1)
	{
		cout << "N\n";
		return;
	}
	vector<double> vd;
	vd.push_back((-B + sqrt(D)) / (2 * A));
	vd.push_back((-B - sqrt(D)) / (2 * A));
	for (int i = 0; i < 2; ++i)
	{
		double a = d - vd[i];
		if (comp(a, 0) > -1 && comp(vd[i], 0) > -1)
		{
			printf("Y %.7lf %.7lf\n", a, vd[i]);
			return;
		}
	}
	cout << "N\n";
}
int main() {
#ifdef  _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	cin >> t;
	for (int i = 0; i < t; ++i)
	{
		solve();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include <set>
#include <queue>
#include <map>
#include <vector>
#include <unordered_map>
#include <assert.h>

using namespace std;

#define mp make_pair
typedef long long ll;
typedef long double ldb;
typedef pair <int, int> pii;

ll el[200010], h[200010];
double eps = 1e-8;
int comp(double x, double y)
{
	if (x < y - eps)
	{
		return -1;
	}
	if (fabs(x - y) < eps)
		return 0;
	if (x > y + eps)
		return 1;
}
void solve()
{
	double d;
	cin >> d;
	double A = -1, B = d, C = -d;
	double D = B * B - 4 * A * C;
	if (comp(D, 0.0) == -1)
	{
		cout << "N\n";
		return;
	}
	vector<double> vd;
	vd.push_back((-B + sqrt(D)) / (2 * A));
	vd.push_back((-B - sqrt(D)) / (2 * A));
	for (int i = 0; i < 2; ++i)
	{
		double a = d - vd[i];
		if (comp(a, 0) > -1 && comp(vd[i], 0) > -1)
		{
			printf("Y %.12f %.12f\n", a, vd[i]);
			return;
		}
	}
	cout << "N\n";
}
int main() {
#ifdef  _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	cin >> t;
	for (int i = 0; i < t; ++i)
	{
		solve();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include <set>
#include <queue>

#include <vector>
#include <unordered_map>
#include <assert.h>

using namespace std;

#define mp make_pair
typedef long long ll;
typedef long double ldb;
typedef pair <int, int> pii;

ll el[200010], h[200010];
double eps = 1e-8;
int comp(double x, double y)
{
	if (x < y - eps)
	{
		return -1;
	}
	if (fabs(x - y) < eps)
		return 0;
	if (x > y + eps)
		return 1;
}
void solve()
{
	double d;
	cin >> d;
	double A = -1, B = d, C = -d;
	double D = B * B - 4 * A * C;
	if (comp(D, 0.0) == -1)
	{
		cout << "N\n";
		return;
	}
	vector<double> vd;
	vd.push_back((-B + sqrt(D)) / (2 * A));
	vd.push_back((-B - sqrt(D)) / (2 * A));
	for (int i = 0; i < 2; ++i)
	{
		double a = d - vd[i];
		if (comp(a, 0) > -1 && comp(vd[i], 0) > -1)
		{
			printf("Y %.12f %.12f\n", a, vd[i]);
			return;
		}
	}
	cout << "N\n";
}
int main() {
#ifdef  _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	cin >> t;
	for (int i = 0; i < t; ++i)
	{
		solve();
	}
}


#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    double s,d,x1,x2;
    cin>>n;
    while(n--)
    {
        cin>>d;
        s=d*d-4*d;
        if(s>=0)
        {
            x1=(d+sqrt(s))/2;
            x2=(d-sqrt(s))/2;
            printf("Y %.9f %.9f\n",x1,x2);
        }
        else cout<<"N"<<endl;
    }
    return 0;
}


#include<cstdio>
#include<cmath>

using namespace std;

double bin(double lb, double ub, double target)
{
	double next;

	next = (lb + ub) / 2.0;

	if (abs(next*(target - next)-target) < 0.0000001)
	{
		return next;
	}

	else if (next*(target - next) > target)
	{
		return bin(next, ub, target);
	}

	else
	{
		return bin(lb, next, target);
	}
}

int main()
{
	int n;
	int t, z;
	double sol;

	scanf("%d", &t);

	for (z = 0; z < t; z++)
	{
		scanf("%d", &n);

		if (n>0 &&n<4)
		{
			printf("N\n");
		}

		else if (n == 0 || n == 4)
		{
			printf("Y %.8lf\n", (double)(n/2));
		}

		else
		{
			sol = bin((double)n / 2.0, (double)n, (double)n);
			printf("Y %.8lf %.8lf\n", sol, (double)n - sol);
		}
	}

	return 0;
}


#include<cstdio>
#include<cmath>

using namespace std;

double bin(double lb, double ub, double target)
{
	double next;

	next = (lb + ub) / 2.0;

	if (abs(next*(target - next)-target) < 0.0000001)
	{
		return next;
	}

	else if (next*(target - next) > target)
	{
		return bin(next, ub, target);
	}

	else
	{
		return bin(lb, next, target);
	}
}

int main()
{
	int n;
	int t, z;
	double sol;

	scanf("%d", &t);

	for (z = 0; z < t; z++)
	{
		scanf("%d", &n);

		if (n>0 &&n<4)
		{
			printf("N\n");
		}

		else if (n == 0 || n == 4)
		{
			printf("Y %.8lf %.8lf\n", (double)(n / 2),(double)(n / 2));
		}

		else
		{
			sol = bin((double)n / 2.0, (double)n, (double)n);
			printf("Y %.8lf %.8lf\n", sol, (double)n - sol);
		}
	}

	return 0;
}


#include<cstdio>
#include<cmath>

using namespace std;

double bin(double lb, double ub, double target)
{
	double next;

	next = (lb + ub) / 2.0;

	if (abs(next*(target - next)-target) < 0.0000001)
	{
		return next;
	}

	else if (next*(target - next) > target)
	{
		return bin(next, ub, target);
	}

	else
	{
		return bin(lb, next, target);
	}
}

int main()
{
	int n;
	int t, z;
	double sol;

	scanf("%d", &t);

	for (z = 0; z < t; z++)
	{
		scanf("%d", &n);

		if (n>0 &&n<4)
		{
			printf("N\n");
		}

		else if (n == 0 || n == 4)
		{
			printf("Y %d %d\n", n / 2, n / 2);
		}

		else
		{
			sol = bin((double)n / 2.0, (double)n, (double)n);
			printf("Y %.9lf %.9lf\n", sol, (double)n - sol);
		}
	}

	return 0;
}


#include <stdio.h>
#include <math.h>

double binsearch (int n)
{
	double l = sqrt ((double)n) - 1, r = n, m = (l + r) / 2;

	while (l != m && r != m)
	{
		if (m * (n - m) <= n)
			r = m;
		else
			l = m;

		m = l + (r - l) / 2;
	}

	return m;
}

int main()
{
	int n, i;

	scanf ("%d", &n);

	for (i = 0; i < n; i++)
	{
		int a;
		scanf ("%d", &a);

		if (a == 0)
			printf ("Y %.9lf %.9lf\n", 0, 0);
		else if (a < 4)
			puts ("N");
		else
		{
			double b = binsearch (a);
			printf ("Y %.9lf %.9lf\n", b, a - b);
		}
	}

	return 0;
}


#include <stdio.h>
#include <math.h>

long double binsearch (int n)
{
	long double l = sqrt ((long double)n), r = n, m = (l + r) / 2;

	while (l != m && r != m)
	{
		if (m * (n - m) <= n)
			r = m;
		else
			l = m;

		m = l + (r - l) / 2;
	}

	return m;
}

int main()
{
	int n, i;

	scanf ("%d", &n);

	for (i = 0; i < n; i++)
	{
		int a;
		scanf ("%d", &a);

		if (a == 0)
			printf ("Y %.9Lf %.9Lf\n", 0, 0);
		else if (a < 4)
			puts ("N");
		else
		{
			long double b = binsearch (a);
			printf ("Y %.9Lf %.9Lf\n", b, a - b);
		}
	}

	return 0;
}


#include <stdio.h>
#include <math.h>

double binsearch (int n)
{
	double l = sqrt ((double)n), r = n, m = (l + r) / 2;

	while (l != m && r != m)
	{
		if (m * (n - m) <= n)
			r = m;
		else
			l = m;

		m = l + (r - l) / 2;
	}

	return m;
}

int main()
{
	int n, i;

	scanf ("%d", &n);

	for (i = 0; i < n; i++)
	{
		int a;
		scanf ("%d", &a);

		if (a == 0)
			printf ("Y %.9lf %.9lf\n", 0, 0);
		else if (a < 4)
			puts ("N");
		else
		{
			double b = binsearch (a);
			printf ("Y %.9lf %.9lf\n", b, a - b);
		}
	}

	return 0;
}


#include <stdio.h>
#include <math.h>

long double binsearch (int n)
{
	long double l = sqrt ((long double)n), r = n, m = (l + r) / 2;

	while (l != m && r != m)
	{
		if (m * (n - m) <= n)
			r = m;
		else
			l = m;

		m = l + (r - l) / 2;
	}

	return m;
}

int main()
{
	int n, i;

	scanf ("%d", &n);

	for (i = 0; i < n; i++)
	{
		int a;
		scanf ("%d", &a);

		if (a == 0)
			printf ("Y %.9lf %.9lf\n", 0, 0);
		else if (a < 4)
			puts ("N");
		else
		{
			long double b = binsearch (a);
			printf ("Y %.9Lf %.9Lf\n", b, a - b);
		}
	}

	return 0;
}