#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
const double ERR = 1e-13;
int n, m, v;
double ansx[N], ansy[N];
struct Question {
  double a;
  int w;
} q[N];
struct Wall {
  double x, y;
} w[N];
int Dcmp(double x) {
  if (fabs(x) < ERR) return 0;
  return x > ERR ? 1 : -1;
}
bool cmp1(Question a, Question b) { return a.a < b.a; }
bool cmp2(Wall a, Wall b) { return a.x < b.x; }
int main() {
  scanf("%d %d", &n, &v);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &q[i].a);
    q[i].w = i;
  }
  sort(q + 1, q + n + 1, cmp1);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%lf %lf", &w[i].x, &w[i].y);
  sort(w + 1, w + m + 1, cmp2);
  int j = 1;
  for (int i = 1; i <= n; i++) {
    double a = -1.0 / 2 * 9.8 / cos(q[i].a) / cos(q[i].a) / v / v;
    double b = sin(q[i].a) / cos(q[i].a);
    double up = -b / a;
    double tmp = up;
    for (; j <= m; j++) {
      if (Dcmp(w[j].x - up) > 0) break;
      double t = a * w[j].x * w[j].x + b * w[j].x;
      if (Dcmp(t - w[j].y) <= 0) {
        tmp = w[j].x;
        break;
      }
    }
    ansx[q[i].w] = tmp;
    ansy[q[i].w] = a * tmp * tmp + b * tmp;
  }
  for (int i = 1; i <= n; i++) printf("%.9lf %.9lf\n", ansx[i], ansy[i]);
  return 0;
}
