#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 2e6 + 7;
const long long dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const long long dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
long long i, j, k, t, n, q, l, r, mid;
long long a, b, x, y, cnt, mnt;
void solve() {
  cnt = 0;
  cin >> a >> b >> x >> y >> k;
  cnt = (a + x - 1) / x;
  mnt = (b + y - 1) / y;
  if (cnt + mnt <= k)
    cout << cnt << " " << mnt << endl;
  else
    cout << -1 << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> t;
  while (t--) solve();
  return 0;
}
