#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
inline string IntToString(long long a) {
  ostringstream str1;
  str1 << a;
  string geek = str1.str();
  return geek;
}
inline long long StringToInt(string a) {
  stringstream geek(a);
  long long x = 0;
  geek >> x;
  return x;
}
inline long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
inline long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
inline long long power(long long x, long long y) {
  long long temp;
  if (y == 0) return 1;
  temp = pow(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
inline long long sumDigits(long long n) {
  return n == 0 ? 0 : n % 10 + sumDigits(n / 10);
}
inline bool isprime(long long n) {
  vector<bool> prime(n + 1, true);
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  if (n == 1)
    return false;
  else if (prime[n])
    return true;
  else
    return false;
}
inline bool ispalinDigit(string num) {
  string t = num;
  reverse(t.begin(), t.end());
  if (t == num) return true;
  return false;
}
inline void primeFactors(long long n) {
  while (n % 2 == 0) {
    printf("%d ", 2);
    n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      printf("%lld ", i);
      n = n / i;
    }
  }
  if (n > 2) printf("%lld ", n);
}
inline long long fact(long long n) {
  if (n <= 1) return 1;
  return n * fact(n - 1);
}
inline long long ncr(long long n, long long r) {
  long long p = 1, k = 1;
  if (n - r < r) r = n - r;
  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      long long m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else
    p = 1;
  return p;
}
inline long long npr(long long n, long long r) { return fact(n) / fact(n - r); }
inline void Natural_Divisors(long long n) {
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        printf("%lld ", i);
      else
        printf("%lld %lld ", i, n / i);
    }
  }
}
inline long long countDivisors(long long n) {
  long long cnt = 0;
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
inline bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
inline bool isP(long long a) {
  if (a % 2 != 0) {
    if (a % 3 != 0 && a % 5 != 0 && a % 7 != 0) {
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}
inline long long Count_primeFactors(long long n) {
  long long cnt = 0;
  while (n % 2 == 0) {
    cnt++;
    n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      cnt++;
      n = n / i;
    }
  }
  if (n > 2) {
    cnt++;
  }
  return cnt;
}
inline void printA(long long arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "\n";
}
inline void printV(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
void checktimer() {
  clock_t start, end;
  start = clock();
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
  cout << "Execution time: " << time_taken << " secs";
}
void solve() {
  long long a, b, c, d, k;
  cin >> a >> b >> c >> d >> k;
  long long min_pen, min_pcil;
  if (a % c == 0 && b % d == 0) {
    min_pen = (a / c);
    min_pcil = (b / d);
    ((min_pen + min_pcil) <= k) ? cout << min_pen << " " << min_pcil << "\n"
                                : cout << "-1"
                                       << "\n";
  } else if (a % c == 0 && b % d != 0) {
    min_pen = (a / c);
    min_pcil = (b / d) + 1;
    ((min_pen + min_pcil) <= k) ? cout << min_pen << " " << min_pcil << "\n"
                                : cout << "-1"
                                       << "\n";
  } else if (a % c != 0 && b % d == 0) {
    min_pen = (a / c) + 1;
    min_pcil = (b / d);
    ((min_pen + min_pcil) <= k) ? cout << min_pen << " " << min_pcil << "\n"
                                : cout << "-1"
                                       << "\n";
  } else if (a != c && b != d) {
    min_pen = (a / c) + 1;
    min_pcil = (b / d) + 1;
    ((min_pen + min_pcil) <= k) ? cout << min_pen << " " << min_pcil << "\n"
                                : cout << "-1"
                                       << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
