#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T;
  cin >> T;
  while (T--) {
    long long A, B, C, D, K;
    cin >> A >> B >> C >> D >> K;
    long long min_pen = (A / C) + 1;
    if (A % C == 0) min_pen--;
    long long min_pencil = (B / D) + 1;
    if (B % D == 0) min_pencil--;
    if (min_pen + min_pencil > K)
      cout << -1 << endl;
    else
      cout << min_pen << " " << min_pencil << endl;
  }
  return 0;
}
