#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932384626433832795;
const double G = 9.8;
int n, m, tp;
double v, ang[100006], loc[100006], Q[100006];
bool typ[100006];
double st[100006];
double x[100006], y[100006];
int c[100006];
bool cmp(const int &a, const int &b) { return x[a] < x[b]; }
double solve(double a, double b) {
  double L = 0, R = PI / 4.0, Mid, t, y;
  while ((R - L) > 1e-7) {
    Mid = (L + R) / 2;
    t = a / v / cos(Mid);
    y = a * tan(Mid) - G / 2 * t * t;
    if (y < b + 1e-7)
      L = Mid;
    else
      R = Mid;
  }
  return L;
}
int main() {
  scanf("%d%lf", &n, &v);
  for (int i = 1; i <= n; i++) scanf("%lf", &Q[i]);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%lf%lf", &x[i], &y[i]);
    c[i] = i;
  }
  sort(c + 1, c + 1 + m, cmp);
  for (int i = 1; i <= m; i++) {
    double tmp1 = solve(x[c[i]], 0), tmp2 = solve(x[c[i]], y[c[i]]);
    if (tp == 0 || tmp1 > ang[tp - 1]) ang[tp] = tmp1, loc[tp++] = x[c[i]];
    if (tp == 0 || tmp2 > ang[tp - 1])
      ang[tp] = tmp2, typ[tp] = 1, loc[tp++] = x[c[i]];
  }
  int u;
  for (int i = 1; i <= n; i++) {
    if (Q[i] <= ang[tp - 1] + 1e-7) {
      u = lower_bound(ang, ang + tp, Q[i]) - ang;
      if (typ[u]) {
        double t = loc[u] / v / cos(Q[i]);
        double y = loc[u] * tan(Q[i]) - G / 2 * t * t;
        printf("%.9lf %.9lf\n", loc[u], y);
      } else
        printf("%.9lf %.9lf\n", v * v * sin(2 * Q[i]) / G, 0.0);
    } else
      printf("%.9lf %.9lf\n", v * v * sin(2 * Q[i]) / G, 0.0);
  }
}
