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

#define int long long
#define fi first
#define se second
#define pb push_back

int n,s1,s2,a[100],i,t,w;

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>t;
	for (w=1;w<t+1;w++)
	{
		cin>>n;
		for (i=1;i<n+1;i++) cin>>a[i];
		s1=0;s2=0;
		for (i=1;i<n+1;i++)
		if (i%2==0) s1=s1+a[i];else s2=s2+a[i];
		if (s1<s2)
		{
			for (i=1;i<n+1;i++) if (i%2==0) cout<<"1 ";else cout<<a[i]<<" ";
		}
		else
		{
			for (i=1;i<n+1;i++) if (i%2==1) cout<<"1 ";else cout<<a[i]<<" ";
		}
		cout<<"\n";
	}
}
