#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
const int MAXN = 1e4 + 5;
const int MAXM = 1e5 + 5;
const double g = 9.8;
const double EPS = 1e-10;
struct Query {
  double angle;
  int id;
  bool operator<(const Query &rhs) const { return angle < rhs.angle; }
};
struct Wall {
  double x, y;
  bool operator<(const Wall &rhs) const { return x < rhs.x; }
};
int n, V, m;
double ansX[MAXN], ansY[MAXN];
Query q[MAXN];
Wall w[MAXM];
double sq(double x) { return x * x; }
bool toLeft(double alpha, double x, double y) {
  double vx = V * cos(alpha), vy = V * sin(alpha);
  double t = x / vx;
  double ansY = vy * t - g * sq(t) / 2;
  return (ansY > y + EPS);
}
void getDest(double alpha, int i, double &ansX, double &ansY) {
  double vx = V * cos(alpha), vy = V * sin(alpha);
  double t;
  if (i < m) {
    double x = w[i].x, y = w[i].y;
    t = x / vx;
    ansY = vy * t - g * sq(t) / 2;
    if (-EPS < ansY && ansY < y + EPS) {
      ansX = x;
      return;
    }
  }
  t = 2 * vy / g;
  ansX = vx * t;
  ansY = 0;
}
int main() {
  scanf("%d%d", &n, &V);
  for (int i = (0); i <= (n - 1); ++i) {
    scanf("%lf", &q[i].angle);
    q[i].id = i;
  }
  scanf("%d", &m);
  for (int i = (0); i <= (m - 1); ++i) scanf("%lf%lf", &w[i].x, &w[i].y);
  sort(q, q + n);
  sort(w, w + m);
  int j = 0;
  for (int i = (0); i <= (n - 1); ++i) {
    while (j < m && toLeft(q[i].angle, w[j].x, w[j].y)) ++j;
    getDest(q[i].angle, j, ansX[q[i].id], ansY[q[i].id]);
  }
  for (int i = (0); i <= (n - 1); ++i)
    printf("%.15f %.15f\n", ansX[i], ansY[i]);
  return 0;
}
