import Control.Monad
import Text.Printf

main = do
  line <- readline getLine
  let aa = Point { x = line !! 0, y = line !! 1}
  let bb = Point { x = line !! 2, y = line !! 3}
  let l = Line aa bb
  q <- readLn
  input <- replicateM q getLine
  let xs = fmap (fmap (read :: String -> Double) . words) input
  let points = fmap (\e -> Point{x = e !! 0, y = e !! 1}) xs
  solve2 l points
{-
solve :: Line Double -> [Point Double] -> IO ()
solve l xs = do
  let result = fmap (\e -> (x $ res l (e !! 0) (e !! 1), y $ res l (e !! 0) (e !! 1))) xs
  mapM_  (\r -> (printf "%.8f %.8f\n" (fst r) (snd r))) result
    where res l x1 y1 = l `reflect` Point{x=x1,y=y1}
-}
solve2 :: Line Double -> [Point Double] -> IO ()
solve2 l xs = do
  let result = fmap (\e -> (x $ res l (x e) (y e), y $ res l (x e) (y e))) xs
  mapM_  (uncurry (printf "%.8f %.8f\n")) result
    where res l x1 y1 = l `reflect` Point{x=x1,y=y1}

readline :: (Read a) => IO String -> IO [a]
readline io = fmap (fmap read . words) io

rep :: (Read a) => Int -> ([a] -> IO ()) -> IO ()
rep n f = do
  input <- replicateM n (readline getLine)
  mapM_ f input

eps :: (Floating a) => a
eps = 1e-7

add :: (Ord a, Floating a) => a -> a -> a
add a b
  | abs (a + b) < eps * (abs a + abs b ) = 0.0
  | otherwise = a + b

data Point a = Point { x :: a, y :: a } deriving (Eq)
instance (Show a) => Show (Point a) where
  show(Point x y) = show x ++ " " ++ show y

toTuple :: Point a -> (a,a)
toTuple a = (x a,y a)

data Line a = Line {a :: Point a, b :: Point a}
instance (Show a) => Show (Line a) where
  show(Line a b) = show a ++ " " ++ show b

(^+) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^+ b =  Point (add (x a) (x b)) (add (y a) (y b))

(^-) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^- b = Point (add (x a) (-(x b))) (add (y a) (-(y b)))

(^*) :: (Floating a) => Point a -> a -> Point a
a ^* d = Point (x a * d) (y a * d)

dot :: (Floating a) => Point a -> Point a -> a
a `dot` b = x a * x b + y a * y b

project :: (Ord a, Floating a) => Line a -> Point a -> Point a
l `project` p = a l ^+ (base ^* t)
  where base = b l ^- a l
        t = ((p ^- a l) `dot` base) / (base `dot` base)

reflect :: (Ord a, Floating a) => Line a -> Point a -> Point a
l `reflect` p = p ^+ (((l `project` p) ^- p) ^* 2.0)