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