#include <bits/stdc++.h>
using namespace std;
const int N = int(1e4) + 50, M = int(1e5) + 50;
double v;
pair<double, double> fort[M], res[N];
pair<double, int> bullet[N];
int n, m;
int main() {
  scanf("%d%lf", &n, &v);
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &bullet[i].first);
    bullet[i].second = i;
  }
  sort(bullet, bullet + n);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) scanf("%lf%lf", &fort[i].first, &fort[i].second);
  sort(fort, fort + m);
  for (int i = 0, j = 0; i < n; ++i) {
    double vx = v * cos(bullet[i].first), vy = v * sin(bullet[i].first),
           w = vy / 4.9 * vx, t, h;
    for (; j < m && fort[j].first < w; ++j) {
      t = fort[j].first / vx;
      h = vy * t - 4.9 * t * t;
      if (h <= fort[j].second) break;
    }
    if (j < m && fort[j].first < w)
      res[bullet[i].second] = make_pair(fort[j].first, h);
    else
      res[bullet[i].second] = make_pair(w, 0);
  }
  for (int i = 0; i < n; ++i)
    printf("%.9f %.9f\n", res[i].first, res[i].second);
  return 0;
}
