#include <bits/stdc++.h>
using namespace std;
int n, m;
const double g = 9.8;
double v, ans_x[100007], ans_y[100007];
struct Node {
  int id;
  double jd;
} node[100007];
struct Wall {
  double x, y;
} W[100007];
bool cmp(Node A, Node B) { return A.jd < B.jd; }
bool cmp2(Wall A, Wall B) { return A.x < B.x; }
inline double tv(double x, double jd) { return (double)x / (v * cos(jd)); }
inline double td(double jd) { return (double)2.0 * v * sin(jd) / g; }
inline double yt(double jd, double t) {
  return (double)v * sin(jd) * t - g * t * t / 2.0;
}
int main() {
  scanf("%d%lf", &n, &v);
  for (int i = 1; i <= n; i++) scanf("%lf", &node[i].jd), node[i].id = i;
  scanf("%d", &m);
  for (int i = 0; i <= m + 5; i++) W[i].x = W[i].y = 2147483647;
  for (int i = 1; i <= m; i++) scanf("%lf%lf", &W[i].x, &W[i].y);
  sort(node + 1, node + n + 1, cmp);
  sort(W + 1, W + m + 1, cmp2);
  int r = 1;
  bool flag = false;
  for (int l = 1; l <= n; l++) {
    if (flag) {
      ans_x[node[l].id] = v * cos(node[l].jd) * td(node[l].jd),
      ans_y[node[l].id] = 0;
      continue;
    }
    while (yt(node[l].jd, tv(W[r].x, node[l].jd)) > W[r].y) {
      r++;
      if (r == m + 1) {
        ans_x[node[l].id] = v * cos(node[l].jd) * td(node[l].jd),
        ans_y[node[l].id] = 0;
        flag = true;
        break;
      }
    }
    if (r != m + 1) {
      if (yt(node[l].jd, tv(W[r].x, node[l].jd)) < 0)
        ans_x[node[l].id] = v * cos(node[l].jd) * td(node[l].jd),
        ans_y[node[l].id] = 0;
      else
        ans_x[node[l].id] = W[r].x,
        ans_y[node[l].id] = yt(node[l].jd, tv(W[r].x, node[l].jd));
    }
  }
  for (int i = 1; i <= n; i++) printf("%.9lf %.9lf\n", ans_x[i], ans_y[i]);
  return 0;
}
