#include <bits/stdc++.h>
using namespace std;
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = egcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
bool linearCongruences(const vector<long long> &a, const vector<long long> &b,
                       const vector<long long> &m, long long &x, long long &M) {
  long long n = a.size();
  x = 0;
  M = 1;
  for (int i = 0; i < n; i++) {
    long long a_ = a[i] * M, b_ = b[i] - a[i] * x, m_ = m[i];
    long long y, t, g = egcd(a_, m_, y, t);
    if (b_ % g) return false;
    b_ /= g;
    m_ /= g;
    x += M * (y * b_ % m_);
    M *= m_;
  }
  x = (x + M) % M;
  return true;
}
long long n, m, x, y, vx, vy;
int main() {
  cin >> n >> m >> x >> y >> vx >> vy;
  vector<long long> A = {vx, vy}, B = {((-x % n) + n) % n, ((-y % m) + m) % m},
                    M = {n, m};
  if (vx == -1) {
    A[0] = 1;
    B[0] = (n - B[0]) % M[0];
  }
  if (vy == -1) {
    A[1] = 1;
    B[1] = (m - B[1]) % M[1];
  }
  long long xx, MM;
  bool flag = linearCongruences(A, B, M, xx, MM);
  if (!flag) {
    cout << -1 << endl;
    return 0;
  }
  xx = ((xx % MM) + MM) % MM;
  x += vx * xx;
  y += vy * xx;
  x /= n;
  y /= m;
  x = ((x % 2) + 2) % 2;
  y = ((y % 2) + 2) % 2;
  if (x == 0 && y == 0)
    cout << 0 << " " << 0 << endl;
  else if (x == 1 && y == 0)
    cout << n << " " << 0 << endl;
  else if (x == 0 && y == 1)
    cout << 0 << " " << m << endl;
  else
    cout << n << " " << m << endl;
  return 0;
}
