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;

typedef long long ll;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

typedef long double D;
typedef complex<D> P;

#define X real()
#define Y imag()

const D eps=1e-8;
const D inf=1e12;
const D PI=acos(-1);

namespace std{
  bool operator<(const P& a,const P& b){
    return a.X==b.X?a.Y<b.Y:a.X<b.X;
  }
}
bool cmp_x(const P& a,const P& b){ return abs(a.X-b.X)<eps?a.Y<b.Y:a.X<b.X; }
bool cmp_y(const P& a,const P& b){ return abs(a.Y-b.Y)<eps?a.X<b.X:a.Y<b.Y; }
bool cmp_a(const P& a,const P& b){ return arg(a)==arg(b)?norm(a)<norm(b):arg(a)<arg(b); }
D cross(P a,P b){ return (conj(a)*b).Y; }
D dot(P a,P b){ return (conj(a)*b).X; }
D toRag(D deg){ return deg*PI/180.0; }
P rot(P base,P a,D theta){ return base+polar(abs(a-base),arg(a-base)+theta); }

struct L : public vector<P> { // line and segment
  L(P a,P b){
    push_back(a);
    push_back(b);
  }
};

struct C{
  P p; D r;
  C(P p,D r):p(p),r(r){}
};

enum RELATION{SAME=1,CONTAINED=2,OVER=4,NO_CROSS=8,ONE_CROSS=16,ONE_CONTAINED_CROSS=32,ONE_OVER_CROSS=64,TWO_CROSS=128};
int cRel(C c1, C c2) {
  D d=abs(c1.p-c2.p);
  D dr1=c1.r-c2.r,dr2=c2.r-c1.r;
  D ar=c1.r+c2.r;
  if(d<eps&&c1.r==c2.r)return SAME;
  if(d<dr1)return OVER;
  if(d<dr2)return CONTAINED;
  if(d==dr1)return ONE_OVER_CROSS;
  if(d==dr2)return ONE_CONTAINED_CROSS;
  if(d==ar)return ONE_CROSS;
  if(d>ar)return NO_CROSS;
  return TWO_CROSS;
}

P projection(L l,P p){
  P b=l[1]-l[0],c=p-l[0];
  return l[0]+b*(c/b).X;
}

vector<P> crosspointCL(C c,L l){
  vector<P> res;
  P q=projection(l,c.p);
  double d=sqrt(c.r*c.r-abs(c.p-q)*abs(c.p-q));
  P base=l[1]-l[0];
  res.push_back(q+base*(d/abs(base)));
  res.push_back(q-base*(d/abs(base)));
  return res;
}

int main(){
	cin.sync_with_stdio(false);
  D cx,cy,cr;
  cin>>cx>>cy>>cr;
  C c1=C(P(cx,cy),cr);

  int q;
  cin>>q;
  while(q--){
    D x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    vector<P> res=crosspointCL(c1,L(P(x1,y1),P(x2,y2)));
    sort(all(res),cmp_x);
    printf("%.10Lf %.10Lf %.10Lf %.10Lf\n", res[0].X,res[0].Y,res[1].X,res[1].Y);
  }
  return 0;
}