#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
const double g = 9.8;
struct p {
  double x, y;
  bool operator<(const p &b) const { return x < b.x; }
} w[MAX];
struct q {
  int id;
  double a;
  bool operator<(const q &b) const { return a < b.a; }
} ans[MAX];
struct o {
  double x, y;
} Ans[MAX];
int n, m;
double v;
int look(double x) {
  int l = 1, r = m, ans = m;
  while (l <= r) {
    int mid = (l + r >> 1);
    if (x <= w[mid].x)
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  return ans;
}
int main() {
  scanf("%d%lf", &n, &v);
  for (int i = 1; i <= n; ++i)
    scanf("%lf", &ans[i].a),
        Ans[i].x = 2 * sin(ans[i].a) * v / g * cos(ans[i].a) * v, ans[i].id = i;
  sort(ans + 1, ans + 1 + n);
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) scanf("%lf%lf", &w[i].x, &w[i].y);
  sort(w + 1, w + 1 + m);
  int k = 1;
  for (int i = 1; i <= n; ++i) {
    if (Ans[ans[i].id].x >= w[1].x) {
      int N = look(Ans[ans[i].id].x);
      while (k <= N) {
        double t = w[k].x / (cos(ans[i].a) * v),
               yy = (sin(ans[i].a) * v * t - g * t * t / 2);
        if (yy <= w[k].y) {
          Ans[ans[i].id].x = w[k].x, Ans[ans[i].id].y = yy;
          break;
        }
        ++k;
      }
    }
  }
  for (int i = 1; i <= n; ++i) printf("%.8lf %.8lf\n", Ans[i].x, Ans[i].y);
  return 0;
}
