#include <bits/stdc++.h>
using namespace std;
struct fdd {
  double x, y;
} b[100111];
double t, a[100111], x[100111], y[100111];
int n, v, m, p[100111], j = 1;
inline bool cmp1(int aa, int bb) { return a[aa] < a[bb]; }
inline bool cmp2(fdd aa, fdd bb) {
  return aa.x < bb.x || (aa.x == bb.x && aa.y < bb.y);
}
int main() {
  scanf("%d%d", &n, &v);
  for (int i = 1; i <= n; i++) scanf("%lf", &a[i]), p[i] = i;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%lf%lf", &b[i].x, &b[i].y);
  sort(p + 1, p + 1 + n, cmp1);
  sort(b + 1, b + 1 + m, cmp2);
  for (int i = 1; i <= n; i++) {
    int now = p[i];
    double vx = cos(a[now]) * v, vy = sin(a[now]) * v, w = vy / 4.9 * vx;
    while (j <= m && b[j].x < w) {
      t = b[j].x / vx;
      if (vy * t - 4.9 * t * t < b[j].y) break;
      j++;
    }
    if (j <= m && b[j].x < w)
      x[now] = b[j].x, y[now] = vy * t - 4.9 * t * t;
    else
      x[now] = w;
  }
  for (int i = 1; i <= n; i++) printf("%.9lf %.9lf\n", x[i], y[i]);
  return 0;
}
