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<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef stack<int> SI;
typedef queue<int> QI;
typedef list<int> LI;
typedef pair<int,int> PII;
typedef long long LL;

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EMP empty()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000
#define PI  acos(-1.0)
////////////////////////////////////////////////
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

/*????????????(??§?¨?)????????????*/
class Vector
{
public:
	double x,y;
	Vector(double x=0,double y=0):x(x),y(y){}
	
	Vector operator + (Vector p){return Vector(x+p.x,y+p.y);}
	Vector operator - (Vector p){return Vector(x-p.x,y-p.y);}
	Vector operator * (double a){return Vector(x*a,y*a);}
	Vector operator / (double a){return Vector(x/a,y/a);}
	
	double abs(){return sqrt(norm());}
	double norm(){return x*x+y*y;}
	
	bool operator <  (const Vector &p)const{return x!=p.x?x<p.x:y<p.y;}
	bool operator == (const Vector &p)const{return fabs(x-p.x)<EPS && fabs(y-p.y<EPS);}
};

/*??´???????????????*/
class Line
{
public:
	Vector p,q;
	Line(Vector p=Vector(),Vector q=Vector()):p(p),q(q){}
};

/*???????????????*/
class Circle
{
public:
	Vector c;
	double r;
	Circle(Vector c=Vector(),double r=0.0):c(c),r(r){}
};

/*???????????????????¬????????????§??????*/
double dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}
double cross(Vector a,Vector b){return a.x*b.y-b.x*a.y;}

/*??´??????????°???±*/
Vector project(Line l,Vector p)
{
	Vector base=l.q-l.p;
	double r=dot(p-l.p,base)/base.norm();
	return l.p+base*r;
}

/*????????¨??????????????¢????????????*/
int ccw(Vector p0,Vector p1,Vector p2)
{
	Vector a=p1-p0;
	Vector b=p2-p0;
	if(cross(a,b)>EPS)return 1;//???????¨???????
	if(cross(a,b)<-EPS)return -1;//????¨???????
	if(dot(a,b)<-EPS)return 2;//p0?????????
	if(a.norm()<b.norm())return -2;//p1????\\
	return 0;//?????????
}

/*?????????????????????*/
bool intersect(Vector p0,Vector p1,Vector p2,Vector p3)
{
	return (ccw(p0,p1,p2)*ccw(p0,p1,p3)<=0&&ccw(p2,p3,p0)*ccw(p2,p3,p1)<=0);
}

/*??´?????¨??´????????????*/
Vector LLcross(Vector p0,Vector p1,Vector p2,Vector p3)
{
	double d1=cross(p3-p2,p0-p2);
	double d2=cross(p3-p2,p1-p3);
	return p0+(p1-p0)*(d1/(d1+d2));
}

/*?????¨??´????????????*/
pair<Vector,Vector> CLcross(Circle c,Line l)
{
	Vector pr=project(l,c.c);
	Vector e=(l.q-l.p)/(l.q-l.p).abs();
	double base=sqrt(c.r*c.r-(pr-c.c).norm());
	return make_pair(pr+e*base,pr-e*base);
}

/*?????¨????????????*/
pair<Vector,Vector> CCcross(Circle c,Circle d)
{
	
}
//cout<<fixed<<setprecision(10);
////////////////////////////////////////////////
int main()
{
	Circle c;
	cin>>c.c.x>>c.c.y>>c.r;
	int n;cin>>n;
	Line l;
	cout<<fixed<<setprecision(10);
	REP(i,n)
	{
		cin>>l.p.x>>l.p.y>>l.q.x>>l.q.y;
		Vector a=CLcross(c,l).first;
		Vector b=CLcross(c,l).second;
		if(a<b)cout<<a.x<<" "<<a.y<<" "<<b.x<<" "<<b.y<<endl;
		else cout<<b.x<<" "<<b.y<<" "<<a.x<<" "<<a.y<<endl;
	}
	return 0;
}