#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, k;
  scanf("%*d");
  while (scanf("%d%d%d%d%d", &a, &b, &c, &d, &k) == 5) {
    int A, B;
    A = a / c;
    B = b / d;
    if (A * c != a) A = A + 1;
    if (B * d != b) B = B + 1;
    A + B <= k ? printf("%d %d\n", A, B) : puts("-1");
  }
  return 0;
}
