#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int maxn = 101010;
pair<double, double> w[maxn];
double V, t, alpha[maxn], Limit[maxn];
double L, R, mid, Max[maxn];
int n, m;
int cmp(double x) {
  if (fabs(x) <= eps) return 0;
  if (x > eps) return 1;
  return -1;
}
int main() {
  scanf("%d%lf", &n, &V);
  for (int i = 1; i <= n; i++) scanf("%lf", &alpha[i]);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%lf%lf", &w[i].first, &w[i].second);
  sort(w + 1, w + 1 + m);
  for (int i = 1; i <= m; i++) {
    L = eps;
    R = 3.1415926535897932384626433 / 4.0;
    double x = w[i].first, y = w[i].second;
    Limit[i] = 0.0;
    while (L + eps < R) {
      mid = (L + R) / 2.0;
      double t = x / V / cos(mid);
      double curY = V * sin(mid) * t - 9.8 * ((t) * (t)) / 2.0;
      if (cmp(curY - y) <= 0)
        L = mid, Limit[i] = mid;
      else
        R = mid;
    }
  }
  Max[1] = Limit[1];
  for (int i = 2; i <= m; i++) Max[i] = max(Max[i - 1], Limit[i]);
  for (int i = 1; i <= n; i++) {
    double x, y, t;
    t = V * sin(alpha[i]) / 9.8 * 2.0;
    x = V * cos(alpha[i]) * t;
    y = 0.0;
    int l = 1, r = m, ans = 0;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (cmp(w[mid].first - x) <= 0)
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    l = 1, r = ans, ans = -1;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (cmp(Max[mid] - alpha[i]) >= 0)
        ans = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    if (ans != -1) {
      x = w[ans].first;
      t = x / V / cos(alpha[i]);
      y = V * sin(alpha[i]) * t - 9.8 * ((t) * (t)) / 2.0;
    }
    printf("%.10lf %.10lf\n", x, y);
  }
  return 0;
}
