#include <bits/stdc++.h>
using namespace std;
int n, m, k;
double V;
int cannon[10005];
double para(double x, double A) {
  return -9.8 * x * x / 2 / V / V / cos(A) / cos(A) + sin(A) / cos(A) * x;
}
pair<double, double> walls[100005];
double al[10005];
bool cmp(int a, int b) { return al[a] < al[b] - 1e-9; }
int main() {
  std::ios::sync_with_stdio(false);
  scanf("%d%lf", &n, &V);
  for (int i = 0; i < n; i++) {
    scanf("%lf", al + i);
    cannon[i] = i;
  }
  scanf("%d", &m);
  double x, y;
  for (int i = 0; i < m; i++) {
    scanf("%lf%lf", &x, &y);
    walls[i] = make_pair(x, y);
  }
  sort(walls, walls + m);
  sort(cannon, cannon + n, cmp);
  int j = 0;
  double ans[10005];
  for (int i = 0; i < n; i++) {
    while (j < m && para(walls[j].first, al[cannon[i]]) > walls[j].second) j++;
    if (j >= m || para(walls[j].first, al[cannon[i]]) < 0) {
      ans[cannon[i]] =
          2 * V * V / 9.8 * sin(al[cannon[i]]) * cos(al[cannon[i]]);
    } else {
      ans[cannon[i]] = walls[j].first;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%.9lf %.9lf\n", ans[i], para(ans[i], al[i]));
  }
  return 0;
}
