#include <bits/stdc++.h>
int t, a, b, c, d, k, x, y;
int main(void) {
  scanf("%d", &t);
  while (t != 0) {
    scanf("%d %d %d %d %d", &a, &b, &c, &d, &k);
    x = a / c;
    y = b / d;
    if (x * c < a) x++;
    if (y * d < b) y++;
    if (x + y <= k)
      printf("%d %d\n", x, y);
    else
      printf("-1\n");
    t--;
  }
  exit(0);
}
