#include <iostream>
#include <complex>
#include <cstdio>
#include <utility>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
#define X real()
#define Y imag()
const double EPS = (1e-10);

P line_symmetry(L l, P p){
  P f = l.first, s = l.second - f, q = p - f;
  if(abs(q) < EPS) return p;
  return f + norm(q/s)*s*s/q;
}

int main(){
  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  L l = L(P(x1,y1),P(x2,y2));
  int q;
  cin >> q;
  for(int i = 0; i < q; ++i){
    cin >> x1 >> y1;
    P p = line_symmetry(l, P(x1,y1));
    printf("%.9lf %.8lf\n",p.X,p.Y);
  }
  return 0;
}

