#include <bits/stdc++.h>
using namespace std;
int phi(int n) {
  int x = n;
  if (n % 2 == 0) {
    while (n % 2 == 0) n /= 2;
    x /= 2;
  }
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i) continue;
    while (n % i == 0) n /= i;
    x /= i;
    x *= (i - 1);
  }
  if (n > 1) {
    x /= n;
    x *= (n - 1);
  }
  return x;
}
int ph, n;
long long inv(int x) {
  int p = phi(n);
  p--;
  long long ret = 1;
  while (p) {
    if (p & 1) ret = (ret * x) % n;
    x = ((long long)x * x) % n;
    p /= 2;
  }
  return ret;
}
int P[1000000][2];
vector<int> A[1000000];
int main() {
  int k;
  cin >> n >> k;
  int dx, dy;
  cin >> dx >> dy;
  long long in = inv(dx);
  in = (in * dy) % n;
  for (int i = 0; i < (int)k; i++) {
    scanf("%d", &P[i][0]);
    scanf("%d", &P[i][1]);
    int y1 = (P[i][1] + (in * (n - P[i][0]))) % n;
    A[y1].push_back(i);
  }
  int mx = 0;
  for (int i = 0; i < n; i++)
    if (A[i].size() > A[mx].size()) mx = i;
  int id = A[mx][0];
  cout << P[id][0] << " " << P[id][1] << endl;
  return 0;
}
