#include <bits/stdc++.h>
using namespace std;
int n, m;
double a, v, t, x, y, l, r, mid;
double ax[100010], ay[100010];
const double pi = acos(-1), g = 9.8;
pair<double, double> wa[100010];
set<pair<double, int> > s;
set<pair<double, int> >::iterator p, q, k;
int main() {
  int i, j;
  scanf("%d%lf", &n, &v);
  for (i = 1; i <= n; i++) {
    scanf("%lf", &a);
    s.insert(make_pair(a, i));
  }
  scanf("%d", &m);
  for (i = 1; i <= m; i++) scanf("%lf%lf", &wa[i].first, &wa[i].second);
  sort(wa + 1, wa + 1 + m);
  for (i = 1; i <= m; i++) {
    x = wa[i].first;
    l = 0, r = pi / 4;
    while (l + 1e-12 < r) {
      mid = (l + r) * 0.5;
      t = x / (v * cos(mid));
      y = v * sin(mid) * t - g * t * t * 0.5;
      if (y >= 0)
        r = mid;
      else
        l = mid;
    }
    p = s.lower_bound(make_pair(l - 1e-12, -1e9));
    l = 0, r = pi / 4;
    while (l + 1e-12 < r) {
      mid = (l + r) * 0.5;
      t = x / (v * cos(mid));
      y = v * sin(mid) * t - g * t * t * 0.5;
      if (y >= wa[i].second)
        r = mid;
      else
        l = mid;
    }
    q = s.upper_bound(make_pair(l + 1e-12, 1e9));
    for (; p != q;) {
      a = p->first;
      t = x / (v * cos(a));
      y = v * sin(a) * t - g * t * t * 0.5;
      ax[p->second] = x;
      ay[p->second] = y;
      k = p;
      k++;
      s.erase(p);
      p = k;
    }
  }
  for (p = s.begin(); p != s.end(); p++) {
    a = p->first;
    t = 2 * v * sin(a) / g;
    x = v * cos(a) * t;
    ax[p->second] = x;
  }
  for (i = 1; i <= n; i++) printf("%lf %lf\n", ax[i], ay[i]);
  return 0;
}
