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