#include <bits/stdc++.h>
using namespace std;
int t, a, b, c, d, k, ans, x, y;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  for (int l = 0; l < t; l++) {
    cin >> a >> b >> c >> d >> k;
    x = a / c;
    ans = x;
    if (a % c != 0) {
      ans++;
      x++;
    }
    y = b / d;
    ans += b / d;
    if (b % d != 0) {
      ans++;
      y++;
    }
    if (ans > k) {
      cout << -1 << '\n';
      continue;
    }
    cout << x << ' ' << y << '\n';
  }
}
