#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long int tc;
  cin >> tc;
  while (tc--) {
    long long int a, b, c, d, k, pen, pencil;
    cin >> a >> b >> c >> d >> k;
    pen = a / c;
    pencil = b / d;
    if (a % c != 0) pen++;
    if (b % d != 0) pencil++;
    if (pen + pencil <= k)
      cout << pen << " " << pencil << "\n";
    else
      cout << "-1\n";
  }
}
