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