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