#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long int sum=0,i,j,a,b,c,n,m,k=0,ma,mi;
		cin>>n;
		long long int arr[n];
		for(i=0;i<n;i++)
		{
			cin>>arr[i];
		}
		cout<<arr[0]<<" ";
		for(i=1;i<n;i++)
		{
			if((arr[i]%arr[i-1])==0 || (arr[i-1]%arr[i])==0)
			cout<<arr[i]<<" ";
			else
			{
				ma=max(arr[i-1],arr[i]);
				mi=min(arr[i-1],arr[i]);
				if(arr[i]==ma)
				{
					arr[i]=(arr[i]-(ma%mi));
					cout<<(arr[i])<<" ";
				}
				else
				{
					arr[i]=1;
					cout<<arr[i]<<" ";
					//cout<<(arr[i]+(ma%mi))<<" ";
					//arr[i]=(arr[i]+(ma%mi));
				}
			}
		}
		cout<<endl;
	}
}
