#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
double al[N], X[N], v;
const double eps = 1e-8;
pair<double, double> data[N];
int b[N];
double f(int i, double x) {
  return v * sin(al[b[i]]) * x / (v * cos(al[b[i]])) -
         9.8 * x * x / ((v * cos(al[b[i]])) * (v * cos(al[b[i]]))) / 2.0;
}
bool cmp(int x, int y) { return al[x] < al[y]; }
double r1[N], r2[N];
int main() {
  int n, i, j, m;
  scanf("%d%lf", &n, &v);
  for (i = 0; i < n; i++) {
    scanf("%lf", al + i);
    X[i] = sin(al[i]) * v / 9.8 * 2.0 * v * cos(al[i]);
    b[i] = i;
  }
  sort(b, b + n, cmp);
  scanf("%d", &m);
  for (i = 0; i < m; i++) scanf("%lf%lf", &data[i].first, &data[i].second);
  sort(data, data + m);
  for (j = i = 0; i < n; i++) {
    while (j < m && f(i, data[j].first) > data[j].second + eps) j++;
    if (j < m && X[b[i]] + eps > data[j].first) {
      r1[b[i]] = data[j].first;
      r2[b[i]] = f(i, data[j].first);
    } else {
      r1[b[i]] = X[b[i]];
      r2[b[i]] = 0.0;
    }
  }
  for (i = 0; i < n; i++) printf("%.9lf %.9lf\n", r1[i], r2[i]);
  return 0;
}
