#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 9;
int n, m, j;
double v;
pair<double, double> p[MAX], ans[MAX];
pair<double, int> a[MAX];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> v;
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> p[i].first >> p[i].second;
  sort(p, p + m), sort(a, a + n);
  for (int i = 0; i < n; i++) {
    double vx = v * cos(a[i].first), vy = v * sin(a[i].first);
    double l = vx * vy * 2 / 9.8, h;
    while (j < m && p[j].first < l) {
      double t;
      t = p[j].first / vx;
      h = vy * t - 9.8 * t * t / 2;
      if (h < p[j].second) break;
      j++;
    }
    if (j < m && p[j].first < l)
      ans[a[i].second] = {p[j].first, h};
    else
      ans[a[i].second] = {l, 0};
  }
  for (int i = 0; i < n; i++)
    cout << fixed << setprecision(9) << ans[i].first << " " << ans[i].second
         << endl;
  return 0;
}
