For given a circle $c$ and a line $l$, print the coordinates of the cross points of them.

Constraints

* $p1$ and $p2$ are different
* The circle and line have at least one cross point
* $1 \leq q \leq 1,000$
* $-10,000 \leq cx, cy, x1, y1, x2, y2 \leq 10,000$
* $1 \leq r \leq 10,000$

Input

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.

Output

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.

Example

Input

2 1 1
2
0 1 4 1
3 0 3 3


Output

1.00000000 1.00000000 3.00000000 1.00000000
3.00000000 1.00000000 3.00000000 1.00000000
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
static const double EPS = pow(10,-10);
typedef long long ll;
static int COUNTER_CLOCKWISE = 1;
static int CLOCKWISE = -1;
static int ONLINE_BACK = 2;
static int ONLINE_FRONT = -2;
static int ON_SEGMENT = 0;

class Vector2{
  public:
  double x, y;
  Vector2(){}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator + (Vector2 v) {
    return Vector2(x + v.x , y + v.y);
  }
  Vector2 operator - (Vector2 v) {
    return Vector2(x - v.x , y - v.y);
  }

  Vector2 operator * (double d){
    return Vector2(d*x, d*y);
  }

  double norm(){
    return pow(x,2) + pow(y,2);
  }

  double abs(){
    return sqrt(norm());
  }

};

class Circle{
  public:
  Vector2 center;
  double r;
  Circle(){};
  Circle(Vector2 center_, double r):center(center),r(r){};
};

double dot(Vector2 a, Vector2 b){
  return a.x * b.x + a.y * b.y; 
}

double cross(Vector2 a, Vector2 b){
  return a.x * b.y - a.y*b.x;
}

Vector2 projection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 base = b - a;
  Vector2 hypo = p - a;
  double norm_base = pow(base.x,2) + pow(base.y,2);

  Vector2 x;
  x = a + base*(dot(hypo,base) / norm_base);
  return x;
}

Vector2 refrection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 v, p_projection;
  p_projection = projection(a,b,p); 
  v = p_projection + (p_projection - p);
  return v;
}

int ccw(Vector2 a, Vector2 b, Vector2 p){
  Vector2 hypo = p - a;
  Vector2 base = b - a;
  if(cross(base,hypo) > EPS) return COUNTER_CLOCKWISE;
  if(cross(base,hypo) < -EPS) return CLOCKWISE;
  if(dot(base,hypo) < -EPS) return ONLINE_BACK;
  if(hypo.norm() > base.norm()) return ONLINE_FRONT;
  return ON_SEGMENT;
}

bool intersect(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  int t1, t2;
  t1 =ccw(a,b,p)*ccw(a,b,q);
  t2 =ccw(p,q,a)*ccw(p,q,b);
  if(t1 <= 0 && t2 <= 0) return true;
  else return false;
}

Vector2 crossPoint(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  Vector2 base, hypo_1, hypo_2, v;
  base = b-a;
  hypo_1 = p-a;
  hypo_2 = q-a;
  double d1 = abs(cross(base, hypo_1)); 
  double d2 = abs(cross(base, hypo_2));
  double ratio = d1/(d1+d2);
  v = p + (hypo_2 - hypo_1)*ratio;
  return v;
}

double distance(Vector2 a,Vector2 b,Vector2 p){
  if(dot(b-a, p-b) > 0) return (p-b).abs();
  if(dot(b-a, p-a) < 0) return (p-a).abs();
  return (p - projection(a,b,p)).abs();
}

double distance(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  if(intersect(a,b,p,q)) return 0;
  vector<double> d_arr(4) ;
  d_arr[0] = distance(a,b,p);
  d_arr[1] = distance(a,b,q);
  d_arr[2] = distance(p,q,a);
  d_arr[3] = distance(p,q,b);
  return min(min(d_arr[0],d_arr[1]),
             min(d_arr[2],d_arr[3]));
}

pair<Vector2,Vector2> crossPoint(Circle circle, Vector2 a, Vector2 b){
  Vector2 base = b-a ;
  Vector2 pro = projection(a,b,circle.center);
  double ratio = sqrt(pow(circle.r,2) -(pro-circle.center).norm())
                 / base.abs();
  Vector2 v_1, v_2, tmp;
  v_1 = pro - base*ratio;
  v_2 = pro + base*ratio;
  if((v_1.x == v_2.x && v_1.y > v_2.y) || v_1.x > v_2.x) swap(v_1,v_2);
  return make_pair(v_1,v_2);
}       




int main(){
  Vector2 a,b;
  pair<Vector2,Vector2> ans;
  Circle c;
  cin >> c.center.x >> c.center.y >> c.r;
  int queri;
  cin >> queri;
  rep(i,queri){
    cin >> a.x >> a.y >> b.x >> b.y;
    ans = crossPoint(c, a, b);
    cout << fixed << setprecision(8);
    cout << ans.first.x << " " << ans.first.y << " ";
    cout << ans.second.x << " " << ans.second.y;
    cout << endl;
  }
  return 0;
}
