Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

#define eps (1e-10)
struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
    Point operator+(Point p) {return Point(x+p.x,y+p.y);}
    Point operator-(Point p) {return Point(x-p.x,y-p.y);}
    Point operator*(Point p) {return Point(x*p.x-y*p.y,x*p.y+y*p.x);}
    Point operator*(double k){return Point(x*k,y*k);}
    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}
    bool operator == (const Point &p) const{return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}
    double arg(){return atan2(y,x);}
    double dot(Point p){return x*p.x+y*p.y;}
    double det(Point p){return x*p.y-y*p.x;}
};
bool cmp_x(const Point& p,const Point& q){
  if(p.x!=q.x) return p.x<q.x;
  return p.y<q.y;
}
struct Line{
    Point p1,p2;
    Line(){}
    Line(Point p1, Point p2):p1(p1),p2(p2){}
};
struct Circle{
    double r;
    Point p;
    Circle(){}
    Circle(Point p,double r):p(p),r(r){}
};
int ccw(Point a,Point b,Point c){
    Point t1=b-a,t2=c-a;
    if(t1.det(t2)> eps) return 1;//counter clockwise
    if(t1.det(t2)< -eps) return -1;//clockwise
    if(t1.dot(t2)< -eps) return 2;//c-a-b online
    if(t1.norm()<t2.norm()) return -2;//a-b-c online
    return 0;//a-c-b online
}
Point project(Line l,Point p){
    Point base=l.p2-l.p1;
    double r=(p-l.p1).dot(base)/base.norm();
    return l.p1+base*r;
}
double distance(Line l,Point p){
    Point r=project(l,p);
    return (p-r).abs();
    /*
    if(abs(ccw(l.p1,l.p2,r))==0) return (p-r).abs();//projection not online
    else return min((p-l.p1).abs(),(p-l.p2).abs());
    */
}
bool isIntersectCC(Circle c1,Circle c2){
    return (c1.p-c2.p).abs()<=c1.r+c2.r+eps;
}
bool isIntersectCL(Circle c,Line l){
    return distance(l,c.p)<=c.r+eps;
}
pair<Point,Point> CrossPointsCC(Circle c1,Circle c2){
    assert(isIntersectCC(c1,c2));
    double d=(c1.p-c2.p).abs();
    double k=acos((d*d+c1.r*c1.r-c2.r*c2.r)/(c1.r*d*2));
    return make_pair(c1.p+(c2.p-c1.p)*Point(cos(k),sin(k))*(c1.r/d),c1.p+(c2.p-c1.p)*Point(cos(-k),sin(-k))*(c1.r/d));
}
pair<Point,Point> CrossPointsCL(Circle c,Line l){
    assert(isIntersectCL(c,l));
    Point p=project(l,c.p);
    double q=sqrt(c.r*c.r-(p-c.p).norm());
    Point e=(l.p2-l.p1)*(1.0/(l.p2-l.p1).abs());
    return make_pair(p+e*q,p-e*q);
}
int main(){
    double cx,cy,r;
    double x1,y1,x2,y2;
    int q;
    cin>>cx>>cy>>r;
    Circle c(Point(cx,cy),r);
    cin>>q;
    rep(i,q){
        cin>>x1>>y1>>x2>>y2;
        Line l(Point(x1,y1),Point(x2,y2));
        pair<Point,Point> pp=CrossPointsCL(c,l);
        if(!cmp_x(pp.first,pp.second)) swap(pp.first,pp.second);
        cout<<fixed<<setprecision(12)<<pp.first.x<<" "<<pp.first.y<<" "<<pp.second.x<<" "<<pp.second.y<<endl;
    }
    return 0;
}