{-# LANGUAGE NamedFieldPuns #-}
import Control.Monad (replicateM_)
import Data.Foldable (traverse_)
import Data.Functor ((<$>))
import Numeric (showFFloat)

data Point = Point { x :: Double, y :: Double }

instance Show Point where
  show (Point{x, y}) = sf x ++ " " ++ sf y
     where
     sf x = showFFloat Nothing x $ ""

readLnPoint = do
  [x, y] <- map read . words <$> getLine
  return $ Point {x, y}

dot p1 p2 = x p1 * x p2 + y p1 * y p2
psub p1 p2 = Point { x = x p1 - x p2, y = y p1 - y p2 }
scale a (Point{x, y}) = Point { x = a * x, y = a * y }

reflection a b = scale (2 * dot a b / dot a a) a `psub` b

main = do
  (p1, p2) <- do
    [x1, y1, x2, y2] <- map read . words <$> getLine
    return ( Point {x = x1, y = y1}, Point {x = x2, y = y2} )
  q <- readLn
  let originP1   p = Point { x = x p - x p1, y = y p - y p1 }
      unOriginP1 p = Point { x = x p + x p1, y = y p + y p1 }
      a = p2 `psub` p1
  replicateM_ q $ readLnPoint >>= \p -> let b = originP1 p in print $ unOriginP1 $ reflection a b

