#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int a, b, c, d, k, x, y;
    cin >> a >> b >> c >> d >> k;
    x = min((a / c) + 1, (a / c) + (a % c));
    y = min((b / d) + 1, (b / d) + (b % d));
    if (x + y <= k)
      cout << x << " " << y << "\n";
    else
      cout << "-1\n";
  }
  return 0;
}
