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>

#define rep(i, a, b) for (int i = a, i##end = b; i <= i##end; ++i)
#define per(i, a, b) for (int i = a, i##end = b; i >= i##end; --i)
#define rep0(i, a) for (int i = 0, i##end = a; i < i##end; ++i)
#define per0(i, a) for (int i = (int)a-1; ~i; --i)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)
#define x first
#define y second
#define enter putchar('\n')

typedef long long ll;
typedef double DB;

const DB eps = 1e-12;
const DB PI = acos(-1);

int sgn(DB x) { return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1); }

struct Point {
	DB x, y;
	Point(DB x = 0, DB y = 0) : x(x), y(y) {}
	Point operator + (Point a) { return Point(x + a.x, y + a.y); }
	Point operator - (Point a) { return Point(x - a.x, y - a.y); }
	Point operator - () { return Point(-x, -y); }
	friend Point operator * (DB k, Point a) { return Point(k * a.x, k * a.y); }
	Point operator / (DB k) { return Point(x / k, y / k); }
	DB operator % (Point a) { return x * a.x + y * a.y; }
	DB operator / (Point a) { return x * a.y - y * a.x; }
	operator DB() { return sqrt(x*x + y*y); }
	bool operator < (const Point &a) const { int d1 = sgn(x-a.x), d2 = sgn(y-a.y); return d1 < 0 || (d1 == 0 && d2 < 0); }
};

struct Circle { Point O; DB r; };

Point Proj(Point P, Point P1, Point P2) {
	Point v = P2-P1; DB t = (P-P1)%v / (v%v);
	return P1 + t*v;
}

Point GetLineInter(Point P1, Point P2, Point Q1, Point Q2) {
	Point v = P2-P1, w = Q2-Q1; DB t = (Q1-P1)/w / (v/w);
	return P1 + t*v;
}

int Direct1(Point P, Point P1, Point P2) { return sgn((P1-P)%(P2-P)); }
int Direct2(Point P, Point P1, Point P2) { return sgn((P1-P)/(P2-P)); }

int q;

Circle GetInnerCir(Point A, Point B, Point C) {
	Point v1 = B-A, v2 = C-A, v3 = C-B;
	v1 = v1/DB(v1), v2 = v2/DB(v2), v3 = v3/DB(v3);
	Point P = GetLineInter(A, A + (v1+v2), B, B + (v3-v1));
	return (Circle){P, DB(P-Proj(P, A, B))};
}

Circle GetOuterCir(Point A, Point B, Point C) {
	Point M = 0.5*(A+B), N = 0.5*(A+C), v = B-A, w = C-A;
	Point P = GetLineInter(M, M + Point(v.y, -v.x), N, N + Point(w.y, -w.x));
	return (Circle){P, DB(P-A)};
}

std::pair<Point, Point> GetCirLineInter(Circle C, Point P1, Point P2) {
	Point P = Proj(C.O, P1, P2), v = P2-P1; v = v/DB(v);
	DB d = DB(C.O-P);
	if (!sgn(d-C.r)) return std::make_pair(P, P);
	DB t = sqrt(C.r*C.r - d*d);
	return std::make_pair(P+t*v, P-t*v);
}

int main() {
	Circle C;
	scanf("%lf%lf%lf", &C.O.x, &C.O.y, &C.r);
	scanf("%d", &q);
	while (q--) {
		Point P1, P2;
		scanf("%lf%lf%lf%lf", &P1.x, &P1.y, &P2.x, &P2.y);
		std::pair<Point, Point> X = GetCirLineInter(C, P1, P2);
		if (X.y < X.x) std::swap(X.x, X.y);
		printf("%.10lf %.10lf %.10lf %.10lf\n", X.x.x, X.x.y, X.y.x, X.y.y);
	}
	return 0;
}