#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 10;
pair<double, int> p[N];
pair<double, double> ans[N];
pair<double, double> wall[N];
int n, v;
const double g = 9.8;
inline pair<double, double> st(int i, int j) {
  double t = wall[j].first / v / cos(p[i].first);
  return make_pair(wall[j].first, v * sin(p[i].first) * t - g * t * t / 2);
}
int main() {
  scanf("%d%d", &n, &v);
  for (int i = 0; i < (int)n; ++i) scanf("%lf", &p[i].first), p[i].second = i;
  sort(p, p + n);
  for (int i = 0; i < (int)n; ++i)
    ans[p[i].second] =
        make_pair(2 * v * sin(p[i].first) / g * v * cos(p[i].first), 0.);
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (int)m; ++i)
    scanf("%lf%lf", &wall[i].first, &wall[i].second);
  sort(wall, wall + m);
  int j = 0;
  for (int i = 0; i < (int)n; ++i) {
    while (j < m && st(i, j).second > wall[j].second + 1e-8) j++;
    pair<double, double> a = st(i, j);
    if (j < m && a.second >= 0) ans[p[i].second] = min(ans[p[i].second], a);
  }
  for (int i = 0; i < (int)n; ++i)
    printf("%.20lf %.20lf\n", ans[i].first, ans[i].second);
  return 0;
}
