#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const double g = 9.8;
double alp[100100], brk[100100], xs[100100];
struct par {
  double x, y;
} w[100100];
bool cmpw(par a, par b) { return a.x < b.x; }
int cmp(double x, double y) {
  if (fabs(x - y) < 1e-8) return 0;
  if (x < y) return -1;
  return 1;
}
void put(double x, double y) { printf("%.10lf %.10lf\n", x, y); }
int main() {
  int n, m;
  double v;
  while (scanf("%d%lf", &n, &v) == 2) {
    for (int i = 0; i < n; i++) scanf("%lf", &alp[i]);
    scanf("%d", &m);
    for (int i = 0; i < m; i++) scanf("%lf%lf", &w[i].x, &w[i].y);
    sort(w, w + m, cmpw);
    for (int i = 0; i < m; i++) {
      double es = 0, di = pi / 2;
      for (int k = 0; k < 30; k++) {
        double me = (es + di) / 2;
        double t = w[i].x / (v * cos(me));
        double my = v * sin(me) * t - g * t * t / 2.0;
        if (my < w[i].y)
          es = me;
        else
          di = me;
      }
      brk[i + 1] = max(brk[i], (es + di) / 2);
      xs[i] = w[i].x;
    }
    for (int i = 0; i < n; i++) {
      double ld = (2 * v * v * sin(alp[i]) * cos(alp[i])) / g;
      int lw = upper_bound(xs, xs + m, ld) - xs;
      if (cmp(alp[i], brk[lw]) > 0)
        put(ld, 0);
      else {
        int es = 0, di = lw - 1;
        while (di > es) {
          int me = (es + di) / 2;
          if (cmp(brk[me + 1], alp[i]) >= 0)
            di = me;
          else
            es = me + 1;
        }
        double t = xs[es] / (v * cos(alp[i]));
        double cy = v * sin(alp[i]) * t - g * t * t / 2;
        put(xs[es], cy);
      }
    }
  }
  return 0;
}
