#include <bits/stdc++.h>
using namespace std;
int d, x, y;
void gcd(int a, int b) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
    return;
  }
  gcd(b, a % b);
  int t = x;
  x = y;
  y = t - a / b * y;
}
int main() {
  int T;
  T = 1;
  while (T--) {
    int n, m, x, y, vx, vy;
    scanf("%d%d%d%d%d%d", &n, &m, &x, &y, &vx, &vy);
    if (vx == 0) {
      if (x == 0 || x == n) {
        if (vy == 1)
          printf("%d %d\n", x, m);
        else
          printf("%d %d\n", x, 0);
      } else
        printf("-1\n");
    } else if (vy == 0) {
      if (y == 0 || y == m) {
        if (vx == 1)
          printf("%d %d\n", n, y);
        else
          printf("%d %d\n", 0, y);
      } else
        printf("-1\n");
    } else {
      int lbt = vx * m;
      if (lbt < 0) lbt = -lbt;
      int a = vy * n;
      a = (a % lbt + lbt) % lbt;
      int b = vy * x - vx * y;
      b = (b % lbt + lbt) % lbt;
      gcd(a, lbt);
      if (b % d) {
        printf("-1\n");
        continue;
      }
      int g = d;
      a /= g;
      b /= g;
      lbt /= g;
      gcd(a, lbt);
      if (::x < 0) ::x += lbt;
      long long kx = (long long)::x * b % lbt;
      long long ky = ((long long)vy * kx * n - vy * x + vx * y) / (vx * m);
      if (vx < 0 && kx > 0) {
        kx += (vx * m) / g;
        ky += (vy * n) / g;
      }
      if (vx > 0 && kx == 0) {
        kx += (vx * m) / g;
        ky += (vy * n) / g;
      }
      int ansx = 0;
      int ansy = 0;
      if ((kx % 2 + 2) % 2) ansx = n;
      if ((ky % 2 + 2) % 2) ansy = m;
      printf("%d %d\n", ansx, ansy);
    }
  }
  return 0;
}
