#include <bits/stdc++.h>
struct st {
  double x, y;
  int p;
  bool operator<(const st& B) const { return x - B.x < -1e-9; }
} a[10005], b[100005];
int N, M, V;
double X[10005], Y[10005], t;
double F(int p, double x) {
  t = x / a[p].y;
  return a[p].x * t - 4.9 * t * t;
}
int main() {
  scanf("%d%d", &N, &V);
  for (int i = 1; i <= N; i++)
    scanf("%lf", &t), a[i].y = V * cos(t), a[i].x = V * sin(t), a[i].p = i,
                      X[i] = 2 * a[i].x / 9.8 * a[i].y;
  scanf("%d", &M);
  for (int i = 1; i <= M; i++) scanf("%lf%lf", &b[i].x, &b[i].y), b[i].p = i;
  std::sort(a + 1, a + N + 1), std::sort(b + 1, b + M + 1);
  for (int i = 1, j = 1; i <= M && j <= N; i++) {
    for (; j <= N && F(j, b[i].x) < 1e-9; j++)
      ;
    for (; j <= N && F(j, b[i].x) - b[i].y < 1e-9; j++)
      X[a[j].p] = b[i].x, Y[a[j].p] = F(j, b[i].x);
  }
  for (int i = 1; i <= N; i++) printf("%.9lf %.9lf\n", X[i], Y[i]);
}
