#include <bits/stdc++.h>
using namespace std;
const int maxn = 10010, maxm = 100010;
int n, m;
double V;
pair<double, int> theta[maxn];
pair<double, double> wall[maxm], ans[maxn];
inline double sqr(double x) { return x * x; }
int main() {
  scanf("%d%lf", &n, &V);
  for (int i = 0; i < n; i++)
    scanf("%lf", &theta[i].first), theta[i].second = i;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%lf%lf", &wall[i].first, &wall[i].second);
  sort(theta, theta + n);
  sort(wall, wall + m);
  for (int i = 0, cur = 0; i < n; i++) {
    while (cur < m &&
           wall[cur].first * tan(theta[i].first) -
                   4.9 * sqr(wall[cur].first) / sqr(V * cos(theta[i].first)) >
               wall[cur].second + 1e-8)
      cur++;
    if (cur < m && 2 * V * V * sin(theta[i].first) * cos(theta[i].first) / 9.8 >
                       wall[cur].first + 1e-8) {
      ans[theta[i].second].first = wall[cur].first;
      ans[theta[i].second].second =
          wall[cur].first * tan(theta[i].first) -
          4.9 * sqr(wall[cur].first) / sqr(V * cos(theta[i].first));
    } else
      ans[theta[i].second].first =
          2 * V * V * sin(theta[i].first) * cos(theta[i].first) / 9.8;
  }
  for (int i = 0; i < n; i++)
    printf("%.8lf %.8lf\n", ans[i].first, ans[i].second);
}
