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 <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): 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 * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	Point neg(){
		return Point(-x,-y);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
bool vertical(Line l1,Line l2){
	return abs(dot(l1.p2 - l1.p1,l2.p2 - l2.p1)) < EPS;
}
bool parallel(Line l1,Line l2){
	return abs(det(l1.p2 - l1.p1,l2.p2 - l2.p1)) < EPS;
}
Point proj(Point p,Line l){
	Vector a = l.p2 - l.p1;
	double r = dot(a,p - l.p1) / a.norm();
	return l.p1 + a * r;
}
Point ref(Point p,Line l){
	Point A = proj(p,l);
	return A + (A - p);
}
int ccw(Segment/*Directed Segment*/ s,Point p){//
	Vector a = s.p2 - s.p1,b = p - s.p1;
	if(det(a,b) > EPS) return 1;//COUNTER_CLOCKWISE
	else if(det(a,b) < -EPS) return -1;//CLOCKWISE
	else if(dot(a,b) < -EPS) return 2;//ONLINE_BACK
	else if(a.norm() < b.norm() - EPS) return -2;//ONLINE_FRONT
	else return 0;//ON_SEGMENT
}
bool intersect(Segment s1,Segment s2){
	return ccw(s1,s2.p1) * ccw(s1,s2.p2) <= 0 && ccw(s2,s1.p1) * ccw(s2,s1.p2) <= 0;
}
double disSP(Segment s,Point p){
	Vector a = s.p2 - s.p1;
	if(dot(a,p - s.p1) < EPS) return (p - s.p1).abs_();
	if(dot(a.neg(),p - s.p2) < EPS) return (p - s.p2).abs_();
	return abs(det(a,p - s.p1) / a.abs_());
}
double disSS(Segment s1,Segment s2){
	if(intersect(s1,s2)) return 0;
	return min(min(disSP(s1,s2.p1),disSP(s1,s2.p2)),min(disSP(s2,s1.p1),disSP(s2,s1.p2)));
}
Point crossSS(Segment s1,Segment s2){//make sure s1 intersect s2!
	Vector a = s2.p2 - s2.p1;
	double d1 = abs(det(a,s1.p1 - s2.p1));
	double d2 = abs(det(a,s1.p2 - s2.p1));
	return s1.p1 + (s1.p2 - s1.p1) * (d1 / (d1 + d2));
}
vector <Point> crossCL(Circle o,Line l){
	Point A = proj(o.c,l);
	Vector a = l.p2 - l.p1, e = a / a.abs_();
	double AP = sqrt(o.r * o.r - (A - o.c).norm());
	vector <Point> res;
	res.push_back(A + e * AP);
	res.push_back(A - e * AP);
	return res;
}
int main(){
	Circle o; Line l;
	scanf("%lf%lf%lf",&o.c.x,&o.c.y,&o.r);
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%lf%lf%lf%lf",&l.p1.x,&l.p1.y,&l.p2.x,&l.p2.y);
		vector <Point> ans = crossCL(o,l);
		sort(ans.begin(),ans.end());
		for(int i=0;i<(int)ans.size();i++){
			printf("%.10f %.10f%c",ans[i].x,ans[i].y,i == (int)ans.size() - 1 ? '\n' : ' ');
		}
	}
	return 0;
}