Problem: In the year of 3000 travelling around parallel realities became a routine thing. However one has to take into consideration that travelling like that is highly dangerous as you never know beforehand where you're gonna get...

Little Vasya, for instance, found himself in a gaming reality and now he has to successfully complete all levels of a very weird game to get back. The gaming reality is a three-dimensional space where n points are given. The game has m levels and at the beginning of the i-th level the player is positioned at some plane Qi that passes through the origin. On each level Vasya has to use special robots to construct and activate n powerful energy spheres of the equal radius with centers at the given points. The player chooses the radius of the spheres himself. The player has to spend R units of money to construct spheres whose radius equals R (consequently, one can construct spheres whose radius equals zero for free). Besides, once for each level a player can choose any point in space and release a laser ray from there, perpendicular to plane Qi (this action costs nothing). The ray can either be directed towards the plane or from the plane. The spheres that share at least one point with the ray will be immediately activated. The level is considered completed if the player has managed to activate all spheres. Note that the centers of the spheres are the same for all m levels but the spheres do not remain: the player should construct them anew on each new level.

Help Vasya find out what minimum sum of money will be enough to complete each level.

Input

The first line contains two integers n and m (1 ≤ n ≤ 900, 1 ≤ m ≤ 100) — the number of energetic spheres and the number of levels in the game correspondingly. 

Each of the following n lines contains three integers xi, yi, zi (0 ≤ xi, yi, zi ≤ 104) — the coordinates of the center of the i-th sphere. Assume that these points do not change their positions throughout the game.

Then follow m lines, each containing three integers ai, bi, ci (0 ≤ ai, bi, ci ≤ 100, ai2 + bi2 + ci2 > 0). These numbers are the coefficients in the equation of plane Qi (aix + biy + ciz = 0), where the player is positioned at the beginning of the i-th level.

Output

Print m numbers, one per line: the i-th line should contain the minimum sum of money needed to complete the i-th level. The absolute or relative error should not exceed 10 - 6.

Examples

Input

4 1
0 0 0
0 1 0
1 0 0
1 1 0
0 0 1


Output

0.7071067812


Input

5 3
0 1 0
1 0 1
1 2 1
2 0 1
1 3 0
1 1 1
1 2 3
3 0 3


Output

1.6329931619
1.6366341768
1.5411035007


Input

2 1
0 20 0
0 0 0
0 10 0


Output

0.0000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(double(-1));
const double INF = 1e10;
const double EPS = 1e-7;
inline double sqr(double x) { return x * x; }
struct PT3 {
  double x, y, z;
  PT3() {}
  PT3(double x, double y, double z) : x(x), y(y), z(z) {}
  void in() { scanf("%lf%lf%lf", &x, &y, &z); }
  double len() { return sqrt(sqr(x) + sqr(y) + sqr(z)); }
};
bool operator<(const PT3& p1, const PT3& p2) {
  if (fabs(p1.x - p2.x) > EPS) return p1.x < p2.x;
  if (fabs(p1.y - p2.y) > EPS) return p1.y < p2.y;
  return p1.z + EPS < p2.z;
}
bool operator==(const PT3& p1, const PT3& p2) {
  return fabs(p1.x - p2.x) < EPS && fabs(p1.y - p2.y) < EPS &&
         fabs(p1.z - p2.z) < EPS;
}
PT3 operator-(PT3 p) { return PT3(-p.x, -p.y, -p.z); }
PT3 operator+(PT3 p1, PT3 p2) {
  return PT3(p1.x + p2.x, p1.y + p2.y, p1.z + p2.z);
}
PT3 operator-(PT3 p1, PT3 p2) {
  return PT3(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
}
PT3 operator*(PT3 p, double c) { return PT3(p.x * c, p.y * c, p.z * c); }
PT3 operator/(PT3 p, double c) { return PT3(p.x / c, p.y / c, p.z / c); }
double dist(PT3 P) { return P.len(); }
double dis2(PT3 p1, PT3 p2) {
  return sqr(p1.x - p2.x) + sqr(p1.y - p2.y) + sqr(p1.z - p2.z);
}
double dis(PT3 p1, PT3 p2) { return sqrt(dis2(p1, p2)); }
PT3 vect(PT3 p1, PT3 p2) {
  return PT3(p1.y * p2.z - p2.y * p1.z, -(p1.x * p2.z - p2.x * p1.z),
             p1.x * p2.y - p2.x * p1.y);
}
double scal(PT3 p1, PT3 p2) { return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z; }
PT3 vect(PT3 p, PT3 p1, PT3 p2) { return vect(p1 - p, p2 - p); }
double scal(PT3 p, PT3 p1, PT3 p2) { return scal(p1 - p, p2 - p); }
PT3 normalize(PT3 a) { return a / sqrt(a.x * a.x + a.y * a.y + a.z * a.z); }
PT3 norm(PT3 a, PT3 b, PT3 c) { return normalize(vect(b - a, c - a)); }
void GetEquation(PT3 A, PT3 B, PT3 C, double& a, double& b, double& c,
                 double& d) {
  PT3 DIR = vect(B - A, C - A);
  a = DIR.x, b = DIR.y, c = DIR.z;
  d = -a * A.x - b * A.y - c * A.z;
}
double GetValue(double a, double b, double c, double d, PT3 A) {
  return a * A.x + b * A.y + c * A.z + d;
}
void rotate(PT3* p, PT3* q, int n, PT3 a, PT3 b, PT3 c) {
  PT3 pole = norm(a, b, c);
  PT3 polex;
  if (pole.x != 0 || pole.y != 0) {
    polex = normalize(PT3(-pole.y, pole.x, 0));
  } else {
    polex = normalize(PT3(0, -pole.z, pole.y));
  }
  PT3 poley = normalize(vect(pole, polex));
  double hiv = scal(pole, p[0]);
  double lov = hiv;
  for (int i = 0; i < n; i++) {
    double v = scal(pole, p[i]);
    hiv = max(v, hiv);
    lov = min(v, lov);
    double x = scal(polex, p[i]);
    double y = scal(poley, p[i]);
    q[i] = PT3(x, y, 0);
  }
}
double disToPlane(PT3 p, double a, double b, double c, double d) {
  return abs(a * p.x + b * p.y + c * p.z + d) / sqrt(sqr(a) + sqr(b) + sqr(c));
}
int intercone(PT3 ci, double A, PT3 cj, double B, PT3& q, PT3& qq) {
  PT3 nor = vect(ci, cj);
  PT3 p = ci * B - cj * A;
  PT3 pp;
  if (fabs(nor.x) > EPS)
    pp = PT3(0, -p.z, p.y) / nor.x;
  else if (fabs(nor.y) > EPS)
    pp = PT3(p.z, 0, -p.x) / nor.y;
  else if (fabs(nor.z) > EPS)
    pp = PT3(-p.y, p.x, 0) / nor.z;
  else
    return -1;
  double a, b, c, d, t1, t2;
  a = scal(nor, nor);
  b = scal(nor, pp);
  c = scal(pp, pp) - 1;
  d = b * b - a * c;
  if (d < 0) return 0;
  t1 = (-b + sqrt(d)) / a;
  t2 = (-b - sqrt(d)) / a;
  q = nor * t1 + pp;
  qq = nor * t2 + pp;
  return 2;
}
PT3 project(PT3 a, PT3 b, PT3 c, PT3 d) {
  PT3 tp = vect(b, c, d);
  return a - (tp * scal(tp, a - b) / scal(tp, tp));
}
void make_plane(PT3 p, PT3 p1, PT3 p2, double& a, double& b, double& c,
                double& d) {
  PT3 q = vect(p, p1, p2);
  a = q.x, b = q.y, c = q.z;
  d = -(a * p.x + b * p.y + c * p.z);
}
void Get3PointsOnPlane(double a, double b, double c, double d, PT3* Q) {
  int flg = 0;
  if (fabs(a) < EPS) {
    if (fabs(b) > EPS)
      flg = 1;
    else
      flg = 2;
  }
  double par[3];
  par[0] = a, par[1] = b, par[2] = c;
  for (int i = 0; i < 3; i++) {
    while (1) {
      double tem[3];
      tem[(flg + 1) % 3] = 1.0 * rand() / 10.0,
                      tem[(flg + 2) % 3] = 1.0 * rand() / 10.0;
      tem[flg] = (-d - tem[(flg + 1) % 3] * par[(flg + 1) % 3] -
                  tem[(flg + 2) % 3] * par[(flg + 2) % 3]) /
                 par[flg];
      Q[i] = PT3(tem[0], tem[1], tem[2]);
      if (i == 2) {
        int flg = 0;
        for (int j = 0; j < 2; j++) {
          if (fabs(dis(Q[j], Q[(j + 1) % 3]) -
                   dis(Q[(j + 1) % 3], Q[(j + 2) % 3]) -
                   dis(Q[j], Q[(j + 2) % 3])) < EPS) {
            flg = 1;
            break;
          }
        }
        if (flg) continue;
      }
      break;
    }
  }
}
int INTERSECT(PT3 a, PT3 b, PT3 c, PT3 d, PT3 e, PT3& res) {
  double A, B, C, D;
  GetEquation(a, b, c, A, B, C, D);
  double t1 = GetValue(A, B, C, D, d);
  double t2 = GetValue(A, B, C, D, e);
  if (fabs(t1) < EPS && fabs(t2) < EPS) {
    res = d;
    return 3;
  }
  if (fabs(t1) < EPS) {
    res = d;
    return 2;
  }
  if (fabs(t2) < EPS) {
    res = e;
    return 2;
  }
  if ((t1 > 0 && t2 > 0) || (t1 < 0 && t2 < 0)) {
    if (fabs(t1 - t2) < EPS) return 1;
    return 0;
  }
  double Ratio = t1 / (t1 - t2);
  res = d + ((e - d) * Ratio);
  return 2;
}
bool intersect(PT3 a, PT3 b, PT3 c, PT3 d, PT3 e, PT3& res) {
  b = b - a;
  c = c - a;
  PT3 h = vect(b, c);
  double s = scal(a - e, h);
  double t = scal(d - e, h);
  if (fabs(t) < EPS) {
    if (fabs(s) < EPS) return 2;
    return 0;
  }
  double x = s / t;
  res = d * x + e * (1 - x);
  return 1;
}
int intersect(PT3 a, PT3 b, PT3 c, PT3 d, PT3& res) {
  PT3 dr = vect(b - a, d - c);
  double chk = scal(dr, c - a);
  if (fabs(chk) < EPS) {
    double area = dist(dr);
    if (area < EPS) {
      double dd = dist(vect(c - a, b - a));
      if (dd < EPS) {
        res = c;
        return 3;
      }
      return 1;
    }
    PT3 DR = vect(c - a, d - a);
    double Ratio = scal(dr, DR) / scal(dr, dr);
    res = a + ((b - a) * Ratio);
    return 2;
  }
  return 0;
}
bool INSIDE(PT3 a, PT3 b, PT3 c) {
  PT3 dr = vect(a - b, a - c);
  if (dist(dr) > EPS) return 0;
  double d = scal(a - b, a - c);
  return d < EPS;
}
double Dist(PT3 a, PT3 b, PT3 c) {
  double da = scal(b - c, b - c);
  double db = scal(a - c, a - c);
  double dc = scal(a - b, a - b);
  if (db < da + dc + EPS && dc < da + db + EPS) {
    PT3 Area = vect(b - a, c - a);
    double area = dist(Area);
    double len = dist(b - c);
    return area / len;
  } else if (da + dc < db)
    return dist(a - b);
  return dist(a - c);
}
double SolveA(PT3 A, PT3 B, PT3 C, PT3 D) {
  double ret = 1e10;
  double d = Dist(B, C, D);
  if (d < ret) ret = d;
  d = Dist(A, C, D);
  if (d < ret) ret = d;
  d = Dist(C, A, B);
  if (d < ret) ret = d;
  d = Dist(D, A, B);
  if (d < ret) ret = d;
  return ret;
}
double SolveB(PT3 A, PT3 B, PT3 C, PT3 D) {
  PT3 DIR = vect(B - A, C - D);
  double a, b, c, d;
  GetEquation(A, B, DIR + A, a, b, c, d);
  double u = GetValue(a, b, c, d, C);
  double v = GetValue(a, b, c, d, D);
  if (u * v <= 0) {
    GetEquation(C, D, DIR + C, a, b, c, d);
    u = GetValue(a, b, c, d, A);
    v = GetValue(a, b, c, d, B);
    if (u * v <= 0) {
      GetEquation(C, D, C + A - B, a, b, c, d);
      double ret = GetValue(a, b, c, d, A);
      return fabs(ret) / dist(DIR);
    }
  }
  return SolveA(A, B, C, D);
}
double CalcDis(PT3 A, PT3 B, PT3 C, PT3 D) {
  PT3 DIR = vect(B - A, D - C);
  if (dist(DIR) < EPS) return SolveA(A, B, C, D);
  return SolveB(A, B, C, D);
}
namespace CONVEX3D {
struct Face {
  int id[3];
  PT3 norm;
  double disc;
};
struct Set2 {
  int a, b;
  inline void clear() { a = b = -1; }
  inline void add(int x) {
    if (a == -1)
      a = x;
    else
      b = x;
  }
  inline void rem(int x) {
    if (a == x)
      a = -1;
    else
      b = -1;
  }
  inline int size() { return (a != -1) + (b != -1); }
};
const int MX = 1005;
int n;
PT3 p[MX];
Set2 e[MX][MX];
vector<Face> vf;
void make_face(int i, int j, int k, int ins) {
  Face fc;
  e[i][j].add(k);
  e[i][k].add(j);
  e[j][k].add(i);
  fc.id[0] = i, fc.id[1] = j, fc.id[2] = k;
  fc.norm = vect(p[i], p[j], p[k]);
  fc.disc = scal(fc.norm, p[i]);
  if (scal(fc.norm, p[ins]) > fc.disc) {
    fc.norm = -fc.norm;
    fc.disc = -fc.disc;
  }
  vf.push_back(fc);
}
bool init() {
  int i;
  PT3 q;
  for (i = 1; i < n; i++) {
    if (!(p[0] == p[i])) break;
  }
  if (i == n) return 0;
  swap(p[1], p[i]);
  for (i = 2; i < n; i++) {
    q = vect(p[0], p[1], p[i]);
    if (!(q == PT3(0, 0, 0))) break;
  }
  if (i == n) return 0;
  swap(p[2], p[i]);
  for (i = 3; i < n; i++) {
    if (scal(q, p[i] - p[0])) break;
  }
  if (i == n) return 0;
  swap(p[3], p[i]);
  return 1;
}
bool convex_hull() {
  int i, j, k, u, v;
  Face f;
  vf.clear();
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) e[i][j].clear();
  }
  if (!init()) return 0;
  for (i = 0; i < 4; i++) {
    for (j = i + 1; j < 4; j++) {
      for (k = j + 1; k < 4; k++) make_face(i, j, k, 6 - i - j - k);
    }
  }
  for (i = 4; i < n; i++) {
    for (j = vf.size() - 1; j >= 0; j--) {
      f = vf[j];
      if (scal(f.norm, p[i]) >= f.disc) {
        for (u = 0; u < 3; u++) {
          for (v = u + 1; v < 3; v++) e[f.id[u]][f.id[v]].rem(f.id[3 - u - v]);
        }
        swap(vf[j], vf.back());
        vf.pop_back();
      }
    }
    for (j = vf.size() - 1; j >= 0; j--) {
      f = vf[j];
      for (u = 0; u < 3; u++) {
        for (v = u + 1; v < 3; v++) {
          if (e[f.id[u]][f.id[v]].size() == 2) continue;
          make_face(f.id[u], f.id[v], i, f.id[3 - u - v]);
        }
      }
    }
  }
  return 1;
}
}  // namespace CONVEX3D
namespace SMALLEST_INVELOPING_CIRCLE {
int side(PT3 a, PT3 b, PT3 c, PT3 x) {
  PT3 norm = vect((b - a), (c - a));
  PT3 me = x - a;
  return (((scal(me, norm)) > EPS) - ((scal(me, norm)) < (-EPS)));
}
bool eq(double x, double y) { return fabs(x - y) < EPS; }
bool is_colinear(PT3 a, PT3 b, PT3 c) {
  PT3 u = b - a, v = c - a;
  PT3 w = vect(u, v);
  return eq(dist(w), 0);
}
bool on(PT3 a, PT3 b, PT3 x) {
  return eq(dist(x - a) + dist(x - b), dist(a - b));
}
PT3 isect(PT3 a, PT3 b, PT3 c, PT3 d) {
  PT3 u = (b - a), v = (d - c), z = (c - a);
  PT3 vz = vect(v, z), vu = vect(v, u);
  double s = dist(vz) / dist(vu) *
             (((scal(vz, vu)) > EPS) - ((scal(vz, vu)) < (-EPS)));
  return a + u * s;
}
bool in_circle(const PT3& v, const pair<PT3, double>& C) {
  return dist(v - C.first) <= C.second + EPS;
}
pair<PT3, double> better(pair<PT3, double> A, pair<PT3, double> B) {
  if (A.second < B.second) return A;
  return B;
}
pair<PT3, double> find_circle(PT3 a) { return {a, 0}; }
pair<PT3, double> find_circle(PT3 a, PT3 b) {
  return {(a + b) / 2, dist(a - b) / 2};
}
pair<PT3, double> find_circle(PT3 a, PT3 b, PT3 c, bool force_on = false) {
  PT3 u = (b - a), v = (c - a);
  PT3 norm = vect(u, v);
  PT3 uperp = vect(u, norm), vperp = vect(v, norm);
  PT3 ab = (a + b) / 2, ac = (a + c) / 2;
  if (is_colinear(a, b, c)) {
    if (on(a, b, c)) return {(a + b) / 2, dist(a - b) / 2};
    if (on(a, c, b)) return {(a + c) / 2, dist(a - c) / 2};
    if (on(c, b, a)) return {(c + b) / 2, dist(c - b) / 2};
    assert(false);
  }
  PT3 ans = isect(ab, ab + uperp, ac, ac + vperp);
  pair<PT3, double> C = {
      ans, (dist(ans - a) + dist(ans - b) + dist(ans - c)) / 3.0l};
  if (force_on) return C;
  pair<PT3, double> C_ab = find_circle(a, b);
  pair<PT3, double> C_bc = find_circle(b, c);
  pair<PT3, double> C_ac = find_circle(a, c);
  if (in_circle(c, C_ab)) C = better(C, C_ab);
  if (in_circle(a, C_bc)) C = better(C, C_bc);
  if (in_circle(b, C_ac)) C = better(C, C_ac);
  return C;
}
pair<PT3, double> find_circle(PT3* P, int N, int K) {
  if (K >= 3) {
    pair<PT3, double> C = find_circle(P[N - 1], P[N - 2], P[N - 3], true);
    return C;
  }
  if (N == 1) return find_circle(P[0]);
  if (N == 2) return find_circle(P[0], P[1]);
  assert(K < N);
  int i = rand() % (N - K);
  swap(P[i], P[N - 1 - K]);
  swap(P[N - 1 - K], P[N - 1]);
  pair<PT3, double> C = find_circle(P, N - 1, K);
  swap(P[N - 1 - K], P[N - 1]);
  swap(P[i], P[N - 1 - K]);
  if (in_circle(P[i], C)) return C;
  swap(P[i], P[N - 1 - K]);
  C = find_circle(P, N, K + 1);
  swap(P[i], P[N - 1 - K]);
  return C;
}
pair<PT3, double> main_find(PT3* P, int N) { return find_circle(P, N, 0); }
}  // namespace SMALLEST_INVELOPING_CIRCLE
using namespace SMALLEST_INVELOPING_CIRCLE;
const int N = 1100;
double a, b, c;
PT3 P[N], Q[3], R[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) P[i].in();
  for (int i = 0; i < m; i++) {
    scanf("%lf%lf%lf", &a, &b, &c);
    Get3PointsOnPlane(a, b, c, 0, Q);
    for (int j = 0; j < n; j++) R[j] = project(P[j], Q[0], Q[1], Q[2]);
    PT3 ret;
    double r;
    printf("%.10lf\n", main_find(R, n).second);
  }
}