#include <bits/stdc++.h>
using namespace std;
struct hwall {
  double x, y, d;
} wa[111111];
const double pi = 3.1415926535897932384626;
const double g = 9.8;
double a[11111], ans[11111];
int c[11111];
bool cmp1(hwall a, hwall b) { return a.d > b.d; }
bool cmp2(int x, int y) { return a[x] > a[y]; }
int main() {
  int n, m, v, i, j;
  double l, r, mid, t, res;
  scanf("%d%d", &n, &v);
  for (i = 0; i < n; i++) scanf("%lf", a + i), c[i] = i;
  for (scanf("%d", &m), i = 0; i < m; i++) {
    scanf("%lf%lf", &wa[i].x, &wa[i].y);
    for (l = 0.0, r = pi / 4; l < r - 1e-10;) {
      mid = (l + r) / 2;
      t = wa[i].x / (v * cos(mid));
      if (v * sin(mid) * t - g / 2 * t * t <= wa[i].y)
        l = mid;
      else
        r = mid;
    }
    wa[i].d = r;
  }
  sort(wa, wa + m, cmp1);
  sort(c, c + n, cmp2);
  for (i = 0; i < n; i++) ans[i] = v * cos(a[i]) * ((v * sin(a[i])) / g * 2);
  j = 0, res = 1e10;
  for (i = 0; i < n; i++) {
    for (; j < m && a[c[i]] <= wa[j].d; j++)
      if (wa[j].x < res) res = wa[j].x;
    if (res < ans[c[i]]) ans[c[i]] = res;
  }
  for (i = 0; i < n; i++) {
    t = ans[i] / (v * cos(a[i]));
    printf("%.8lf %.8lf\n", ans[i], v * sin(a[i]) * t - g / 2 * t * t);
  }
  return 0;
}
