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 <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#define EPS (1e-10)
using namespace std;
static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT=0;
class Point{
public:
    double x,y;
    Point(double x=0, double y=0):x(x),y(y){}
    Point operator +(const Point &p){
        return Point(x+p.x,y+p.y);
    }
    Point operator -(const Point &p){
        return Point(x-p.x,y-p.y);
    }
    Point operator *(double k){
        return Point(k*x,k*y);
    }
    Point operator /(double k){
        return Point(x/k,y/k);
    }

    double norm(){
        return x*x+y*y;
    }
    double abs(){
        return sqrt(norm());
    }
};
typedef Point Vector;
struct segment{
    Point p1,p2;
};
typedef segment Line;
class Circle{
public:
    Point c;
    double r;
    Circle (double x=0, double y=0,double r=0):c(x,y),r(r){}
};
double dot(const Vector &v1,const Vector &v2){
    return v1.x*v2.x+v1.y*v2.y;
}
double cross(const Vector &v1,const Vector &v2){
    return v1.x*v2.y-v1.y*v2.x;
}
bool isParallel(const Vector &v1,const Vector &v2){
    if(fabs(cross(v1,v2)-0.0)<EPS)return true;
    return false;
}
bool isOrthogonal(const Vector &v1,const Vector &v2){
    if(fabs(dot(v1,v2)-0.0)<EPS)return true;
    return false;
}
Point projection( Point &p, Point &p1, Point &p2){
    Vector a=p-p1;
    Vector b=p2-p1;
    double r=dot(a,b);
    double pro_abs=r/b.norm();
    Vector res=b*pro_abs;
    return Point(res.x+p1.x,res.y+p1.y);
}
Point reflection(Point &p, Point &p1, Point &p2){
    Point pro=projection(p,p1,p2);
    Vector v=pro-p;
    v=v*2;
    return Point(v.x+p.x,v.y+p.y);
}
int ccw(Point &p, Point &p1, Point &p2){
    Vector a=p-p1;
    Vector b=p2-p1;
    if(cross(a,b)>0)return COUNTER_CLOCKWISE;
    if(cross(a,b)<0)return CLOCKWISE;
    if(dot(a,b)<0)return ONLINE_BACK;
    if(a.norm()>b.norm())return ONLINE_FRONT;
    return ON_SEGMENT;
}
bool intersect(segment &s1,segment &s2){
    if(ccw(s1.p1,s2.p1,s2.p2)*ccw(s1.p2,s2.p1,s2.p2)<=0 && ccw(s2.p1,s1.p1,s1.p2)*ccw(s2.p2,s1.p1,s1.p2)<=0)
        return true;
    return false;
}
double getDistanceSP(Point &p,segment &s){
    if(dot(p-s.p1,s.p2-s.p1)<0)return (p-s.p1).abs();
    if(dot(p-s.p2,s.p1-s.p2)<0)return (p-s.p2).abs();
    return fabs(cross(p-s.p1,s.p2-s.p1)/(s.p2-s.p1).abs());
}
double Distance(segment &s1,segment &s2){
    if(intersect(s1,s2))return 0;
    return min(min(getDistanceSP(s1.p1,s2),getDistanceSP(s1.p2,s2)),min(getDistanceSP(s2.p1,s1),getDistanceSP(s2.p2,s1)));
}
Point CrossPoint(segment &s1,segment &s2){
    Vector base =s2.p2-s2.p1;
    double d1=fabs(cross(base,s1.p1-s2.p1));
    double d2=fabs(cross(base,s1.p2-s2.p1));
    double t=d1/(d1+d2);
    return (s1.p2-s1.p1)*t+s1.p1;
}
pair<Point,Point> getCrossPoints(Circle &c,Line &l){
    Vector e = (l.p2-l.p1)/(l.p2-l.p1).abs();
    Point p=projection(c.c,l.p1,l.p2);
    double len=sqrt(c.r*c.r-(p-c.c).norm());
    return make_pair(p-e*len,p+e*len);
 }
int main()
{
    int q,cx,cy,cr,p0x,p1x,p0y,p1y;
    cin>>cx>>cy>>cr;
    Circle c(cx,cy,cr);
    Line l1;
    cin>>q;
    while(q-->0){
        cin>>p0x>>p0y>>p1x>>p1y;
        l1.p1=Point(p0x,p0y);
        l1.p2=Point(p1x,p1y);
        pair<Point,Point>res=getCrossPoints(c,l1);
        if(res.first.x<=res.second.x){
            if(fabs(res.first.x-res.second.x)<EPS && res.first.y>res.second.y){
                printf("%.8f %.8f %.8f %.8f\n",res.second.x,res.second.y,res.first.x,res.first.y);
                continue;
            }
            printf("%.8f %.8f %.8f %.8f\n",res.first.x,res.first.y,res.second.x,res.second.y);
        }
        else
            printf("%.8f %.8f %.8f %.8f\n",res.second.x,res.second.y,res.first.x,res.first.y);
    }
    return 0;
}
