#include <bits/stdc++.h>
using namespace std;
void exgcd(long long a, long long b, long long &x, long long &y, long long c) {
  if (!b) {
    x = c;
    y = 0;
    return;
  }
  exgcd(b, a % b, y, x, c);
  y -= a / b * x;
}
long long n, m, x, y, X, Y, r, q, g, p, u, v, s, l;
int main() {
  scanf("%lld%lld%lld%lld%lld%lld", &n, &m, &x, &y, &X, &Y);
  if (!X) {
    if (!x || x == n)
      printf("%lld %lld\n", x, ~Y ? m : 0);
    else
      puts("-1");
    return 0;
  }
  if (!Y) {
    if (!y || y == m)
      printf("%lld %lld\n", ~X ? n : 0, y);
    else
      puts("-1");
    return 0;
  }
  r = ~X ? (n - x) % n : x % n, q = ~Y ? (m - y) % m : y % m, g = n, p = m;
  for (; p; p ^= g ^= p ^= g) g %= p;
  if ((r - q) % g) {
    puts("-1");
    return 0;
  }
  l = 1ll * n / g * m;
  exgcd(n, m, u, v, (q - r) / g);
  u %= m / g;
  s = ((u * n + r) % l + l) % l;
  u = x + s * X;
  v = y + s * Y;
  n <<= 1;
  m <<= 1;
  printf("%lld %lld\n", (u % n + n) % n, (v % m + m) % m);
  return 0;
}
