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