#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const double PI = acos(-1);
const double EPS = 1e-7, g = 9.8;
int n, m, V, o[N];
double alpha[N], x[N], y[N], la[N], ra[N], ans[N][2];
double search(double x, double y) {
  double L = 0, R = PI / 4;
  double b = V * sin(R);
  double max_t = 2 * b / g;
  double max_x = V * cos(R) * max_t;
  if (x > max_x) return HUGE_VAL;
  while (L + EPS < R) {
    double M = (L + R) / 2;
    double t = x / V / cos(M);
    double yy = V * sin(M) * t - g * t * t / 2;
    if (yy > y) {
      R = M;
    } else {
      L = M;
    }
  }
  return L;
}
struct node {
  double angle, x;
  int left;
  node() {}
  node(double angle, double x, int left) : angle(angle), x(x), left(left) {}
  bool operator<(const node& no) const {
    return angle < no.angle || (angle == no.angle && left < no.left);
  }
} no[N * 3];
int main() {
  double a = PI / 8;
  scanf("%d%d", &n, &V);
  for (int i = 0; i < n; ++i) scanf("%lf", &alpha[i]);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%lf%lf", &x[i], &y[i]);
    la[i] = search(x[i], 0);
    ra[i] = search(x[i], y[i]);
    no[i * 2] = node(la[i], x[i], INT_MIN);
    no[i * 2 + 1] = node(ra[i], x[i], INT_MAX);
  }
  for (int i = 0; i < n; ++i) no[2 * m + i] = node(alpha[i], -1, i);
  sort(no, no + m * 2 + n);
  multiset<double> xs;
  for (int i = 0; i < m * 2 + n; ++i) {
    if (no[i].left == INT_MIN) {
      xs.insert(no[i].x);
    } else if (no[i].left == INT_MAX) {
      xs.erase(xs.find(no[i].x));
    } else {
      double a = alpha[no[i].left];
      if (xs.empty()) {
        double b = V * sin(a);
        double max_t = 2 * b / g;
        double max_x = V * cos(a) * max_t;
        ans[no[i].left][0] = max_x;
        ans[no[i].left][1] = 0;
      } else {
        double x = *xs.begin();
        double t = x / V / cos(a);
        double y = V * sin(a) * t - g * t * t / 2;
        ans[no[i].left][0] = x;
        ans[no[i].left][1] = y;
      }
    }
  }
  for (int i = 0; i < n; ++i) printf("%.8lf %.8lf\n", ans[i][0], ans[i][1]);
}
