#include <bits/stdc++.h>
using namespace std;
template <typename T>
void setmax(T& x, T y) {
  x = max(x, y);
}
template <typename T>
void setmin(T& x, T y) {
  x = min(x, y);
}
const double PI = acos(-1.0);
const long long INF = 1e9 + 47;
const long long LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = (0); i < (n); ++i) cin >> a[i];
    int cntp = 0, cntm = 0;
    for (int i = (1); i < (n); ++i) {
      if (a[i] == a[i - 1])
        cntp++, cntm++;
      else if (a[i] > a[i - 1])
        cntp++;
      else
        cntm++;
    }
    const int N = (n - 1) / 2;
    while (cntp < N) {
      for (int i = (1); i < (n); ++i) {
        int tut = 0;
        tut += a[i] >= a[i - 1];
        tut += (i < n - 1) && a[i + 1] >= a[i];
        int bude = 0;
        bude += -a[i] >= a[i - 1];
        bude += (i < n - 1) && a[i + 1] >= -a[i];
        if (bude > tut) {
          cntp += bude - tut;
          a[i] = -a[i];
          break;
        }
      }
    }
    while (cntm < N) {
      for (int i = (1); i < (n); ++i) {
        int tut = 0;
        tut += a[i] <= a[i - 1];
        tut += (i < n - 1) && a[i + 1] <= a[i];
        int bude = 0;
        bude += -a[i] <= a[i - 1];
        bude += (i < n - 1) && a[i + 1] <= -a[i];
        if (bude > tut) {
          cntm += bude - tut;
          a[i] = -a[i];
          break;
        }
      }
    }
    for (int i = (0); i < (n); ++i) cout << a[i] << ' ';
    cout << endl;
  }
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
