#include <bits/stdc++.h>
using namespace std;
const double g = 9.8;
double v, al[10005], ss[10005], cc[10005];
int d[10005];
pair<double, double> w[100005];
double first[10005];
double run(double first, double alpha) {
  return (v * sin(alpha) + v * sin(alpha) - g * first / (v * cos(alpha))) *
         first / (v * cos(alpha)) / 2;
}
bool cmp(const int &a, const int &b) { return al[a] < al[b]; }
int main() {
  int n, m;
  scanf("%d%lf", &n, &v);
  for (int i = 1; i <= n; i++)
    scanf("%lf", &al[d[i] = i]), cc[i] = cos(al[i]), ss[i] = sin(al[i]);
  sort(d + 1, d + 1 + n, cmp);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%lf%lf", &w[i].first, &w[i].second);
  sort(w + 1, w + 1 + m);
  int j = 1;
  for (int i = 1; i <= n; i++) {
    while (j <= m && run(w[j].first, al[d[i]]) > w[j].second) j++;
    if (j > m || run(w[j].first, al[d[i]]) < 0) {
      first[d[i]] = v * ss[d[i]] / g * 2 * v * cc[d[i]];
      continue;
    }
    first[d[i]] = w[j].first;
  }
  for (int i = 1; i <= n; i++)
    printf("%.9lf %.9lf\n", first[i], run(first[i], al[i]));
  return 0;
}
