#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const double G = 9.8;
pair<double, int> r[N];
pair<double, double> w[N];
int n, m, V;
pair<double, double> ans[N];
inline double yy(int i, double t) {
  return sin(r[i].first) * V * t - G * t * t / 2.0;
}
inline double ttx(int i, double x) { return x / cos(r[i].first) / V; }
inline double xx(int i, double t) { return cos(r[i].first) * V * t; }
inline double x0(int i) { return xx(i, sin(r[i].first) * V * 2 / G); }
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> V;
  for (int i = 0; i < n; i++) {
    cin >> r[i].first;
    r[i].second = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) cin >> w[i].first >> w[i].second;
  sort(r, r + n);
  sort(w, w + m);
  int p = 0, q = n;
  for (int i = 0; i < m; i++) {
    while (p < q && yy(p, ttx(p, w[i].first)) < w[i].second) {
      if (yy(p, ttx(p, w[i].first)) < 0)
        ans[r[p].second] = {x0(p), 0};
      else
        ans[r[p].second] = {w[i].first, yy(p, ttx(p, w[i].first))};
      p++;
    }
    while (p < q && yy(q - 1, ttx(q - 1, w[i].first)) < w[i].second) {
      if (yy(q - 1, ttx(q - 1, w[i].first)) < 0)
        ans[r[q - 1].second] = {x0(q - 1), 0};
      else
        ans[r[q - 1].second] = {w[i].first, yy(q - 1, ttx(q - 1, w[i].first))};
      q--;
    }
  }
  while (p < q) {
    ans[r[p].second] = {x0(p), 0};
    p++;
  }
  cout << setprecision(12) << fixed;
  for (int i = 0; i < n; i++)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
