#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int a, b, c, d, k, w, q;
    cin >> a >> b >> c >> d >> k;
    if (!(a % c) && !(b % d)) {
      w = a / c;
      q = b / d;
    } else if ((a % c) && !(b % d)) {
      w = a / c + 1;
      q = b / d;
    } else if (!(a % c) && (b % d)) {
      w = a / c;
      q = b / d + 1;
    } else {
      w = a / c + 1;
      q = b / d + 1;
    }
    if (w + q > k)
      cout << -1 << endl;
    else
      cout << w << " " << q << endl;
  }
  return 0;
}
