#include <bits/stdc++.h>
const int INF = 1 << 28;
const long long LINF = 1LL << 59LL;
const long long MOD = 1000000007;
const int MAXN = 200005;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int T;
  cin >> T;
  while (T--) {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    int pen = 0, pencil = 0;
    pen = a / c;
    if (a % c != 0) pen++;
    pencil = b / d;
    if (b % d != 0) pencil++;
    if (pen + pencil > k)
      cout << "-1\n";
    else
      cout << pen << " " << pencil << "\n";
  }
  return 0;
}
