#include<bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define lli long long int
#define vi vector<int>
#define vlli vector<long long int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define repa(i, a, b) for(int i = (a); i >= (b); i--)
#define repv(x, v) for(auto x : v)
#define debug(x) cout << #x << " = " << x << endl
#define debugsl(x) cout << #x << " = " << x << ", "
#define debugarr(x, a, b) cout << #x << " = ["; rep(i, a, b) cout << x[i] << ", "; cout << "]\n"
#define pb push_back

#define MAX_N  55

lli t, n, a[MAX_N], c, s, s2, b[MAX_N], par, impar;

int main()
{
    fastio;

    cin >> t;
    while(t--){
        cin >> n;
        s = 0;
        rep(i, 0, n - 1){
            cin >> a[i];
            s += a[i];
            b[i] = a[i];
        }
        sort(a, a + n);
        c = a[n / 2];

        par = impar = 0;
        rep(i, 0, n - 1){
            if (i & 1) impar += b[i];
            else par += b[i];
        }

        if (impar < par){
            rep(i, 0, n - 1){
                if (i & 1) cout << "1 ";
                else cout << b[i] << " ";
            }
        }
        else{
            rep(i, 0, n - 1){
                if (i & 1) cout << b[i] << " ";
                else cout << "1 ";
            }
        }
        cout << "\n";
    }

    return 0;
}
