#include <bits/stdc++.h>
using namespace std;
template <class T>
bool tomin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <class T>
bool tomax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <class T>
void read(T &x) {
  char c;
  x = 0;
  int f = 1;
  while (c = getchar(), c < '0' || c > '9')
    if (c == '-') f = -1;
  do x = (x << 3) + (x << 1) + (c ^ 48);
  while (c = getchar(), c >= '0' && c <= '9');
  x *= f;
}
bool mem1;
const double Pi = acos(-1);
bool mem2;
int main() {
  srand(time(NULL));
  int T;
  read(T);
  while (T--) {
    int a, b, c, d, k;
    read(a), read(b), read(c), read(d);
    read(k);
    int x = (a + c - 1) / c;
    int y = (b + d - 1) / d;
    if (x + y <= k)
      printf("%d %d\n", x, y);
    else
      puts("-1");
  }
  return 0;
}
