#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,n) for(ll i=a;i<n;i++)
#define w(x) ll _t;cin>>_t;f(x,1,_t+1)
#define br cout<<"\n"

ll mod=1e9+7,v,q;
template<class T>
void printArr(T arr,int n){
    cout<<"\n[";f(i,0,n) cout<<arr[i]<<", ";
    cout<<"]\n";
}
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll poww(ll a,ll m){
    ll res=1;
    a = a%mod;
    for(;m;m>>=1){
        if(m&1){
            res=(res*a)%mod;
        }
        a=(a*a)%mod;
    }
    return res;
}


int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    w(_x)
    {
        ll n;cin>>n;
        ll a[n];
        f(i,0,n) cin>>a[i];
        ll b[n];
        ll S=0,S_=0;
        f(i,0,n){
            ll x=1;
            S+=a[i];
            while(x<=a[i]) x <<= 1;
            if(a[i]-x/2<=x-a[i] || x>1e9) b[i]=x/2;
            else b[i]=x;
            S_+=abs(a[i]-b[i]);
        }
        //if(2*S_<=S) cout<<"yes\n";
        f(i,0,n) cout<<b[i]<<" ";
        br;
    }
    return 0;
}