// In the name of Allah//

// Created by Riaj Uddin //
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<pair<ll, int>> vli;
typedef double dl;
typedef map<ll, ll> mp;

#define sz1 cout << endl;
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(x) (int)x.size()
#define rep(a, b) for (int i = a; (int)i <= b; i++)
#define rep1(a, b) for (ll i = a; (ll)i <= b; i++)
#define REP(a, n) for (int i = a; (int)i < n; i++)
#define REP1(a, n) for (ll i = a; (ll)i < n; i++)
#define F first
#define S second

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a, b) memset(a, b, sizeof(a))
#define sqr(a) ((a) * (a))

#define power_booster()           \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define fraction()                \
    cout.unsetf(ios::floatfield); \
    cout.precision(10);           \
    cout.setf(ios::fixed, ios::floatfield);
#define file()                        \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);

void prl(int x)
{
    cout << x << endl;
}
int dx[] = {0, 0, +1, -1, -1 + 1, -1, +1};
int dy[] = {+1, -1, 0, 0, -1, +1, +1, -1};

const int MX = 2e5 + 123;
/*bitset<MX> is_prime;
vector<int> prime;

void primeGen ( int n )
{
    n += 100;
    for ( int i = 3; i <= n; i += 2 ) is_prime[i] = 1;

    int sq = sqrt ( n );
    for ( int i = 3; i <= sq; i += 2 ) {
        if ( is_prime[i] == 1 ) {
            for ( int j = i*i; j <= n; j += ( i + i ) ) {
                is_prime[j] = 0;
            }
        }
    }

    is_prime[2] = 1;
    prime.push_back (2);

    for ( int i = 3; i <= n; i += 2 ) {
        if ( is_prime[i] == 1 ) prime.push_back ( i );
    }
}

vector<long long > factor(long long  n ){
    vector<long long > ret;
    for( auto p : prime){
        if(1LL * p * p > n ) break;

        if(n%p==0){
            while(n%p==0){
                ret.PB(p);
                n/=p;
            }
        }
    } 
    if(n>1) ret.PB(n);
    return ret;

}*/

void test()
{
   ll n;
   cin>>n;
   vl v;
   for(ll i=0;i<n;i++) {
       ll a;
       cin>>a;
       v.pb(a);
   }
   for(ll i=0;i<n;i++) {
      ll k=1;
       while(k*2<v[i]) k*=2;
       cout<<k<<" ";
   }

    sz1
}

int main()
{
    //file();
    power_booster();
    //primeGen(1e7);
    // fraction();
    ll tc;
    cin >> tc;
    while (tc--)
    {
        test();
    }
   //test();
}