#include <bits/stdc++.h>
using namespace std;
long long exgcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long u = exgcd(b, a % b, y, x);
  y -= a / b * x;
  return u;
}
long long f(long long a, long long b, long long mod) {
  long long x, y;
  long long gcd = exgcd(a, mod, x, y);
  if (b % gcd != 0) return -1;
  x *= b / gcd, mod /= gcd;
  if (mod < 0) mod = -mod;
  long long ans = (x % mod + mod) % mod;
  return ans;
}
int main() {
  int n, m, x, y, vx, vy;
  scanf("%d%d%d%d%d%d", &n, &m, &x, &y, &vx, &vy);
  if (abs(vx + vy) == 1) {
    if (vx == 0) {
      if (x == 0 || x == n)
        return cout << x << ' ' << (y == 1 ? m : 0) << '\n', 0;
    } else {
      if (y == 0 || y == m)
        return cout << (x == 1 ? n : 0) << ' ' << y << '\n', 0;
    }
  } else {
    int fx, fy;
    if (vx == 1)
      fx = n - x;
    else
      fx = x;
    if (vy == 1)
      fy = m - y;
    else
      fy = y;
    long long res = f(n, ((fy - fx) % m + m) % m, m);
    if (res != -1) {
      long long u = (fx + res * n - fy) / m;
      long long a = (vx == 1 ? 1 : 0) + res, b = (vy == 1 ? 1 : 0) + u;
      return cout << ((a % 2) == 1 ? n : 0) << ' ' << ((b % 2) == 1 ? m : 0)
                  << '\n',
             0;
    }
  }
  cout << -1 << '\n';
}
