#include <bits/stdc++.h>
using namespace std;
int n, m, N[100001], j, V, W[100001];
double a[100001], x[100001], y[100001], Ax[100001], Ay[100001], h, X, Y, t, w;
void qs1(int l, int r) {
  int i = l, j = r;
  double m = a[(i + j) / 2];
  do {
    while (a[i] < m) i++;
    while (a[j] > m) j--;
    if (i <= j) {
      double t = a[i];
      a[i] = a[j];
      a[j] = t;
      int T = N[i];
      N[i] = N[j];
      N[j] = T;
      i++;
      j--;
    }
  } while (i <= j);
  if (i < r) qs1(i, r);
  if (l < j) qs1(l, j);
}
void qs2(int l, int r) {
  int i = l, j = r;
  double m = x[(i + j) / 2];
  do {
    while (x[i] < m) i++;
    while (x[j] > m) j--;
    if (i <= j) {
      double t = x[i];
      x[i] = x[j];
      x[j] = t;
      t = y[i];
      y[i] = y[j];
      y[j] = t;
      i++;
      j--;
    }
  } while (i <= j);
  if (i < r) qs2(i, r);
  if (l < j) qs2(l, j);
}
int main() {
  scanf("%d%d", &n, &V);
  for (int i = 0; i < n; i++) {
    scanf("%lf", &a[i]);
    N[i] = i;
  }
  qs1(0, n - 1);
  for (int i = 0; i < n; i++) {
    W[N[i]] = i;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%lf%lf", &x[i], &y[i]);
  qs2(0, m - 1);
  for (int i = 0; i < n; i++) {
    X = V * cos(a[i]);
    Y = V * sin(a[i]);
    t = Y / 4.9;
    w = X * t;
    while ((j < m) && (x[j] < w)) {
      h = Y * (x[j] / X) - 4.9 * (x[j] / X) * (x[j] / X);
      if (h >= y[j])
        j++;
      else
        break;
    }
    if ((j < m) && (x[j] < w))
      Ax[i] = x[j], Ay[i] = h;
    else
      Ax[i] = w;
  }
  for (int i = 0; i < n; i++) printf("%.9f %.9f\n", Ax[W[i]], Ay[W[i]]);
  return 0;
}
