#include <bits/stdc++.h>
using namespace std;
int fact[200005];
int phi[200005], S[200005];
int power(int first, int second) {
  int res = 1;
  while (second) {
    if (second & 1) {
      res = (long long)res * first % 1000000007;
    }
    second /= 2;
    first = (long long)first * first % 1000000007;
  }
  return res;
}
int mod_inv(int first) { return power(first, 1000000007 - 2); }
void cal_fac() {
  static bool done = false;
  if (done) return;
  done = true;
  fact[0] = 1;
  for (int i = 1; i < 200005; i++) {
    fact[i] = (long long)i * fact[i - 1] % 1000000007;
  }
}
int comb(int n, int k) {
  cal_fac();
  return (long long)fact[n] * mod_inv(fact[n - k]) % 1000000007 *
         mod_inv(fact[k]) % 1000000007;
}
void computeTotient() {
  for (int i = 1; i < 200005; i++) phi[i] = i;
  for (int p = 2; p < 200005; p++) {
    if (phi[p] == p) {
      phi[p] = p - 1;
      for (int i = 2 * p; i < 200005; i += p) {
        phi[i] = (phi[i] / p) * (p - 1);
      }
    }
  }
}
void CoPrimes() {
  computeTotient();
  S[0] = 0;
  phi[1] = 0;
  for (int i = 1; i < 200005; i++) S[i] = S[i - 1] + phi[i];
}
long long int natural_sum(int first) {
  return (long long int)first * (first + 1) / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    c = (a + c - 1) / c;
    d = (b + d - 1) / d;
    if (c + d > k)
      cout << "-1\n";
    else
      cout << c << " " << d << "\n";
  }
  return 0;
}
