#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, s, an, sum;
const double g = 9.8;
const int N = 110000;
class arr {
 public:
  double x, y, p;
  int num;
} a[N], b[N], ans[N];
bool com(const arr &o, const arr &p) { return o.x < p.x; }
int main() {
  double V;
  scanf("%d%lf", &n, &V);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &a[i].x);
    a[i].num = i;
    double A = g / 2;
    double B = V * sin(a[i].x);
    a[i].p = B * V * cos(a[i].x) / A;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%lf%lf", &b[i].x, &b[i].y);
  }
  sort(&a[1], &a[n + 1], com);
  sort(&b[1], &b[m + 1], com);
  int l = 0;
  int r = 1;
  while (l < n) {
    l++;
    while (true) {
      if (r > m) {
        ans[a[l].num].x = a[l].p;
        ans[a[l].num].y = 0;
        break;
      }
      double t = b[r].x / (V * cos(a[l].x));
      double yy = V * sin(a[l].x) * t - g * t * t / 2;
      if (yy < 0) {
        ans[a[l].num].x = a[l].p;
        ans[a[l].num].y = 0;
        break;
      }
      if (yy <= b[r].y) {
        ans[a[l].num].x = b[r].x;
        ans[a[l].num].y = yy;
        break;
      }
      r++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%.8lf %.8lf\n", ans[i].x, ans[i].y);
  return 0;
}
