#include <bits/stdc++.h>
int p[100005], q[100005], n, m, V;
double a[100005], x[100005], y[100005], dx[100005], dy[100005], h, vx, vy, t, w;
bool cmp1(const int i, const int j) { return a[i] < a[j]; }
bool cmp2(const int i, const int j) { return x[i] < x[j]; }
bool up(double t, double y) { return (h = vy * t - 9.8 * t * t / 2) > y; }
int main() {
  scanf("%d%d", &n, &V);
  for (int i = 0; i < n; i++) scanf("%lf", &a[i]), q[i] = i;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%lf %lf", &x[i], &y[i]), p[i] = i;
  std::sort(q, q + n, cmp1);
  std::sort(p, p + m, cmp2);
  int j = 0;
  for (int k = 0; k < n; k++) {
    int i = q[k];
    vx = V * cos(a[i]), vy = V * sin(a[i]), t = vy / 4.9, w = vx * t;
    while (j < m && x[p[j]] < w && up(x[p[j]] / vx, y[p[j]])) j++;
    if (j < m && x[p[j]] < w)
      dx[i] = x[p[j]], dy[i] = h;
    else
      dx[i] = w;
  }
  for (int i = 0; i < n; i++) printf("%lf %lf\n", dx[i], dy[i]);
  return 0;
}
