output_description: For each query, print the coordinates of the cross points in the following
  rules.
  
    * If there is one cross point, print two coordinates with the same values.
    * Print the coordinate with smaller $x$ first. In case of a tie, print the coordinate with smaller $y$ first.
  
  The output values should be in a decimal fraction with an error less than
  0.000001.
input_description: The input is given in the following format.
  
  $cx\; cy\; r$  
  $q$  
  $Line_1$  
  $Line_2$  
  :  
  $Line_q$  
  
  In the first line, the center coordinate of the circle and its radius are
  given by $cx$, $cy$ and $r$. In the second line, the number of queries $q$ is
  given.
  
  In the following $q$ lines, as queries, $Line_i$ are given ($1 \leq i \leq q$)
  in the following format.
  
  $x_1\; y_1\; x_2\; y_2$
  
  Each line is represented by two points $p1$ and $p2$ which the line crosses.
  The coordinate of $p1$ and $p2$ are given by ($x1$, $y1$) and ($x2$, $y2$)
  respectively. All input values are given in integers.
attempt: # -*- coding: utf-8 -*-
  
  import sys
  
  sys.setrecursionlimit(10**9)
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST():
      return list(map(int, input().split()))
  
  
  INF = float("inf")
  
  
  class Geometry:
  
      EPS = 10**-9
  
      def add(self, a, b):
          x1, y1 = a
          x2, y2 = b
          return (x1 + x2, y1 + y2)
  
      def sub(self, a, b):
          x1, y1 = a
          x2, y2 = b
          return (x1 - x2, y1 - y2)
  
      def mul(self, a, b):
          x1, y1 = a
          if not isinstance(b, tuple):
              return (x1 * b, y1 * b)
          x2, y2 = b
          return (x1 * x2, y1 * y2)
  
      def div(self, a, b):
          x1, y1 = a
          if not isinstance(b, tuple):
              return (x1 / b, y1 / b)
          x2, y2 = b
          return (x1 / x2, y1 / y2)
  
      def abs(self, a):
          from math import hypot
  
          x1, y1 = a
          return hypot(x1, y1)
  
      def norm(self, a):
          x, y = a
          return x**2 + y**2
  
      def dot(self, a, b):
          x1, y1 = a
          x2, y2 = b
          return x1 * x2 + y1 * y2
  
      def cross(self, a, b):
          x1, y1 = a
          x2, y2 = b
          return x1 * y2 - y1 * x2
  
      def project(self, seg, p):
          """線分segに対する点pの射影"""
          p1, p2 = seg
          base = self.sub(p2, p1)
          r = self.dot(self.sub(p, p1), base) / self.norm(base)
          return self.add(p1, self.mul(base, r))
  
      def reflect(self, seg, p):
          """線分segを対称軸とした点pの線対称の点"""
          return self.add(p, self.mul(self.sub(self.project(seg, p), p), 2))
  
      def ccw(self, p0, p1, p2):
          """線分p0,p1から線分p0,p2への回転方向"""
          a = self.sub(p1, p0)
          b = self.sub(p2, p0)
          # 反時計回り
          if self.cross(a, b) > self.EPS:
              return 1
          # 時計回り
          if self.cross(a, b) < -self.EPS:
              return -1
          # 直線上(p2 => p0 => p1)
          if self.dot(a, b) < -self.EPS:
              return 2
          # 直線上(p0 => p1 => p2)
          if self.norm(a) < self.norm(b):
              return -2
          # 直線上(p0 => p2 => p1)
          return 0
  
      def intersect(self, seg1, seg2):
          """線分seg1と線分seg2の交差判定"""
          p1, p2 = seg1
          p3, p4 = seg2
          return (
              self.ccw(p1, p2, p3) * self.ccw(p1, p2, p4) <= 0
              and self.ccw(p3, p4, p1) * self.ccw(p3, p4, p2) <= 0
          )
  
      def get_distance_LP(self, line, p):
          """直線lineと点pの距離"""
          p1, p2 = line
          return abs(
              self.cross(self.sub(p2, p1), self.sub(p, p1)) / self.abs(self.sub(p2, p1))
          )
  
      def get_distance_SP(self, seg, p):
          """線分segと点pの距離"""
          p1, p2 = seg
          if self.dot(self.sub(p2, p1), self.sub(p, p1)) < 0:
              return self.abs(self.sub(p, p1))
          if self.dot(self.sub(p1, p2), self.sub(p, p2)) < 0:
              return self.abs(self.sub(p, p2))
          return self.get_distance_LP(seg, p)
  
      def get_distance_SS(self, seg1, seg2):
          """線分seg1と線分seg2の距離"""
          p1, p2 = seg1
          p3, p4 = seg2
          if self.intersect(seg1, seg2):
              return 0
          return min(
              self.get_distance_SP(seg1, p3),
              self.get_distance_SP(seg1, p4),
              self.get_distance_SP(seg2, p1),
              self.get_distance_SP(seg2, p2),
          )
  
      def get_cross_pointSS(self, seg1, seg2):
          """線分seg1と線分seg2の交点"""
          p1, p2 = seg1
          p3, p4 = seg2
          base = self.sub(p4, p3)
          dist1 = abs(self.cross(base, self.sub(p1, p3)))
          dist2 = abs(self.cross(base, self.sub(p2, p3)))
          t = dist1 / (dist1 + dist2)
          return self.add(p1, self.mul(self.sub(p2, p1), t))
  
      def get_cross_pointCL(self, c, line):
          """円cと直線lineの交点"""
          from math import sqrt
  
          # if not intersect(c, line): return -1
          x, y, r = c
          p1, p2 = line
          pr = self.project(line, (x, y))
          e = self.div(self.sub(p2, p1), self.abs(self.sub(p2, p1)))
          base = sqrt(r * r - self.norm(self.sub(pr, (x, y))))
          return [self.add(pr, self.mul(e, base)), self.sub(pr, self.mul(e, base))]
  
  
  gm = Geometry()
  x, y, r = MAP()
  c = (x, y, r)
  for _ in range(INT()):
      x1, y1, x2, y2 = MAP()
      seg = ((x1, y1), (x2, y2))
      res = gm.get_cross_pointCL(c, seg)
      res.sort()
      # 2次元タプルをsumの第2引数で1次元にする
      res = sum(res, ())
      for i in range(3):
          print("{:.10f}".format(res[i]), end=" ")
      print("{:.10f}".format(res[-1]))
  
problem_description: Cross Points of a Circe and a Line
  
  For given a circle $c$ and a line $l$, print the coordinates of the cross
  points of them.
samples: [{"input": "and Output\n\n  \n\n## Sample Input\n\n    \n    \n    2 1 1\n    2\n    0 1 4 1\n    3 0 3 3", "output": ".00000000 1.00000000 3.00000000 1.00000000\n    3.00000000 1.00000000 3.00000000 1.00000000"}]