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